< prev index next >

src/hotspot/share/ci/ciEnv.cpp

Print this page




  27 #include "ci/ciConstant.hpp"
  28 #include "ci/ciEnv.hpp"
  29 #include "ci/ciField.hpp"
  30 #include "ci/ciInstance.hpp"
  31 #include "ci/ciInstanceKlass.hpp"
  32 #include "ci/ciMethod.hpp"
  33 #include "ci/ciNullObject.hpp"
  34 #include "ci/ciReplay.hpp"
  35 #include "ci/ciUtilities.inline.hpp"
  36 #include "classfile/symbolTable.hpp"
  37 #include "classfile/systemDictionary.hpp"
  38 #include "classfile/vmSymbols.hpp"
  39 #include "code/codeCache.hpp"
  40 #include "code/scopeDesc.hpp"
  41 #include "compiler/compileBroker.hpp"
  42 #include "compiler/compileLog.hpp"
  43 #include "compiler/disassembler.hpp"
  44 #include "gc/shared/collectedHeap.inline.hpp"
  45 #include "interpreter/linkResolver.hpp"
  46 #include "jfr/jfrEvents.hpp"
  47 #include "logging/log.hpp"
  48 #include "memory/allocation.inline.hpp"
  49 #include "memory/oopFactory.hpp"
  50 #include "memory/resourceArea.hpp"
  51 #include "memory/universe.hpp"
  52 #include "oops/constantPool.inline.hpp"
  53 #include "oops/cpCache.inline.hpp"
  54 #include "oops/method.inline.hpp"
  55 #include "oops/methodData.hpp"
  56 #include "oops/objArrayKlass.hpp"
  57 #include "oops/objArrayOop.inline.hpp"
  58 #include "oops/oop.inline.hpp"
  59 #include "prims/jvmtiExport.hpp"
  60 #include "runtime/handles.inline.hpp"
  61 #include "runtime/init.hpp"
  62 #include "runtime/reflection.hpp"
  63 #include "runtime/jniHandles.inline.hpp"
  64 #include "runtime/safepointVerifiers.hpp"
  65 #include "runtime/sharedRuntime.hpp"
  66 #include "runtime/thread.inline.hpp"
  67 #include "utilities/dtrace.hpp"


 975 
 976     // Prevent SystemDictionary::add_to_hierarchy from running
 977     // and invalidating our dependencies until we install this method.
 978     // No safepoints are allowed. Otherwise, class redefinition can occur in between.
 979     MutexLocker ml(Compile_lock);
 980     NoSafepointVerifier nsv;
 981 
 982     // Change in Jvmti state may invalidate compilation.
 983     if (!failing() && jvmti_state_changed()) {
 984       record_failure("Jvmti state change invalidated dependencies");
 985     }
 986 
 987     // Change in DTrace flags may invalidate compilation.
 988     if (!failing() &&
 989         ( (!dtrace_extended_probes() && ExtendedDTraceProbes) ||
 990           (!dtrace_method_probes() && DTraceMethodProbes) ||
 991           (!dtrace_alloc_probes() && DTraceAllocProbes) )) {
 992       record_failure("DTrace flags change invalidated dependencies");
 993     }
 994 
 995     if (!failing() && target->needs_clinit_barrier() &&
 996         target->holder()->is_in_error_state()) {
 997       record_failure("method holder is in error state");
 998     }
 999 
