Skip to content
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

Add walkReferenceChain JITServer Support #8293

Merged
merged 10 commits into from
Jan 17, 2020

Conversation

harryyu1994
Copy link
Contributor

@harryyu1994 harryyu1994 commented Jan 13, 2020

The purpose of this change is to avoid using object addresses on JITServer. Using object addresses on JITServer creates problems when GC moves the object (thus changing the addresses). Instead, JITServer must use some kind of handle (a GlobalReference or some other GC root) to hold the object so that JITServer always has the valid object addresses when it tries to perform operations on it.

walkReferenceChain() is special in that it needs half of its information from JITServer(TR::Node) and half of its information from JITClient(object address). During the walk, we need vmaccess so that GC doesn't move the object of interest. We can only have vmaccess on JITClient, which means we need to do the walk on JITClient.

This change makes JITServer generate the offset information JITClient needs for the walk and passes to JITClient in the form of a vector.

Originally we have a LocalGCCounter hack where we can detect if the object has been moved to a different location. And when object has been moved, JITClient will abort the compilation. However, this does not work for all gcpolicies and also is not very efficient because JITClient can abort compilations that might not need to be aborted. This change offers a better solution: since the walk is done on JITClient and JITClient has control over vmaccess, object is guaranteed to not be moved during the operation.

I have also noticed a few misuses of globalreference read and vmaccess and have corrected them. We must have vmaccess before we perform a read.

Issue: #8109

Signed-off-by: Harry Yu harryyu1994@gmail.com

@harryyu1994 harryyu1994 changed the title Add walkReferenceChain JITServer Support WIP: Add walkReferenceChain JITServer Support Jan 13, 2020
@harryyu1994 harryyu1994 force-pushed the walkReferenceChain branch 8 times, most recently from 38f42ae to 6f373ca Compare January 13, 2020 23:59
The purpose of this change is to avoid using object addresses on JITServer.
Using object addresses on JITServer creates problems when GC changes the object addresses. Instead, JITServer must use some kind of handle (a GlobalReference or some other GC root) to hold the object so that JITServer always has the valid object addresses.

walkReferenceChain is special in that it needs half of its information from the JITServer(TR::Node) and half of its information from JITClient(object address). During the walk, we need vmaccess so that GC doesn't move the object of interest. We can only have vmaccess on JITClient, which means we need to do walkReferenceChain on JITClient.

This change makes JITServer to generate the offsets information JITClient needed for the walk and passes to JITClient in the form of a vector.

Issue: eclipse-openj9#8109

Signed-off-by: Harry Yu <harryyu1994@gmail.com>
After JITClient receives the globalreference from JITServer, we need to obtain vmaccess before we dereference it.

Signed-off-by: Harry Yu <harryyu1994@gmail.com>
There are 4 instances where JITServer incorrectly uses the walkReferenceChain routine. Update them to the new implementation.

Signed-off-by: Harry Yu <harryyu1994@gmail.com>
This messageType has been eliminated by the JITServer walkReferenceChain routine.

Signed-off-by: Harry Yu <harryyu1994@gmail.com>
Now that walkReferenceChain is handled properly on JITServer and JITClient, the LocalGCCOunter hack, which does not cover all cases and not an efficient workaround, should be removed.

Signed-off-by: Harry Yu <harryyu1994@gmail.com>
Signed-off-by: Harry Yu <harryyu1994@gmail.com>
@harryyu1994 harryyu1994 changed the title WIP: Add walkReferenceChain JITServer Support Add walkReferenceChain JITServer Support Jan 14, 2020
@mpirvu mpirvu added the comp:jitserver Artifacts related to JIT-as-a-Service project label Jan 14, 2020
@mpirvu
Copy link
Contributor

mpirvu commented Jan 14, 2020

A generic remark: now that we've 'released` a version of JITServer, any change to the communication protocol including adding/removing of messages or APIs needs to increment the version number

Signed-off-by: Harry Yu <harryyu1994@gmail.com>
@harryyu1994
Copy link
Contributor Author

Incremented MINOR_NUMBER from 1 to 2.

@harryyu1994
Copy link
Contributor Author

Added another change to handle 3 invokeFilterArgumentsWithCombinerHandle methods, they appeared to be without JITServer support. The latest commit can be reviewed separately. I put it in the same PR because 1. they both modify the same set of files 2. both are related to JSR292 3. both added new messageTypes so it's convenient to have them in the same PR.

@harryyu1994 harryyu1994 force-pushed the walkReferenceChain branch 2 times, most recently from fed1f06 to b20baef Compare January 14, 2020 21:01
This change handles the following 3 methods for JITServer:
1. java_lang_invoke_FilterArgumentsWithCombinerHandle_numSuffixArgs
2. java_lang_invoke_FilterArgumentsWithCombinerHandle_filterPosition
3. java_lang_invoke_FilterArgumentsWithCombinerHandle_argumentIndices

Signed-off-by: Harry Yu <harryyu1994@gmail.com>
Copy link
Contributor

@mpirvu mpirvu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I have only small suggestions here and there.

runtime/compiler/control/JITClientCompilationThread.cpp Outdated Show resolved Hide resolved
runtime/compiler/env/j9method.cpp Outdated Show resolved Hide resolved
runtime/compiler/control/JITServerHelpers.cpp Outdated Show resolved Hide resolved
runtime/compiler/control/JITServerHelpers.cpp Outdated Show resolved Hide resolved
runtime/compiler/env/j9method.cpp Show resolved Hide resolved
runtime/compiler/control/JITClientCompilationThread.cpp Outdated Show resolved Hide resolved
runtime/compiler/control/JITClientCompilationThread.cpp Outdated Show resolved Hide resolved
runtime/compiler/control/JITClientCompilationThread.cpp Outdated Show resolved Hide resolved
@mpirvu mpirvu self-assigned this Jan 16, 2020
Signed-off-by: Harry Yu <harryyu1994@gmail.com>
Signed-off-by: Harry Yu <harryyu1994@gmail.com>
Copy link
Contributor

@mpirvu mpirvu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mpirvu
Copy link
Contributor

mpirvu commented Jan 16, 2020

Jenkins test sanity xlinuxjit jdk11

1 similar comment
@mpirvu
Copy link
Contributor

mpirvu commented Jan 16, 2020

Jenkins test sanity xlinuxjit jdk11

@mpirvu
Copy link
Contributor

mpirvu commented Jan 17, 2020

Jenkins test sanity plinuxjit jdk11

@mpirvu
Copy link
Contributor

mpirvu commented Jan 17, 2020

All tests have passed, hence merging.

@mpirvu mpirvu merged commit 3ab4200 into eclipse-openj9:master Jan 17, 2020
@harryyu1994 harryyu1994 deleted the walkReferenceChain branch January 17, 2020 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:jitserver Artifacts related to JIT-as-a-Service project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants