Skip to content

Conversation

@matthewhall2
Copy link
Contributor

Enables transformation of invokeBasic, linkToStatic, and linkToSpecial calls into jitDispatchJ9Method acall nodes. Codegen recognizes this node in private linakge and produces code to directly call the MethodHandle target at runtime
- using a new PPCJ9HelperCall snippet when the target is interpreted
- otherwise branch and link to jit start pc of target

@matthewhall2
Copy link
Contributor Author

matthewhall2 commented Nov 13, 2025

@zl-wang can I get a review on this please? This is what we discussed with @IBMJimmyk last week

@zl-wang
Copy link
Contributor

zl-wang commented Nov 13, 2025

will do, after i return from vacation next Wed.

@zl-wang
Copy link
Contributor

zl-wang commented Nov 19, 2025

High-level comments:

  1. HelperCallSnippet seemed being used for disjoint purposes across platforms and in OMR side as well. this use (new file) in OpenJ9 PPC codegen looked more aligned with OMR side of story. Please consider how to make it more readable/understandable and less confusing for future newcomers! I was thinking: could we do away without this new file and integrating MH invoke support in existing files (anyway)? or, naming the new file for its specific purpose (MH invocation support)?
  2. rightToLeft or leftToRight argument ordering should be still applicable to the invocation by and large, instead of disabling it as you wrote it, although i understood this thing has never been used in reality to begin with. You only need to special-case the first argument (j9method? if I remembered correctly). The shifted argument list should be identical to a normal java method dispatch in IL representation ... so, the disabling is unexpected at high level.

I will review the details when i get around.

@zl-wang
Copy link
Contributor

zl-wang commented Nov 24, 2025

still somewhat at a high level:
There were J9 helperCallSnippet customization examples already for certain special purposes in files: runtime/compiler/p/codegen/J9PPCSnippet.[ch]pp

I don't see why you cannot add this case there. i supposed you either didn't notice their existence or saw some advantages of creating new file for it.

}

if (linkageProperties.getRightToLeft())
bool rightToLeft = linkageProperties.getRightToLeft() && !isJitDispatchJ9Method;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is just happening to be right in getting rightToLeft from this symbol's linkage properties. this symbol is a helper symbol, but what you are doing is actually for a java method dispatch. in reality, helpers are right to left; java method dispatch is left to right (always). in current implementation, helper linkage happens to be an extension to the private linkage. things are set up wrong there, but it happens to be correct for this case (helper dispatch just assumed right to left).

a profuse comment here should be useful for any future readers.

Enables transformation of invokeBasic, linkToStatic, and linkToSpecial
calls into jitDispatchJ9Method acall nodes. Codegen recognizes this node
in private linakge and produces code to directly call the MethodHandle
target at runtime
    - using a new PPCJ9HelperCall snippet when the target is interpreted
    - otherwise branch and link to jit start pc of target

Signed-off-by: Matthew Hall <matthew.hall3@outlook.com>
@matthewhall2 matthewhall2 force-pushed the dispatchJ9Method_MH_P branch from d6662b9 to 6756fef Compare December 2, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants