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_stack.cc b/openjdkjvmti/ti_stack.cc
index e346e16..b43eaa0 100644
--- a/openjdkjvmti/ti_stack.cc
+++ b/openjdkjvmti/ti_stack.cc
@@ -257,7 +257,7 @@
static_cast<size_t>(start_depth),
static_cast<size_t>(max_frame_count));
// RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
- if (!thread->RequestSynchronousCheckpoint(&closure)) {
+ if (!ThreadUtil::RequestGCSafeSynchronousCheckpoint(thread, &closure)) {
return ERR(THREAD_NOT_ALIVE);
}
*count_ptr = static_cast<jint>(closure.index);
@@ -268,7 +268,7 @@
} else {
GetStackTraceVectorClosure closure(0, 0);
// RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
- if (!thread->RequestSynchronousCheckpoint(&closure)) {
+ if (!ThreadUtil::RequestGCSafeSynchronousCheckpoint(thread, &closure)) {
return ERR(THREAD_NOT_ALIVE);
}
@@ -712,7 +712,7 @@
GetFrameCountClosure closure;
// RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
- if (!thread->RequestSynchronousCheckpoint(&closure)) {
+ if (!ThreadUtil::RequestGCSafeSynchronousCheckpoint(thread, &closure)) {
return ERR(THREAD_NOT_ALIVE);
}
@@ -802,7 +802,7 @@
GetLocationClosure closure(static_cast<size_t>(depth));
// RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
- if (!thread->RequestSynchronousCheckpoint(&closure)) {
+ if (!ThreadUtil::RequestGCSafeSynchronousCheckpoint(thread, &closure)) {
return ERR(THREAD_NOT_ALIVE);
}
@@ -923,7 +923,7 @@
if (target != self) {
called_method = true;
// RequestSynchronousCheckpoint releases the thread_list_lock_ as a part of its execution.
- if (!target->RequestSynchronousCheckpoint(&closure)) {
+ if (!ThreadUtil::RequestGCSafeSynchronousCheckpoint(target, &closure)) {
return ERR(THREAD_NOT_ALIVE);
}
} else {