-
Notifications
You must be signed in to change notification settings - Fork 728
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
Prevent inlining of *.runWith methods #18152
Conversation
Related: |
* relies on iterating the O-slots of these methods to find the most recent ScopedValue binding. | ||
* The scoped value binding is the first argument in runWith, and if runWith is compiled, the | ||
* O-slot walker would rely on iterating through the O-slots until an object that is an instance | ||
* of jdk.incubator.concurrent.ScopedValue$Snapshot is found. If we were to allow inlining of |
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.
Should this be an incubator package name here? For JDK21 I imagine it isn't.
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.
It's not in incubator package in JDK21, so I fixed the comment.
runtime/compiler/env/j9method.cpp
Outdated
@@ -3957,6 +3958,18 @@ void TR_ResolvedJ9Method::construct() | |||
{TR::unknownMethod} | |||
}; | |||
|
|||
static X VirtualThreadMethods [] = | |||
{ | |||
{ TR::java_lang_VirtualThread_runWith, 7, "runWith", (int16_t)-1, "*"}, |
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.
Just curious about the whitespace here. I imagine it is for alignment, but since these are the only entries in these tables it is hard to see what they are being aligned with.
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.
Fixed.
Thread.findScopedValueBindings implementation relies on iterating the O-slots of these methods to find the most recent ScopedValue binding. The scoped value binding is the first argument in runWith, and if runWith is compiled, the O-slot walker would rely on iterating through the O-slots until an object that is an instance of jdk.incubator.concurrent.ScopedValue$Snapshot is found. If we were to allow inlining of runWith, this slot walking mechanism would be unreliable, such as when there are more than one runWith calls in the same caller, and iterating through the O-slots and relying on instanceof checks could then yield the wrong bindings. Signed-off-by: Nazim Bhuiyan <[email protected]>
Jenkins test sanity all jdk21 |
Jenkins test sanity plinux jdk21 |
Thread.findScopedValueBindings implementation relies on iterating the O-slots of these methods to find the most recent ScopedValue binding. The scoped value binding is the first argument in runWith, and if runWith is compiled, the O-slot walker would rely on iterating through the O-slots until an object that is an instance of
jdk.incubator.concurrent.ScopedValue$Snapshot is found. If we were to allow inlining of runWith, this slot walking mechanism would be unreliable, such as when there are more than one runWith calls in the same caller, and iterating through the O-slots and relying on instanceof checks could then yield the wrong bindings.