comparison src/share/vm/ci/ciEnv.cpp @ 14477:96d2c94bbdd0

8035493: JVMTI PopFrame capability must instruct compilers not to prune locals Reviewed-by: kvn, sla, coleenp, sspitsyn
author mgronlun
date Sat, 22 Feb 2014 10:22:05 +0100
parents 183bd5c00828
children d8041d695d19
comparison
equal deleted inserted replaced
14476:4510a3502166 14477:96d2c94bbdd0
134 _ArrayIndexOutOfBoundsException_instance = NULL; 134 _ArrayIndexOutOfBoundsException_instance = NULL;
135 _ArrayStoreException_instance = NULL; 135 _ArrayStoreException_instance = NULL;
136 _ClassCastException_instance = NULL; 136 _ClassCastException_instance = NULL;
137 _the_null_string = NULL; 137 _the_null_string = NULL;
138 _the_min_jint_string = NULL; 138 _the_min_jint_string = NULL;
139
140 _jvmti_can_hotswap_or_post_breakpoint = false;
141 _jvmti_can_access_local_variables = false;
142 _jvmti_can_post_on_exceptions = false;
143 _jvmti_can_pop_frame = false;
139 } 144 }
140 145
141 ciEnv::ciEnv(Arena* arena) { 146 ciEnv::ciEnv(Arena* arena) {
142 ASSERT_IN_VM; 147 ASSERT_IN_VM;
143 148
184 _ArrayIndexOutOfBoundsException_instance = NULL; 189 _ArrayIndexOutOfBoundsException_instance = NULL;
185 _ArrayStoreException_instance = NULL; 190 _ArrayStoreException_instance = NULL;
186 _ClassCastException_instance = NULL; 191 _ClassCastException_instance = NULL;
187 _the_null_string = NULL; 192 _the_null_string = NULL;
188 _the_min_jint_string = NULL; 193 _the_min_jint_string = NULL;
194
195 _jvmti_can_hotswap_or_post_breakpoint = false;
196 _jvmti_can_access_local_variables = false;
197 _jvmti_can_post_on_exceptions = false;
198 _jvmti_can_pop_frame = false;
189 } 199 }
190 200
191 ciEnv::~ciEnv() { 201 ciEnv::~ciEnv() {
192 CompilerThread* current_thread = CompilerThread::current(); 202 CompilerThread* current_thread = CompilerThread::current();
193 _factory->remove_symbols(); 203 _factory->remove_symbols();
203 // Get Jvmti capabilities under lock to get consistant values. 213 // Get Jvmti capabilities under lock to get consistant values.
204 MutexLocker mu(JvmtiThreadState_lock); 214 MutexLocker mu(JvmtiThreadState_lock);
205 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint(); 215 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
206 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables(); 216 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables();
207 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions(); 217 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
218 _jvmti_can_pop_frame = JvmtiExport::can_pop_frame();
219 }
220
221 bool ciEnv::should_retain_local_variables() const {
222 return _jvmti_can_access_local_variables || _jvmti_can_pop_frame;
223 }
224
225 bool ciEnv::jvmti_state_changed() const {
226 if (!_jvmti_can_access_local_variables &&
227 JvmtiExport::can_access_local_variables()) {
228 return true;
229 }
230 if (!_jvmti_can_hotswap_or_post_breakpoint &&
231 JvmtiExport::can_hotswap_or_post_breakpoint()) {
232 return true;
233 }
234 if (!_jvmti_can_post_on_exceptions &&
235 JvmtiExport::can_post_on_exceptions()) {
236 return true;
237 }
238 if (!_jvmti_can_pop_frame &&
239 JvmtiExport::can_pop_frame()) {
240 return true;
241 }
242 return false;
208 } 243 }
209 244
210 // ------------------------------------------------------------------ 245 // ------------------------------------------------------------------
211 // Cache DTrace flags 246 // Cache DTrace flags
212 void ciEnv::cache_dtrace_flags() { 247 void ciEnv::cache_dtrace_flags() {
938 // No safepoints are allowed. Otherwise, class redefinition can occur in between. 973 // No safepoints are allowed. Otherwise, class redefinition can occur in between.
939 MutexLocker ml(Compile_lock); 974 MutexLocker ml(Compile_lock);
940 No_Safepoint_Verifier nsv; 975 No_Safepoint_Verifier nsv;
941 976
942 // Change in Jvmti state may invalidate compilation. 977 // Change in Jvmti state may invalidate compilation.
943 if (!failing() && 978 if (!failing() && jvmti_state_changed()) {
944 ( (!jvmti_can_hotswap_or_post_breakpoint() &&
945 JvmtiExport::can_hotswap_or_post_breakpoint()) ||
946 (!jvmti_can_access_local_variables() &&
947 JvmtiExport::can_access_local_variables()) ||
948 (!jvmti_can_post_on_exceptions() &&
949 JvmtiExport::can_post_on_exceptions()) )) {
950 record_failure("Jvmti state change invalidated dependencies"); 979 record_failure("Jvmti state change invalidated dependencies");
951 } 980 }
952 981
953 // Change in DTrace flags may invalidate compilation. 982 // Change in DTrace flags may invalidate compilation.
954 if (!failing() && 983 if (!failing() &&