-
Notifications
You must be signed in to change notification settings - Fork 754
Add Fences after Volatile Field Stores #11262
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
Conversation
FYI @fjeremic , |
Marking it as WIP as eclipse-omr/omr#5689 needs to be merged before this. |
Removing WIP, OMR changes has been propagated. We can launch test on the changes. |
@fjeremic Can we launch tests on this change ? |
Jenkins test sanity.functional,extended.functional,sanity.system,extended.system,special.system,sanity.openjdk zlinux,zlinuxxl jdk8 |
Testing looks good. I should remit myself as the committer for this one as I had a part in coding this change. @joransiu off to you! |
Can one of the admins verify this patch? |
This change is still relevant. I will clean up and resolve merge conflicts to get this merged. |
e24235f
to
d09fb88
Compare
@joransiu I have fixed merge conflicts for this test and also ran the sanity tests on it. Can you review and merge this changes? |
jenkins test sanity zlinux jdk17,jdk8 |
@joransiu While talking to Spencer about unsafe get and set volatile methods, I remember this pending PR opened up some time ago, Can I request you to review this change? I have done sanity tests on this PR they are fine. |
Thanks @r30shah. Changes LGTM. I'm going to grab a PR test driver, and do some explicit |
@r30shah : While reviewing some of the tree evaluations, I noticed that in the event of an awrtbari, the fence NOP is placed after the writebar code. The wrtbar code may actually call jitWriteBarrierStoreGenerational and incur significant pathlength before the fence is issued. Is that what we want?
|
@joransiu Looking at the code, You are right, fence / serialization should happen after we store the object followed by the code for write barrier. I have made changes in https://github.com/eclipse-openj9/openj9/compare/2418be7df0e0613a0011339c5f59d22ca9ce069d..2a40088f00753716ebb5012b5b1c1d7f67cd4f75 I have converted this to WIP - Tomorrow will run tests and also try unit test to verify functionality with awrtbari. |
We override the various store evaluators in OpenJ9 and emit a fence following volatile stores to adhere to the Java Memory Model. This is necessary for functional correctness. There are two cases to handle: 1. Field is resolved 2. Field is unresolved For 1. the implementation is trivial in that we simply emit the fence after the store evaluator has emitted the necessary instructions to evaluate the store node. For 2. the implementation is more complicated. We do not know at compile time whether the field in question is volatile or not. To combat this we emit a NOP placeholder and in the runtime resolution logic we call a VM helper to determine whether the resolved field is volatile or not. If we determine the field is volatile we overwrite the NOP in the mainline instruction stream with a fence. Co-authored-by: Filip Jeremic <[email protected]> Co-authored-by: Rahil Shah <[email protected]>
@joransiu Thanks for catching the scenario under awrtbari. I have verified under unit test change in https://github.com/eclipse-openj9/openj9/compare/2a40088f00753716ebb5012b5b1c1d7f67cd4f75..56714e2310720269cac599b5426a9c54153dd6b0 and also trying to get internal builds (Some infrastructure issue is prohibiting me in getting the build to go on). If you are OK with the change, I would go ahead and try to get testing on OpenJ9 jenkins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jenkins test sanity zlinux jdk17,jdk8 |
@joransiu all the test has passed with this PR. This one is good to merge. |
This commits ports changes to add Fences after volatile field stores which was committed to snapshot repository with additional changes to fix the compilation failures reported by assembler on z/OS.
Signed-off-by: Rahil Shah [email protected]