comparison src/share/vm/runtime/frame.cpp @ 1727:da877bdc9000

6975006: assert(check.is_deoptimized_frame()) failed: missed deopt Reviewed-by: kvn, twisti
author never
date Thu, 12 Aug 2010 23:34:34 -0700
parents d2ede61b7a12
children 3e8fbc61cee8
comparison
equal deleted inserted replaced
1726:71faaa8e3ccc 1727:da877bdc9000
213 return false; 213 return false;
214 214
215 return !nm->is_at_poll_return(pc()); 215 return !nm->is_at_poll_return(pc());
216 } 216 }
217 217
218 void frame::deoptimize(JavaThread* thread, bool thread_is_known_safe) { 218 void frame::deoptimize(JavaThread* thread) {
219 // Schedule deoptimization of an nmethod activation with this frame. 219 // Schedule deoptimization of an nmethod activation with this frame.
220
221 // Store the original pc before an patch (or request to self-deopt)
222 // in the published location of the frame.
223
224 assert(_cb != NULL && _cb->is_nmethod(), "must be"); 220 assert(_cb != NULL && _cb->is_nmethod(), "must be");
225 nmethod* nm = (nmethod*)_cb; 221 nmethod* nm = (nmethod*)_cb;
226 222
227 // This is a fix for register window patching race 223 // This is a fix for register window patching race
228 if (NeedsDeoptSuspend && !thread_is_known_safe) { 224 if (NeedsDeoptSuspend && Thread::current() != thread) {
225 assert(SafepointSynchronize::is_at_safepoint(),
226 "patching other threads for deopt may only occur at a safepoint");
229 227
230 // It is possible especially with DeoptimizeALot/DeoptimizeRandom that 228 // It is possible especially with DeoptimizeALot/DeoptimizeRandom that
231 // we could see the frame again and ask for it to be deoptimized since 229 // we could see the frame again and ask for it to be deoptimized since
232 // it might move for a long time. That is harmless and we just ignore it. 230 // it might move for a long time. That is harmless and we just ignore it.
233 if (id() == thread->must_deopt_id()) { 231 if (id() == thread->must_deopt_id()) {
246 // We could just wait out a thread in native_trans to block. 244 // We could just wait out a thread in native_trans to block.
247 // Then we'd have all the issues that the safepoint code has as to 245 // Then we'd have all the issues that the safepoint code has as to
248 // whether to spin or block. It isn't worth it. Just treat it like 246 // whether to spin or block. It isn't worth it. Just treat it like
249 // native and be done with it. 247 // native and be done with it.
250 // 248 //
251 JavaThreadState state = thread->thread_state(); 249 // Examine the state of the thread at the start of safepoint since
250 // threads that were in native at the start of the safepoint could
251 // come to a halt during the safepoint, changing the current value
252 // of the safepoint_state.
253 JavaThreadState state = thread->safepoint_state()->orig_thread_state();
252 if (state == _thread_in_native || state == _thread_in_native_trans) { 254 if (state == _thread_in_native || state == _thread_in_native_trans) {
253 // Since we are at a safepoint the target thread will stop itself 255 // Since we are at a safepoint the target thread will stop itself
254 // before it can return to java as long as we remain at the safepoint. 256 // before it can return to java as long as we remain at the safepoint.
255 // Therefore we can put an additional request for the thread to stop 257 // Therefore we can put an additional request for the thread to stop
256 // no matter what no (like a suspend). This will cause the thread 258 // no matter what no (like a suspend). This will cause the thread