mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
8028126: nsk/jvmti/scenarios/hotswap/HS101/hs101t006 Crashed the vm on Solaris-sparc64 fastdebug builds: only current thread can flush its registers
Fix a race between VMOp_GetCurrentLocation reaching a safepoint and arget thread exiting from Java execution Reviewed-by: sla, dholmes, dsamersoff
This commit is contained in:
parent
b5f2f33aaa
commit
e820946a1e
1 changed files with 14 additions and 5 deletions
|
@ -269,11 +269,20 @@ class VM_GetCurrentLocation : public VM_Operation {
|
||||||
void doit() {
|
void doit() {
|
||||||
ResourceMark rmark; // _thread != Thread::current()
|
ResourceMark rmark; // _thread != Thread::current()
|
||||||
RegisterMap rm(_thread, false);
|
RegisterMap rm(_thread, false);
|
||||||
javaVFrame* vf = _thread->last_java_vframe(&rm);
|
// There can be a race condition between a VM_Operation reaching a safepoint
|
||||||
assert(vf != NULL, "must have last java frame");
|
// and the target thread exiting from Java execution.
|
||||||
Method* method = vf->method();
|
// We must recheck the last Java frame still exists.
|
||||||
_method_id = method->jmethod_id();
|
if (_thread->has_last_Java_frame()) {
|
||||||
_bci = vf->bci();
|
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) {
|
void get_current_location(jmethodID *method_id, int *bci) {
|
||||||
*method_id = _method_id;
|
*method_id = _method_id;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue