Mercurial > hg > truffle
diff src/share/vm/prims/jvmtiEnvThreadState.cpp @ 17480:1b46c3672650
Merge
author | kizune |
---|---|
date | Fri, 13 Dec 2013 22:13:52 +0400 |
parents | c8c2d6b82499 |
children | de6a9e811145 |
line wrap: on
line diff
--- a/src/share/vm/prims/jvmtiEnvThreadState.cpp Thu Dec 05 00:36:42 2013 -0800 +++ b/src/share/vm/prims/jvmtiEnvThreadState.cpp Fri Dec 13 22:13:52 2013 +0400 @@ -269,11 +269,20 @@ void doit() { ResourceMark rmark; // _thread != Thread::current() RegisterMap rm(_thread, false); - javaVFrame* vf = _thread->last_java_vframe(&rm); - assert(vf != NULL, "must have last java frame"); - Method* method = vf->method(); - _method_id = method->jmethod_id(); - _bci = vf->bci(); + // There can be a race condition between a VM_Operation reaching a safepoint + // and the target thread exiting from Java execution. + // We must recheck the last Java frame still exists. + if (_thread->has_last_Java_frame()) { + javaVFrame* vf = _thread->last_java_vframe(&rm); + assert(vf != NULL, "must have last java frame"); + Method* method = vf->method(); + _method_id = method->jmethod_id(); + _bci = vf->bci(); + } else { + // Clear current location as the target thread has no Java frames anymore. + _method_id = (jmethodID)NULL; + _bci = 0; + } } void get_current_location(jmethodID *method_id, int *bci) { *method_id = _method_id;