137 _ArrayIndexOutOfBoundsException_instance = NULL; |
137 _ArrayIndexOutOfBoundsException_instance = NULL; |
138 _ArrayStoreException_instance = NULL; |
138 _ArrayStoreException_instance = NULL; |
139 _ClassCastException_instance = NULL; |
139 _ClassCastException_instance = NULL; |
140 _the_null_string = NULL; |
140 _the_null_string = NULL; |
141 _the_min_jint_string = NULL; |
141 _the_min_jint_string = NULL; |
|
142 |
|
143 _jvmti_can_hotswap_or_post_breakpoint = false; |
|
144 _jvmti_can_access_local_variables = false; |
|
145 _jvmti_can_post_on_exceptions = false; |
|
146 _jvmti_can_pop_frame = false; |
142 } |
147 } |
143 |
148 |
144 ciEnv::ciEnv(Arena* arena) : _ciEnv_arena(mtCompiler) { |
149 ciEnv::ciEnv(Arena* arena) : _ciEnv_arena(mtCompiler) { |
145 ASSERT_IN_VM; |
150 ASSERT_IN_VM; |
146 |
151 |
187 _ArrayIndexOutOfBoundsException_instance = NULL; |
192 _ArrayIndexOutOfBoundsException_instance = NULL; |
188 _ArrayStoreException_instance = NULL; |
193 _ArrayStoreException_instance = NULL; |
189 _ClassCastException_instance = NULL; |
194 _ClassCastException_instance = NULL; |
190 _the_null_string = NULL; |
195 _the_null_string = NULL; |
191 _the_min_jint_string = NULL; |
196 _the_min_jint_string = NULL; |
|
197 |
|
198 _jvmti_can_hotswap_or_post_breakpoint = false; |
|
199 _jvmti_can_access_local_variables = false; |
|
200 _jvmti_can_post_on_exceptions = false; |
|
201 _jvmti_can_pop_frame = false; |
192 } |
202 } |
193 |
203 |
194 ciEnv::~ciEnv() { |
204 ciEnv::~ciEnv() { |
195 CompilerThread* current_thread = CompilerThread::current(); |
205 CompilerThread* current_thread = CompilerThread::current(); |
196 _factory->remove_symbols(); |
206 _factory->remove_symbols(); |
206 // Get Jvmti capabilities under lock to get consistant values. |
216 // Get Jvmti capabilities under lock to get consistant values. |
207 MutexLocker mu(JvmtiThreadState_lock); |
217 MutexLocker mu(JvmtiThreadState_lock); |
208 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint(); |
218 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint(); |
209 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables(); |
219 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables(); |
210 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions(); |
220 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions(); |
|
221 _jvmti_can_pop_frame = JvmtiExport::can_pop_frame(); |
|
222 } |
|
223 |
|
224 bool ciEnv::should_retain_local_variables() const { |
|
225 return _jvmti_can_access_local_variables || _jvmti_can_pop_frame; |
|
226 } |
|
227 |
|
228 bool ciEnv::jvmti_state_changed() const { |
|
229 if (!_jvmti_can_access_local_variables && |
|
230 JvmtiExport::can_access_local_variables()) { |
|
231 return true; |
|
232 } |
|
233 if (!_jvmti_can_hotswap_or_post_breakpoint && |
|
234 JvmtiExport::can_hotswap_or_post_breakpoint()) { |
|
235 return true; |
|
236 } |
|
237 if (!_jvmti_can_post_on_exceptions && |
|
238 JvmtiExport::can_post_on_exceptions()) { |
|
239 return true; |
|
240 } |
|
241 if (!_jvmti_can_pop_frame && |
|
242 JvmtiExport::can_pop_frame()) { |
|
243 return true; |
|
244 } |
|
245 return false; |
211 } |
246 } |
212 |
247 |
213 // ------------------------------------------------------------------ |
248 // ------------------------------------------------------------------ |
214 // Cache DTrace flags |
249 // Cache DTrace flags |
215 void ciEnv::cache_dtrace_flags() { |
250 void ciEnv::cache_dtrace_flags() { |
951 // No safepoints are allowed. Otherwise, class redefinition can occur in between. |
986 // No safepoints are allowed. Otherwise, class redefinition can occur in between. |
952 MutexLocker ml(Compile_lock); |
987 MutexLocker ml(Compile_lock); |
953 No_Safepoint_Verifier nsv; |
988 No_Safepoint_Verifier nsv; |
954 |
989 |
955 // Change in Jvmti state may invalidate compilation. |
990 // Change in Jvmti state may invalidate compilation. |
956 if (!failing() && |
991 if (!failing() && jvmti_state_changed()) { |
957 ( (!jvmti_can_hotswap_or_post_breakpoint() && |
|
958 JvmtiExport::can_hotswap_or_post_breakpoint()) || |
|
959 (!jvmti_can_access_local_variables() && |
|
960 JvmtiExport::can_access_local_variables()) || |
|
961 (!jvmti_can_post_on_exceptions() && |
|
962 JvmtiExport::can_post_on_exceptions()) )) { |
|
963 record_failure("Jvmti state change invalidated dependencies"); |
992 record_failure("Jvmti state change invalidated dependencies"); |
964 } |
993 } |
965 |
994 |
966 // Change in DTrace flags may invalidate compilation. |
995 // Change in DTrace flags may invalidate compilation. |
967 if (!failing() && |
996 if (!failing() && |