Skip to content

Commit

Permalink
Merge pull request #16414 from tajila/loom3
Browse files Browse the repository at this point in the history
Fix up potential stale pointer after GC
  • Loading branch information
babsingh committed Dec 5, 2022
2 parents f7bb492 + ef7a4c8 commit 36b6300
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions runtime/j9vm/javanextvmi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ JVM_VirtualThreadMountEnd(JNIEnv *env, jobject thread, jboolean firstMount)
vmFuncs->setHeapOutOfMemoryError(currentThread);
goto release1;
}

/* Re-fetch as the memory allocation above may have moved the object. */
threadObj = J9_JNI_UNWRAP_REFERENCE(thread);

J9VMJAVALANGVIRTUALTHREAD_SET_STATE(currentThread, rootVirtualThread, J9VM_VIRTUALTHREAD_ROOT_NODE_STATE);
}

Expand Down

0 comments on commit 36b6300

Please sign in to comment.