1000     if (!failing()) {
1001       if (log() != NULL) {
1002         // Log the dependencies which this compilation declares.
1003         dependencies()->log_all_dependencies();
1004       }
1005 
1006       // Encode the dependencies now, so we can check them right away.
1007       dependencies()->encode_content_bytes();
1008 
1009       // Check for {class loads, evolution, breakpoints, ...} during compilation
1010       validate_compile_task_dependencies(target);
1011     }
1012 
1013     methodHandle method(THREAD, target->get_Method());
1014 
1015 #if INCLUDE_RTM_OPT
1016     if (!failing() && (rtm_state != NoRTM) &&
1017         (method()->method_data() != NULL) &&
1018         (method()->method_data()->rtm_state() != rtm_state)) {
1019       // Preemptive decompile if rtm state was changed.


1060 
1061       // Record successful registration.
1062       // (Put nm into the task handle *before* publishing to the Java heap.)
1063       if (task() != NULL) {
1064         task()->set_code(nm);
1065       }
1066 
1067       if (entry_bci == InvocationEntryBci) {
1068         if (TieredCompilation) {
1069           // If there is an old version we're done with it
1070           CompiledMethod* old = method->code();
1071           if (TraceMethodReplacement && old != NULL) {
1072             ResourceMark rm;
1073             char *method_name = method->name_and_sig_as_C_string();
1074             tty->print_cr("Replacing method %s", method_name);
1075           }
1076           if (old != NULL) {
1077             old->make_not_used();
1078           }
1079         }
1080 
1081         LogTarget(Info, nmethod, install) lt;
1082         if (lt.is_enabled()) {
1083           ResourceMark rm;
1084           char *method_name = method->name_and_sig_as_C_string();
1085           lt.print("Installing method (%d) %s ",
1086                     task()->comp_level(), method_name);


1087         }
1088         // Allow the code to be executed
1089         method->set_code(method, nm);
1090       } else {
1091         LogTarget(Info, nmethod, install) lt;
1092         if (lt.is_enabled()) {
1093           ResourceMark rm;
1094           char *method_name = method->name_and_sig_as_C_string();
1095           lt.print("Installing osr method (%d) %s @ %d",
1096                     task()->comp_level(), method_name, entry_bci);



1097         }
1098         method->method_holder()->add_osr_nmethod(nm);
1099       }
1100       nm->make_in_use();
1101     }
1102   }  // safepoints are allowed again
1103 
1104   if (nm != NULL) {
1105     // JVMTI -- compiled method notification (must be done outside lock)
1106     nm->post_compiled_method_load_event();
1107   } else {
1108     // The CodeCache is full.
1109     record_failure("code cache is full");
1110   }
1111 }
1112 
1113 
1114 // ------------------------------------------------------------------
1115 // ciEnv::find_system_klass
1116 ciKlass* ciEnv::find_system_klass(ciSymbol* klass_name) {




  27 #include "ci/ciConstant.hpp"
  28 #include "ci/ciEnv.hpp"
  29 #include "ci/ciField.hpp"
  30 #include "ci/ciInstance.hpp"
  31 #include "ci/ciInstanceKlass.hpp"
  32 #include "ci/ciMethod.hpp"
  33 #include "ci/ciNullObject.hpp"
  34 #include "ci/ciReplay.hpp"
  35 #include "ci/ciUtilities.inline.hpp"
  36 #include "classfile/symbolTable.hpp"
  37 #include "classfile/systemDictionary.hpp"
  38 #include "classfile/vmSymbols.hpp"
  39 #include "code/codeCache.hpp"
  40 #include "code/scopeDesc.hpp"
  41 #include "compiler/compileBroker.hpp"
  42 #include "compiler/compileLog.hpp"
  43 #include "compiler/disassembler.hpp"
  44 #include "gc/shared/collectedHeap.inline.hpp"
  45 #include "interpreter/linkResolver.hpp"
  46 #include "jfr/jfrEvents.hpp"

  47 #include "memory/allocation.inline.hpp"
  48 #include "memory/oopFactory.hpp"
  49 #include "memory/resourceArea.hpp"
  50 #include "memory/universe.hpp"
  51 #include "oops/constantPool.inline.hpp"
  52 #include "oops/cpCache.inline.hpp"
  53 #include "oops/method.inline.hpp"
  54 #include "oops/methodData.hpp"
  55 #include "oops/objArrayKlass.hpp"
  56 #include "oops/objArrayOop.inline.hpp"
  57 #include "oops/oop.inline.hpp"
  58 #include "prims/jvmtiExport.hpp"
  59 #include "runtime/handles.inline.hpp"
  60 #include "runtime/init.hpp"
  61 #include "runtime/reflection.hpp"
  62 #include "runtime/jniHandles.inline.hpp"
  63 #include "runtime/safepointVerifiers.hpp"
  64 #include "runtime/sharedRuntime.hpp"
  65 #include "runtime/thread.inline.hpp"
  66 #include "utilities/dtrace.hpp"


 974 
 975     // Prevent SystemDictionary::add_to_hierarchy from running
 976     // and invalidating our dependencies until we install this method.
 977     // No safepoints are allowed. Otherwise, class redefinition can occur in between.
 978     MutexLocker ml(Compile_lock);
 979     NoSafepointVerifier nsv;
 980 
 981     // Change in Jvmti state may invalidate compilation.
 982     if (!failing() && jvmti_state_changed()) {
 983       record_failure("Jvmti state change invalidated dependencies");
 984     }
 985 
 986     // Change in DTrace flags may invalidate compilation.
 987     if (!failing() &&
 988         ( (!dtrace_extended_probes() && ExtendedDTraceProbes) ||
 989           (!dtrace_method_probes() && DTraceMethodProbes) ||
 990           (!dtrace_alloc_probes() && DTraceAllocProbes) )) {
 991       record_failure("DTrace flags change invalidated dependencies");
 992     }
 993 





 994     if (!failing()) {
 995       if (log() != NULL) {
 996         // Log the dependencies which this compilation declares.
 997         dependencies()->log_all_dependencies();
 998       }
 999 
1000       // Encode the dependencies now, so we can check them right away.
1001       dependencies()->encode_content_bytes();
1002 
1003       // Check for {class loads, evolution, breakpoints, ...} during compilation
1004       validate_compile_task_dependencies(target);
1005     }
1006 
1007     methodHandle method(THREAD, target->get_Method());
1008 
1009 #if INCLUDE_RTM_OPT
1010     if (!failing() && (rtm_state != NoRTM) &&
1011         (method()->method_data() != NULL) &&
1012         (method()->method_data()->rtm_state() != rtm_state)) {
1013       // Preemptive decompile if rtm state was changed.


1054 
1055       // Record successful registration.
1056       // (Put nm into the task handle *before* publishing to the Java heap.)
1057       if (task() != NULL) {
1058         task()->set_code(nm);
1059       }
1060 
1061       if (entry_bci == InvocationEntryBci) {
1062         if (TieredCompilation) {
1063           // If there is an old version we're done with it
1064           CompiledMethod* old = method->code();
1065           if (TraceMethodReplacement && old != NULL) {
1066             ResourceMark rm;
1067             char *method_name = method->name_and_sig_as_C_string();
1068             tty->print_cr("Replacing method %s", method_name);
1069           }
1070           if (old != NULL) {
1071             old->make_not_used();
1072           }
1073         }
1074         if (TraceNMethodInstalls) {


1075           ResourceMark rm;
1076           char *method_name = method->name_and_sig_as_C_string();
1077           ttyLocker ttyl;
1078           tty->print_cr("Installing method (%d) %s ",
1079                         task()->comp_level(),
1080                         method_name);
1081         }
1082         // Allow the code to be executed
1083         method->set_code(method, nm);
1084       } else {
1085         if (TraceNMethodInstalls) {

1086           ResourceMark rm;
1087           char *method_name = method->name_and_sig_as_C_string();
1088           ttyLocker ttyl;
1089           tty->print_cr("Installing osr method (%d) %s @ %d",
1090                         task()->comp_level(),
1091                         method_name,
1092                         entry_bci);
1093         }
1094         method->method_holder()->add_osr_nmethod(nm);
1095       }
1096       nm->make_in_use();
1097     }
1098   }  // safepoints are allowed again
1099 
1100   if (nm != NULL) {
1101     // JVMTI -- compiled method notification (must be done outside lock)
1102     nm->post_compiled_method_load_event();
1103   } else {
1104     // The CodeCache is full.
1105     record_failure("code cache is full");
1106   }
1107 }
1108 
1109 
1110 // ------------------------------------------------------------------
1111 // ciEnv::find_system_klass
1112 ciKlass* ciEnv::find_system_klass(ciSymbol* klass_name) {


< prev index next >