comparison src/share/vm/code/nmethod.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 1baf7f1e3f23
children 0b646334c5f7
comparison
equal deleted inserted replaced
7153:c421c19b7bf8 7154:5d0bb7d52783
866 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts()); 866 _consts_offset = content_offset() + code_buffer->total_offset_of(code_buffer->consts());
867 _stub_offset = content_offset() + code_buffer->total_offset_of(code_buffer->stubs()); 867 _stub_offset = content_offset() + code_buffer->total_offset_of(code_buffer->stubs());
868 868
869 #ifdef GRAAL 869 #ifdef GRAAL
870 _graal_installed_code = installed_code(); 870 _graal_installed_code = installed_code();
871 871 #endif
872 // Graal might not produce any stub sections 872 if (compiler->is_graal()) {
873 if (offsets->value(CodeOffsets::Exceptions) != -1) { 873 // Graal might not produce any stub sections
874 _exception_offset = code_offset() + offsets->value(CodeOffsets::Exceptions); 874 if (offsets->value(CodeOffsets::Exceptions) != -1) {
875 _exception_offset = code_offset() + offsets->value(CodeOffsets::Exceptions);
876 } else {
877 _exception_offset = -1;
878 }
879 if (offsets->value(CodeOffsets::Deopt) != -1) {
880 _deoptimize_offset = code_offset() + offsets->value(CodeOffsets::Deopt);
881 } else {
882 _deoptimize_offset = -1;
883 }
884 if (offsets->value(CodeOffsets::DeoptMH) != -1) {
885 _deoptimize_mh_offset = code_offset() + offsets->value(CodeOffsets::DeoptMH);
886 } else {
887 _deoptimize_mh_offset = -1;
888 }
875 } else { 889 } else {
876 _exception_offset = -1; 890 // Exception handler and deopt handler are in the stub section
877 } 891 assert(offsets->value(CodeOffsets::Exceptions) != -1, "must be set");
878 if (offsets->value(CodeOffsets::Deopt) != -1) { 892 assert(offsets->value(CodeOffsets::Deopt ) != -1, "must be set");
879 _deoptimize_offset = code_offset() + offsets->value(CodeOffsets::Deopt);
880 } else {
881 _deoptimize_offset = -1;
882 }
883 if (offsets->value(CodeOffsets::DeoptMH) != -1) {
884 _deoptimize_mh_offset = code_offset() + offsets->value(CodeOffsets::DeoptMH);
885 } else {
886 _deoptimize_mh_offset = -1;
887 }
888 #else
889 // Exception handler and deopt handler are in the stub section
890 assert(offsets->value(CodeOffsets::Exceptions) != -1, "must be set");
891 assert(offsets->value(CodeOffsets::Deopt ) != -1, "must be set");
892 893
893 _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions); 894 _exception_offset = _stub_offset + offsets->value(CodeOffsets::Exceptions);
894 _deoptimize_offset = _stub_offset + offsets->value(CodeOffsets::Deopt); 895 _deoptimize_offset = _stub_offset + offsets->value(CodeOffsets::Deopt);
895 if (offsets->value(CodeOffsets::DeoptMH) != -1) { 896 if (offsets->value(CodeOffsets::DeoptMH) != -1) {
896 _deoptimize_mh_offset = _stub_offset + offsets->value(CodeOffsets::DeoptMH); 897 _deoptimize_mh_offset = _stub_offset + offsets->value(CodeOffsets::DeoptMH);
897 } else { 898 } else {
898 _deoptimize_mh_offset = -1; 899 _deoptimize_mh_offset = -1;
899 } 900 }
900 #endif 901 }
901 if (offsets->value(CodeOffsets::UnwindHandler) != -1) { 902 if (offsets->value(CodeOffsets::UnwindHandler) != -1) {
902 _unwind_handler_offset = code_offset() + offsets->value(CodeOffsets::UnwindHandler); 903 _unwind_handler_offset = code_offset() + offsets->value(CodeOffsets::UnwindHandler);
903 } else { 904 } else {
904 _unwind_handler_offset = -1; 905 _unwind_handler_offset = -1;
905 } 906 }
1239 return stack_traversal_mark()+1 < NMethodSweeper::traversal_count() && 1240 return stack_traversal_mark()+1 < NMethodSweeper::traversal_count() &&
1240 !is_locked_by_vm(); 1241 !is_locked_by_vm();
1241 } 1242 }
1242 1243
1243 void nmethod::inc_decompile_count() { 1244 void nmethod::inc_decompile_count() {
1244 #ifndef GRAAL 1245 if (!is_compiled_by_c2() && !is_compiled_by_graal()) return;
1245 if (!is_compiled_by_c2()) return;
1246 #endif
1247 // Could be gated by ProfileTraps, but do not bother... 1246 // Could be gated by ProfileTraps, but do not bother...
1248 Method* m = method(); 1247 Method* m = method();
1249 if (m == NULL) return; 1248 if (m == NULL) return;
1250 MethodData* mdo = m->method_data(); 1249 MethodData* mdo = m->method_data();
1251 if (mdo == NULL) return; 1250 if (mdo == NULL) return;