166 } |
166 } |
167 |
167 |
168 ciEnv::~ciEnv() { |
168 ciEnv::~ciEnv() { |
169 CompilerThread* current_thread = CompilerThread::current(); |
169 CompilerThread* current_thread = CompilerThread::current(); |
170 current_thread->set_env(NULL); |
170 current_thread->set_env(NULL); |
|
171 } |
|
172 |
|
173 // ------------------------------------------------------------------ |
|
174 // Cache Jvmti state |
|
175 void ciEnv::cache_jvmti_state() { |
|
176 VM_ENTRY_MARK; |
|
177 // Get Jvmti capabilities under lock to get consistant values. |
|
178 MutexLocker mu(JvmtiThreadState_lock); |
|
179 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint(); |
|
180 _jvmti_can_examine_or_deopt_anywhere = JvmtiExport::can_examine_or_deopt_anywhere(); |
|
181 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables(); |
|
182 _jvmti_can_post_exceptions = JvmtiExport::can_post_exceptions(); |
|
183 } |
|
184 |
|
185 // ------------------------------------------------------------------ |
|
186 // Cache DTrace flags |
|
187 void ciEnv::cache_dtrace_flags() { |
|
188 // Need lock? |
|
189 _dtrace_extended_probes = ExtendedDTraceProbes; |
|
190 if (_dtrace_extended_probes) { |
|
191 _dtrace_monitor_probes = true; |
|
192 _dtrace_method_probes = true; |
|
193 _dtrace_alloc_probes = true; |
|
194 } else { |
|
195 _dtrace_monitor_probes = DTraceMonitorProbes; |
|
196 _dtrace_method_probes = DTraceMethodProbes; |
|
197 _dtrace_alloc_probes = DTraceAllocProbes; |
|
198 } |
171 } |
199 } |
172 |
200 |
173 // ------------------------------------------------------------------ |
201 // ------------------------------------------------------------------ |
174 // helper for lazy exception creation |
202 // helper for lazy exception creation |
175 ciInstance* ciEnv::get_or_create_exception(jobject& handle, symbolHandle name) { |
203 ciInstance* ciEnv::get_or_create_exception(jobject& handle, symbolHandle name) { |
808 |
836 |
809 // Prevent SystemDictionary::add_to_hierarchy from running |
837 // Prevent SystemDictionary::add_to_hierarchy from running |
810 // and invalidating our dependencies until we install this method. |
838 // and invalidating our dependencies until we install this method. |
811 MutexLocker ml(Compile_lock); |
839 MutexLocker ml(Compile_lock); |
812 |
840 |
813 if (log() != NULL) { |
841 // Change in Jvmti state may invalidate compilation. |
814 // Log the dependencies which this compilation declares. |
842 if (!failing() && |
815 dependencies()->log_all_dependencies(); |
843 ( (!jvmti_can_hotswap_or_post_breakpoint() && |
816 } |
844 JvmtiExport::can_hotswap_or_post_breakpoint()) || |
817 |
845 (!jvmti_can_examine_or_deopt_anywhere() && |
818 // Encode the dependencies now, so we can check them right away. |
846 JvmtiExport::can_examine_or_deopt_anywhere()) || |
819 dependencies()->encode_content_bytes(); |
847 (!jvmti_can_access_local_variables() && |
820 |
848 JvmtiExport::can_access_local_variables()) || |
821 // Check for {class loads, evolution, breakpoints} during compilation |
849 (!jvmti_can_post_exceptions() && |
822 check_for_system_dictionary_modification(target); |
850 JvmtiExport::can_post_exceptions()) )) { |
|
851 record_failure("Jvmti state change invalidated dependencies"); |
|
852 } |
|
853 |
|
854 // Change in DTrace flags may invalidate compilation. |
|
855 if (!failing() && |
|
856 ( (!dtrace_extended_probes() && ExtendedDTraceProbes) || |
|
857 (!dtrace_method_probes() && DTraceMethodProbes) || |
|
858 (!dtrace_alloc_probes() && DTraceAllocProbes) )) { |
|
859 record_failure("DTrace flags change invalidated dependencies"); |
|
860 } |
|
861 |
|
862 if (!failing()) { |
|
863 if (log() != NULL) { |
|
864 // Log the dependencies which this compilation declares. |
|
865 dependencies()->log_all_dependencies(); |
|
866 } |
|
867 |
|
868 // Encode the dependencies now, so we can check them right away. |
|
869 dependencies()->encode_content_bytes(); |
|
870 |
|
871 // Check for {class loads, evolution, breakpoints} during compilation |
|
872 check_for_system_dictionary_modification(target); |
|
873 } |
823 |
874 |
824 methodHandle method(THREAD, target->get_methodOop()); |
875 methodHandle method(THREAD, target->get_methodOop()); |
825 |
876 |
826 if (failing()) { |
877 if (failing()) { |
827 // While not a true deoptimization, it is a preemptive decompile. |
878 // While not a true deoptimization, it is a preemptive decompile. |