1.1 --- a/src/share/vm/ci/ciEnv.cpp Fri May 08 10:34:31 2009 -0700 1.2 +++ b/src/share/vm/ci/ciEnv.cpp Fri May 08 10:44:20 2009 -0700 1.3 @@ -171,6 +171,34 @@ 1.4 } 1.5 1.6 // ------------------------------------------------------------------ 1.7 +// Cache Jvmti state 1.8 +void ciEnv::cache_jvmti_state() { 1.9 + VM_ENTRY_MARK; 1.10 + // Get Jvmti capabilities under lock to get consistant values. 1.11 + MutexLocker mu(JvmtiThreadState_lock); 1.12 + _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint(); 1.13 + _jvmti_can_examine_or_deopt_anywhere = JvmtiExport::can_examine_or_deopt_anywhere(); 1.14 + _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables(); 1.15 + _jvmti_can_post_exceptions = JvmtiExport::can_post_exceptions(); 1.16 +} 1.17 + 1.18 +// ------------------------------------------------------------------ 1.19 +// Cache DTrace flags 1.20 +void ciEnv::cache_dtrace_flags() { 1.21 + // Need lock? 1.22 + _dtrace_extended_probes = ExtendedDTraceProbes; 1.23 + if (_dtrace_extended_probes) { 1.24 + _dtrace_monitor_probes = true; 1.25 + _dtrace_method_probes = true; 1.26 + _dtrace_alloc_probes = true; 1.27 + } else { 1.28 + _dtrace_monitor_probes = DTraceMonitorProbes; 1.29 + _dtrace_method_probes = DTraceMethodProbes; 1.30 + _dtrace_alloc_probes = DTraceAllocProbes; 1.31 + } 1.32 +} 1.33 + 1.34 +// ------------------------------------------------------------------ 1.35 // helper for lazy exception creation 1.36 ciInstance* ciEnv::get_or_create_exception(jobject& handle, symbolHandle name) { 1.37 VM_ENTRY_MARK; 1.38 @@ -810,16 +838,39 @@ 1.39 // and invalidating our dependencies until we install this method. 1.40 MutexLocker ml(Compile_lock); 1.41 1.42 - if (log() != NULL) { 1.43 - // Log the dependencies which this compilation declares. 1.44 - dependencies()->log_all_dependencies(); 1.45 + // Change in Jvmti state may invalidate compilation. 1.46 + if (!failing() && 1.47 + ( (!jvmti_can_hotswap_or_post_breakpoint() && 1.48 + JvmtiExport::can_hotswap_or_post_breakpoint()) || 1.49 + (!jvmti_can_examine_or_deopt_anywhere() && 1.50 + JvmtiExport::can_examine_or_deopt_anywhere()) || 1.51 + (!jvmti_can_access_local_variables() && 1.52 + JvmtiExport::can_access_local_variables()) || 1.53 + (!jvmti_can_post_exceptions() && 1.54 + JvmtiExport::can_post_exceptions()) )) { 1.55 + record_failure("Jvmti state change invalidated dependencies"); 1.56 } 1.57 1.58 - // Encode the dependencies now, so we can check them right away. 1.59 - dependencies()->encode_content_bytes(); 1.60 + // Change in DTrace flags may invalidate compilation. 1.61 + if (!failing() && 1.62 + ( (!dtrace_extended_probes() && ExtendedDTraceProbes) || 1.63 + (!dtrace_method_probes() && DTraceMethodProbes) || 1.64 + (!dtrace_alloc_probes() && DTraceAllocProbes) )) { 1.65 + record_failure("DTrace flags change invalidated dependencies"); 1.66 + } 1.67 1.68 - // Check for {class loads, evolution, breakpoints} during compilation 1.69 - check_for_system_dictionary_modification(target); 1.70 + if (!failing()) { 1.71 + if (log() != NULL) { 1.72 + // Log the dependencies which this compilation declares. 1.73 + dependencies()->log_all_dependencies(); 1.74 + } 1.75 + 1.76 + // Encode the dependencies now, so we can check them right away. 1.77 + dependencies()->encode_content_bytes(); 1.78 + 1.79 + // Check for {class loads, evolution, breakpoints} during compilation 1.80 + check_for_system_dictionary_modification(target); 1.81 + } 1.82 1.83 methodHandle method(THREAD, target->get_methodOop()); 1.84