-
Notifications
You must be signed in to change notification settings - Fork 722
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
Force inline AbstractMemorySegmentImpl.reinterpret for getCallerClass optimization #20471
Conversation
@@ -366,6 +366,9 @@ TR_J9InlinerPolicy::alwaysWorthInlining(TR_ResolvedMethod * calleeMethod, TR::No | |||
case TR::java_lang_Class_newInstance: | |||
case TR::jdk_internal_util_Preconditions_checkIndex: | |||
|
|||
// AbstractMemorySegmentImpl.reinterpret methods call Reflection.getCallerClass | |||
case TR::jdk_internal_foreign_AbstractMemorySegmentImpl_reinterpret: |
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 this only need to be done for JDK22+? If so, this case should be guarded with a JDK level check.
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.
Actually, I don't think we usually add conditional compilation for methods that exist in some versions of the Java Class Libraries but not others. Unless there's really a difference in the behaviour for different versions — as opposed to a difference in whether it exists — I don't think this needs to be conditionally compiled in or out.
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.
That was the reasoning behind my question: whether there was a difference in behaviour between 21 and 22+ and if you only need to affect behaviour this way for JDK22+. If the answer is no (and I just now compared the code myself and see that they are largely similar) then guarding it for a JDK level is not necessary.
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.
@0xdaryl I misunderstood your question and added the guard. I have now removed that change.
Signed-off-by: Nazim Bhuiyan <[email protected]>
AbstractMemorySegmentImpl.reinterpret methods contain calls to Reflection.getCallerClass. Optimization of getCallerClass requires the caller to be inlined. Otherwise, we would end up using the JNI helper which performs a very expensive stackwalk to obtain the caller class. Signed-off-by: Nazim Bhuiyan <[email protected]>
b579ed9
to
2280db2
Compare
Jenkins test sanity all jdk21 |
AbstractMemorySegmentImpl.reinterpret methods contain calls to
Reflection.getCallerClass. Optimization of getCallerClass requires
the caller to be inlined. Otherwise, we would end up using the
JNI helper which performs a very expensive stackwalk to obtain
the caller class.
Issue: #20270