From 7873bf827c45e0c1c528063876cd27ae2b78e13f Mon Sep 17 00:00:00 2001 From: Jack Lu Date: Mon, 20 Mar 2023 21:25:47 -0400 Subject: [PATCH] Forces cache flush before walking Continuation list Signed-off-by: Jack Lu --- runtime/compiler/control/HookedByTheJit.cpp | 1 + runtime/jvmti/jvmtiThread.c | 2 ++ runtime/vm/ContinuationHelpers.cpp | 1 + 3 files changed, 4 insertions(+) diff --git a/runtime/compiler/control/HookedByTheJit.cpp b/runtime/compiler/control/HookedByTheJit.cpp index 3c3232513a0..e6f1859a60f 100644 --- a/runtime/compiler/control/HookedByTheJit.cpp +++ b/runtime/compiler/control/HookedByTheJit.cpp @@ -6694,6 +6694,7 @@ static void jitReleaseCodeStackWalk(OMR_VMThread *omrVMThread, condYieldFromGCFu do { + vm->memoryManagerFunctions->j9gc_flush_nonAllocationCaches_for_walk(vm); jvmtiIterationControl rc = vm->memoryManagerFunctions->j9mm_iterate_all_continuation_objects(vmThread, PORTLIB, 0, jitWalkContinuationCallBack, (void*)condYield); if (JVMTI_ITERATION_ABORT == rc) yieldHappened = true; diff --git a/runtime/jvmti/jvmtiThread.c b/runtime/jvmti/jvmtiThread.c index 765b625c1bc..4e87cb61eb4 100644 --- a/runtime/jvmti/jvmtiThread.c +++ b/runtime/jvmti/jvmtiThread.c @@ -1394,6 +1394,7 @@ jvmtiSuspendAllVirtualThreads(jvmtiEnv *env, /* Walk all virtual threads. */ vmFuncs->acquireExclusiveVMAccess(currentThread); + vm->memoryManagerFunctions->j9gc_flush_nonAllocationCaches_for_walk(vm); vm->memoryManagerFunctions->j9mm_iterate_all_continuation_objects(currentThread, PORTLIB, 0, jvmtiSuspendResumeCallBack, (void*)&data); vmFuncs->releaseExclusiveVMAccess(currentThread); @@ -1450,6 +1451,7 @@ jvmtiResumeAllVirtualThreads(jvmtiEnv *env, /* Walk all virtual threads. */ vmFuncs->acquireExclusiveVMAccess(currentThread); + vm->memoryManagerFunctions->j9gc_flush_nonAllocationCaches_for_walk(vm); vm->memoryManagerFunctions->j9mm_iterate_all_continuation_objects(currentThread, PORTLIB, 0, jvmtiSuspendResumeCallBack, (void*)&data); vmFuncs->releaseExclusiveVMAccess(currentThread); done: diff --git a/runtime/vm/ContinuationHelpers.cpp b/runtime/vm/ContinuationHelpers.cpp index 77db9b03546..65d90c6e5ba 100644 --- a/runtime/vm/ContinuationHelpers.cpp +++ b/runtime/vm/ContinuationHelpers.cpp @@ -372,6 +372,7 @@ walkAllStackFrames(J9VMThread *currentThread, J9StackWalkState *walkState) /* Walk all live continuation stacks using the GC Continuation object iterator */ PORT_ACCESS_FROM_VMC(currentThread); + vm->memoryManagerFunctions->j9gc_flush_nonAllocationCaches_for_walk(vm); vm->memoryManagerFunctions->j9mm_iterate_all_continuation_objects( currentThread, PORTLIB,