-
Notifications
You must be signed in to change notification settings - Fork 722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loom: JVMTI support #15183
Comments
Task 1: Handle error casesExamples:
|
@tajila Will
|
yes |
Return JVMTI_ERROR_UNSUPPORTED_OPERATION from JVMTI functions that do not accept virtual threads as their current thread or parameters. Issue: eclipse-openj9#15183 Signed-off-by: Eric Yang <eric.yang@ibm.com>
Is there a priority for functions to update or should I just go down the list in the spec? |
Looking at the first three thread functions, do they need to be updated?
|
re #15183 (comment):
We can also use the JVMTI tests in the extensions repo to verify our functionality. These tests have been updated for Project Loom.
Other Project Loom related JVMTI tests: https://github.com/ibmruntimes/openj9-openjdk-jdk19/tree/openj9/test/hotspot/jtreg/serviceability/jvmti/thread |
How will we implement Get/SetThreadLocalStorage for virtual threads? The tls for platform threads is attached to omr thread. |
It can be moved as a hidden field into
We will also need to account for the initialization and destruction of the native structures associated to this hidden field. @tajila @gacholio Can you provide feedback on the above approach? |
At a glance, no, this is not correct. Our TLS is effectively useless in the presence of vthreads, so we will simply have to stop using it in many places. Correct answer here is probably to add a hidden field to Thread to contain the JVMTI data itself, not some fake TLS implementation. |
Will JVMTI data be a struct as follows?
|
To avoid searching a list, we could essentially reimplement TLS - store a fixed-size array in the Thread hidden field, and manage the keys ourselves. This will mean freeing the TLS when the Thread is collected (which may be a pain). |
Currently the TLS data struct gets allocated for each existing os thread when a jvmti env is allocated ( Also note the TLS only has to exist while the thread is alive (JVMTI_ERROR_THREAD_NOT_ALIVE) |
|
The VirtualThread natives are needed to keep a list of every live virtual thread for JVM TI. Since JVM TI agents can be attached at any time, enable these natives by default. Issue: eclipse-openj9/openj9#15183 Signed-off-by: Eric Yang <eric.yang@ibm.com>
Traverse the thread list before acquireExclusiveVMAccess and after releaseExclusiveVMAccess to ensure virtual thread transition completion. Update live thread check for virtual thread Update surrounding code style Issues: eclipse-openj9#15759 eclipse-openj9#15183 Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
Adds virtual thread support for GetOrSetLocal and NotifyFramePop As walkState->walkThread will be used by some jit functions after stackwalk, we can't use walkContinuationStackFrames which will cause dangling pointer. Instead we need to stack-allocate manually if a J9VMContinuation needs to be walked, so we created a helper getJ9VMContinuationToWalk to get the J9VMContinuation. Also fix coding style of surrounding code Issues: eclipse-openj9#15759 eclipse-openj9#15183 Co-authored-by: Babneet Singh <sbabneet@ca.ibm.com> Signed-off-by: Gengchen Tuo <gengchen.tuo@ibm.com>
targetThread is NULL only for virtual threads, as per the assertion in getVMThread, when mustBeAlive is TRUE. vmThreadForTLS is only used to acquire J9JavaVM in createThreadData and jvmtiTLSGet. If targetThread is NULL, currentThread is passed to createThreadData and jvmtiTLSGet for retrieving J9JavaVM in JDK19+. Related: eclipse-openj9#15541 Related: eclipse-openj9#15183 Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
targetThread is NULL only for virtual threads, as per the assertion in getVMThread, when mustBeAlive is TRUE. vmThreadForTLS is only used to acquire J9JavaVM in createThreadData and jvmtiTLSGet. If targetThread is NULL, currentThread is passed to createThreadData and jvmtiTLSGet for retrieving J9JavaVM in JDK19+. Related: eclipse-openj9#15541 Related: eclipse-openj9#15183 Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Depends on #15177
JVMTI
See https://download.java.net/java/early_access/jdk19/docs/specs/jvmti.html
The text was updated successfully, but these errors were encountered: