openj9 icon indicating copy to clipboard operation
openj9 copied to clipboard

Add support for jitDispatchJ9Method for MH on P

Open matthewhall2 opened this issue 2 months ago • 4 comments

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

depends on https://github.com/eclipse-omr/omr/pull/8074

matthewhall2 avatar Nov 13 '25 20:11 matthewhall2

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

matthewhall2 avatar Nov 13 '25 20:11 matthewhall2

will do, after i return from vacation next Wed.

zl-wang avatar Nov 13 '25 20:11 zl-wang

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 avatar Nov 19 '25 20:11 zl-wang

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.

zl-wang avatar Nov 24 '25 15:11 zl-wang