Revert "Revert "Prevent races with GC when transferring objects between threads""
This reverts commit e5179ce0ca8becf34ba6e7b2f3988874fe647c26.
Reason for revert: Fixed issues with:
Checkpoint flag set without pending checkpoint in parent CL.
Bug: 67838964
Test: ./test.py --host -j50
Change-Id: I7622f9c18866b58ee3cbd9f4fe38a29b2cf84a88
diff --git a/openjdkjvmti/ti_method.cc b/openjdkjvmti/ti_method.cc
index 5d63285..cf93bf0 100644
--- a/openjdkjvmti/ti_method.cc
+++ b/openjdkjvmti/ti_method.cc
@@ -771,7 +771,7 @@
}
GetLocalVariableClosure c(self, depth, slot, type, val);
// RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
- if (!target->RequestSynchronousCheckpoint(&c)) {
+ if (!ThreadUtil::RequestGCSafeSynchronousCheckpoint(target, &c)) {
return ERR(THREAD_NOT_ALIVE);
} else {
return c.GetResult();
@@ -900,7 +900,7 @@
}
SetLocalVariableClosure c(self, depth, slot, type, val);
// RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
- if (!target->RequestSynchronousCheckpoint(&c)) {
+ if (!ThreadUtil::RequestGCSafeSynchronousCheckpoint(target, &c)) {
return ERR(THREAD_NOT_ALIVE);
} else {
return c.GetResult();
@@ -959,7 +959,7 @@
}
GetLocalInstanceClosure c(self, depth, data);
// RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
- if (!target->RequestSynchronousCheckpoint(&c)) {
+ if (!ThreadUtil::RequestGCSafeSynchronousCheckpoint(target, &c)) {
return ERR(THREAD_NOT_ALIVE);
} else {
return c.GetResult();