-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[GR-41851] Support thread sleep as a mirror event in JDK 19 #5214
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
Closed
roberttoyonaga
wants to merge
5
commits into
oracle:master
from
roberttoyonaga:jdk91-threadsleep-bug
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
aadf983
support thread sleep as a mirror event in jdk 19
roberttoyonaga 56ed80e
checkstyle and format
roberttoyonaga 9aadf86
dont bother removing type id since we use our own custom map
roberttoyonaga 75534b5
substitute setEnabled to propagate flag changes
roberttoyonaga bb1ae55
fix substitution to pass unittests
roberttoyonaga File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does that really work reliably? If I understand everything correctly, then the following is happening:
jdk.jfr.events.ThreadSleepEventas the mirror event.jdk.internal.event.ThreadSleepEventas the thread sleep event. This creates aPlatformEventTypeobject at build time that ends up in the image heap (instance A).PlatformEventTypeobject for the SVM-internal classcom.oracle.svm.core.jfr.events.ThreadSleepEventat build time (instance B). This new object reuses the event id of instance A but otherwise behaves like a VM-internal event (e.g.,SubstrateJVM.eventSettingsis used to determine if the event is enabled or disabled).SubstrateJVM.handleMirrorEvents()).I see the following issues:
jdk.internal.event.ThreadSleepEvent? I don't think that the updated value will be used because JDK events directly store in theirPlatformEventTypeobject if the event is enabled. However, we would accessSubstrateJVM.eventSettingsto determine if the event is enabled.Uh oh!
There was an error while loading. Please reload this page.
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.
Thank you for the review Christian! Yes that is what I was doing. I was under the impression that built in events were enabled by default. I have removed that unconditional enablement and instead substituted
PlatformEventType.setEnabled(boolean). This way changes can be propagated to theSubstrateJVM.eventSettingsif the event happens to be one of the supported mirror event types. Please let me know if this is an acceptable solution.I think the thread sleep event was moved from hotspot native code to java code to be able to emit the events for virtual threads as well.