comparison src/share/vm/oops/methodData.cpp @ 7154:5d0bb7d52783

changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
author Doug Simon <doug.simon@oracle.com>
date Wed, 12 Dec 2012 21:36:40 +0100
parents e522a00b91aa
children 5fc51c1ecdeb
comparison
equal deleted inserted replaced
7153:c421c19b7bf8 7154:5d0bb7d52783
453 // a DataLayout header, with no extra cells. 453 // a DataLayout header, with no extra cells.
454 assert(cell_count >= 0, "sanity"); 454 assert(cell_count >= 0, "sanity");
455 return DataLayout::compute_size_in_bytes(cell_count); 455 return DataLayout::compute_size_in_bytes(cell_count);
456 } 456 }
457 457
458 #ifdef GRAAL 458 #ifdef GRAALVM
459 int MethodData::compute_extra_data_count(int data_size, int empty_bc_count) { 459 int MethodData::compute_extra_data_count(int data_size, int empty_bc_count) {
460 if (!ProfileTraps) return 0; 460 if (!ProfileTraps) return 0;
461 461
462 // Assume that up to 30% of the possibly trapping BCIs with no MDP will need to allocate one. 462 // Assume that up to 30% of the possibly trapping BCIs with no MDP will need to allocate one.
463 return MIN2(empty_bc_count, MAX2(4, (empty_bc_count * 30) / 100)); 463 return MIN2(empty_bc_count, MAX2(4, (empty_bc_count * 30) / 100));
498 498
499 // Add some extra DataLayout cells (at least one) to track stray traps. 499 // Add some extra DataLayout cells (at least one) to track stray traps.
500 int extra_data_count = compute_extra_data_count(data_size, empty_bc_count); 500 int extra_data_count = compute_extra_data_count(data_size, empty_bc_count);
501 object_size += extra_data_count * DataLayout::compute_size_in_bytes(0); 501 object_size += extra_data_count * DataLayout::compute_size_in_bytes(0);
502 502
503 #ifndef GRAAL 503 #ifndef GRAALVM
504 // Add a cell to record information about modified arguments. 504 // Add a cell to record information about modified arguments.
505 int arg_size = method->size_of_parameters(); 505 int arg_size = method->size_of_parameters();
506 object_size += DataLayout::compute_size_in_bytes(arg_size+1); 506 object_size += DataLayout::compute_size_in_bytes(arg_size+1);
507 #endif 507 #endif
508 return object_size; 508 return object_size;
702 // Add some extra DataLayout cells (at least one) to track stray traps. 702 // Add some extra DataLayout cells (at least one) to track stray traps.
703 int extra_data_count = compute_extra_data_count(data_size, empty_bc_count); 703 int extra_data_count = compute_extra_data_count(data_size, empty_bc_count);
704 int extra_size = extra_data_count * DataLayout::compute_size_in_bytes(0); 704 int extra_size = extra_data_count * DataLayout::compute_size_in_bytes(0);
705 object_size += extra_size; 705 object_size += extra_size;
706 706
707 #ifndef GRAAL 707 #ifndef GRAALVM
708 // Add a cell to record information about modified arguments. 708 // Add a cell to record information about modified arguments.
709 // Set up _args_modified array after traps cells so that 709 // Set up _args_modified array after traps cells so that
710 // the code for traps cells works. 710 // the code for traps cells works.
711 DataLayout *dp = data_layout_at(data_size + extra_size); 711 DataLayout *dp = data_layout_at(data_size + extra_size);
712 712
726 726
727 set_size(object_size); 727 set_size(object_size);
728 } 728 }
729 729
730 bool MethodData::is_empty_data(int size_in_bytes, Bytecodes::Code code) { 730 bool MethodData::is_empty_data(int size_in_bytes, Bytecodes::Code code) {
731 #ifdef GRAAL 731 #ifdef GRAALVM
732 return size_in_bytes == 0 && Bytecodes::can_trap(code); 732 return size_in_bytes == 0 && Bytecodes::can_trap(code);
733 #else 733 #else
734 return size_in_bytes == 0; 734 return size_in_bytes == 0;
735 #endif 735 #endif
736 } 736 }
760 } 760 }
761 761
762 void MethodData::inc_decompile_count() { 762 void MethodData::inc_decompile_count() {
763 _nof_decompiles += 1; 763 _nof_decompiles += 1;
764 if (decompile_count() > (uint)PerMethodRecompilationCutoff) { 764 if (decompile_count() > (uint)PerMethodRecompilationCutoff) {
765 #ifdef GRAAL
766 // TODO (chaeubl) enable this in the fastdebug build only once we are more stable
767 ResourceMark m;
768 tty->print_cr("WARN: endless recompilation of %s. Method was set to not compilable.", method()->name_and_sig_as_C_string());
769 //ShouldNotReachHere();
770 #endif
771 method()->set_not_compilable(CompLevel_full_optimization); 765 method()->set_not_compilable(CompLevel_full_optimization);
772 } 766 }
773 } 767 }
774 768
775 // Translate a bci to its corresponding data index (di). 769 // Translate a bci to its corresponding data index (di).