-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8354523: runtime/Monitor/SyncOnValueBasedClassTest.java triggers SIGSEGV #24660
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
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back rkennke! A progress list of the required criteria for merging this PR into |
@rkennke This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 67 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
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.
This seems fine.
I see pros with both approaches. If we go with this one I think MacroAssembler::lightweight_lock should document that it expects the BasicLock is cleared with UseObjectMonitorTable.
Moving it into the DiagnoseSyncOnValueBasedClasses != 0
condition keeps MacroAssembler::lightweight_lock a bit more contained. But the comment about clearing just being about the fast path is not correct anymore. As we also read the value in the slow path.
Either way we should probably make sure the comments are up to date with what we exprect.
I wonder if it would be better to zero the cache in InterpreterRuntime::monitorenter and have a C1 entry rather than going directly to monitor_enter_helper. Then we can zero the BasicLock::monitor_cache in the two places where it shouldn't be set. |
Sounds like a bug that it is currently missing? Ah, seems like Value-based Classes are not allowed to use |
Yes, there is also a C1 entry where we could do that. It's in Runtime1::monitorenter() in c1_Runtime.cpp. |
I pushed a change that clears the cache in the C1 and interpreter entries. It's certainly the simplest solution but kinda itches the perfectionist in me: we still need to clear the cache in the fast-paths anyway, so we may as well do it before DiagnoseSyncOnValueBasedClasses-block? |
I now also pushed a version that inlines DiagnoseSyncOnValueBasedClasses handling into MA::lightweight_lock(). Check the 3 different webrevs for comparison. I kinda like that last version the most so far. |
You mean if it would hurt doing the check also in the native wrapper, right? It would not hurt, I'd say. It would be just as redundant as on the other code paths entering a synchronized method where it wasn't worth the effort making the distinction between monitorenter / entering a synchronized method. |
Oh yeah that's right, it's only nice if we don't have to do it from the platform dependent code any more. |
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.
I do like this version the best. The redundancy will go away when Legacy goes away. I'll approve when you do the other platforms. Edit: not redundancy, that wasn't the right word, but extra places where we check.
I added the aarch64 implementation. I cannot really do any of the other platforms, but if somebody else provides the parts I'll be happy to add them. |
PPC64 parts: TheRealMDoerr@084ce34 |
/contributor add @TheRealMDoerr |
@rkennke |
@rkennke : Thanks for the ping! And here is the fix for riscv platform: |
/contributor add @RealFYang |
Thanks, I integrated it! |
@rkennke |
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.
This looks good. The s390 could go in as a new patch, or with this when it's done. It seems pretty simple, could almost do it yourself if Amit is unavailable to push it.
When DiagnoseSyncOnValueBasedClasses is != 0, then we can take the slow-path without having cleared the monitor cache in the BasicLock. This would later lead to a crash or other unexpected behaviour. This can happen with C1 or the interpreter, C2 has the DiagnoseSyncOnValueBasedClasses-block after clearing the cache, and the native-entry in sharedRuntime_x86_64.cpp does not have a DiagnoseSyncOnValueBasedClasses-block at all.
The proposed fix so far is a bit ugly because it repeats the clearing code in 3 places. The alternative would be to move the DiagnoseSyncOnValueBasedClasses-block into MA::lightweight_lock(), but this would bring DiagnoseSyncOnValueBasedClasses-handling into the native entry in sharedRuntime_x86_64.cpp, which is currently not the case. Also, we don't have enough regs for that, but we can probably use rscratch1 now that 32-bit is gone (as is already done in C1 and interpreter paths anyway).
I'd first settle on the structure, and then implement the same thing for aarch64.
ping @xmas92
Progress
Issue
Reviewers
Contributors
<[email protected]>
<[email protected]>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24660/head:pull/24660
$ git checkout pull/24660
Update a local copy of the PR:
$ git checkout pull/24660
$ git pull https://git.openjdk.org/jdk.git pull/24660/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24660
View PR using the GUI difftool:
$ git pr show -t 24660
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24660.diff
Using Webrev
Link to Webrev Comment