src/share/vm/ci/ciEnv.cpp

Print this page
rev 1178 : merge with cd37471eaecc from http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot


 161   _ArrayStoreException_instance = NULL;
 162   _ClassCastException_instance = NULL;
 163   _the_null_string = NULL;
 164   _the_min_jint_string = NULL;
 165 }
 166 
 167 ciEnv::~ciEnv() {
 168   CompilerThread* current_thread = CompilerThread::current();
 169   current_thread->set_env(NULL);
 170 }
 171 
 172 // ------------------------------------------------------------------
 173 // Cache Jvmti state
 174 void ciEnv::cache_jvmti_state() {
 175   VM_ENTRY_MARK;
 176   // Get Jvmti capabilities under lock to get consistant values.
 177   MutexLocker mu(JvmtiThreadState_lock);
 178   _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
 179   _jvmti_can_examine_or_deopt_anywhere  = JvmtiExport::can_examine_or_deopt_anywhere();
 180   _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables();
 181   _jvmti_can_post_exceptions            = JvmtiExport::can_post_exceptions();
 182 }
 183 
 184 // ------------------------------------------------------------------
 185 // Cache DTrace flags
 186 void ciEnv::cache_dtrace_flags() {
 187   // Need lock?
 188   _dtrace_extended_probes = ExtendedDTraceProbes;
 189   if (_dtrace_extended_probes) {
 190     _dtrace_monitor_probes  = true;
 191     _dtrace_method_probes   = true;
 192     _dtrace_alloc_probes    = true;
 193   } else {
 194     _dtrace_monitor_probes  = DTraceMonitorProbes;
 195     _dtrace_method_probes   = DTraceMethodProbes;
 196     _dtrace_alloc_probes    = DTraceAllocProbes;
 197   }
 198 }
 199 
 200 // ------------------------------------------------------------------
 201 // helper for lazy exception creation


 874                             bool has_debug_info,
 875                             bool has_unsafe_access) {
 876   VM_ENTRY_MARK;
 877   nmethod* nm = NULL;
 878   {
 879     // To prevent compile queue updates.
 880     MutexLocker locker(MethodCompileQueue_lock, THREAD);
 881 
 882     // Prevent SystemDictionary::add_to_hierarchy from running
 883     // and invalidating our dependencies until we install this method.
 884     MutexLocker ml(Compile_lock);
 885 
 886     // Change in Jvmti state may invalidate compilation.
 887     if (!failing() &&
 888         ( (!jvmti_can_hotswap_or_post_breakpoint() &&
 889            JvmtiExport::can_hotswap_or_post_breakpoint()) ||
 890           (!jvmti_can_examine_or_deopt_anywhere() &&
 891            JvmtiExport::can_examine_or_deopt_anywhere()) ||
 892           (!jvmti_can_access_local_variables() &&
 893            JvmtiExport::can_access_local_variables()) ||
 894           (!jvmti_can_post_exceptions() &&
 895            JvmtiExport::can_post_exceptions()) )) {
 896       record_failure("Jvmti state change invalidated dependencies");
 897     }
 898 
 899     // Change in DTrace flags may invalidate compilation.
 900     if (!failing() &&
 901         ( (!dtrace_extended_probes() && ExtendedDTraceProbes) ||
 902           (!dtrace_method_probes() && DTraceMethodProbes) ||
 903           (!dtrace_alloc_probes() && DTraceAllocProbes) )) {
 904       record_failure("DTrace flags change invalidated dependencies");
 905     }
 906 
 907     if (!failing()) {
 908       if (log() != NULL) {
 909         // Log the dependencies which this compilation declares.
 910         dependencies()->log_all_dependencies();
 911       }
 912 
 913       // Encode the dependencies now, so we can check them right away.
 914       dependencies()->encode_content_bytes();
 915 




 161   _ArrayStoreException_instance = NULL;
 162   _ClassCastException_instance = NULL;
 163   _the_null_string = NULL;
 164   _the_min_jint_string = NULL;
 165 }
 166 
 167 ciEnv::~ciEnv() {
 168   CompilerThread* current_thread = CompilerThread::current();
 169   current_thread->set_env(NULL);
 170 }
 171 
 172 // ------------------------------------------------------------------
 173 // Cache Jvmti state
 174 void ciEnv::cache_jvmti_state() {
 175   VM_ENTRY_MARK;
 176   // Get Jvmti capabilities under lock to get consistant values.
 177   MutexLocker mu(JvmtiThreadState_lock);
 178   _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
 179   _jvmti_can_examine_or_deopt_anywhere  = JvmtiExport::can_examine_or_deopt_anywhere();
 180   _jvmti_can_access_local_variables     = JvmtiExport::can_access_local_variables();
 181   _jvmti_can_post_on_exceptions            = JvmtiExport::can_post_on_exceptions();
 182 }
 183 
 184 // ------------------------------------------------------------------
 185 // Cache DTrace flags
 186 void ciEnv::cache_dtrace_flags() {
 187   // Need lock?
 188   _dtrace_extended_probes = ExtendedDTraceProbes;
 189   if (_dtrace_extended_probes) {
 190     _dtrace_monitor_probes  = true;
 191     _dtrace_method_probes   = true;
 192     _dtrace_alloc_probes    = true;
 193   } else {
 194     _dtrace_monitor_probes  = DTraceMonitorProbes;
 195     _dtrace_method_probes   = DTraceMethodProbes;
 196     _dtrace_alloc_probes    = DTraceAllocProbes;
 197   }
 198 }
 199 
 200 // ------------------------------------------------------------------
 201 // helper for lazy exception creation


 874                             bool has_debug_info,
 875                             bool has_unsafe_access) {
 876   VM_ENTRY_MARK;
 877   nmethod* nm = NULL;
 878   {
 879     // To prevent compile queue updates.
 880     MutexLocker locker(MethodCompileQueue_lock, THREAD);
 881 
 882     // Prevent SystemDictionary::add_to_hierarchy from running
 883     // and invalidating our dependencies until we install this method.
 884     MutexLocker ml(Compile_lock);
 885 
 886     // Change in Jvmti state may invalidate compilation.
 887     if (!failing() &&
 888         ( (!jvmti_can_hotswap_or_post_breakpoint() &&
 889            JvmtiExport::can_hotswap_or_post_breakpoint()) ||
 890           (!jvmti_can_examine_or_deopt_anywhere() &&
 891            JvmtiExport::can_examine_or_deopt_anywhere()) ||
 892           (!jvmti_can_access_local_variables() &&
 893            JvmtiExport::can_access_local_variables()) ||
 894           (!jvmti_can_post_on_exceptions() &&
 895            JvmtiExport::can_post_on_exceptions()) )) {
 896       record_failure("Jvmti state change invalidated dependencies");
 897     }
 898 
 899     // Change in DTrace flags may invalidate compilation.
 900     if (!failing() &&
 901         ( (!dtrace_extended_probes() && ExtendedDTraceProbes) ||
 902           (!dtrace_method_probes() && DTraceMethodProbes) ||
 903           (!dtrace_alloc_probes() && DTraceAllocProbes) )) {
 904       record_failure("DTrace flags change invalidated dependencies");
 905     }
 906 
 907     if (!failing()) {
 908       if (log() != NULL) {
 909         // Log the dependencies which this compilation declares.
 910         dependencies()->log_all_dependencies();
 911       }
 912 
 913       // Encode the dependencies now, so we can check them right away.
 914       dependencies()->encode_content_bytes();
 915