openj9 icon indicating copy to clipboard operation
openj9 copied to clipboard

Fold calls to Invokers.checkVarHandleGenericType into its result

Open nbhuiyan opened this issue 6 months ago • 7 comments

When the VarHandle object and the AccessDescriptor objects are known, we can perform a compile-time lookup of the corresponding entry in the VarHandle's MethodHandle table. This commit enables such a transformation through the following:

  • Add recognized fields from which the MethodHandle table gets loaded, accounting for the differences different JDK versions
  • Add checkVarHandleGenericType to the list of non-inlinable methods
  • Add new function in MethodHandleTransformer to be triggered when visiting checkVarHandleGenericType call node that generates the trees and transforms the call node.

Furthermore, visitStoreToLocalVariable can now be triggered for cases of direct stores of nodes anchored by PassThrough nodes, which would result from calls that have been transformed into PassThrough. PassThrough nodes do not have type info, and therefore this has to be accounted for. Once inside visitStoreToLocalVariable, it would have to recognize cases of stores of child nodes of PassThrough, and set the actual node to use as the RHS of the store.

nbhuiyan avatar May 30 '25 22:05 nbhuiyan

@jdmpapin I'd appreciate your review of this.

@vijaysun-omr FYI, this will improve performance in VarHandle and MemorySegment-heavy workloads.

nbhuiyan avatar May 30 '25 22:05 nbhuiyan

@jdmpapin I have addressed your review comments. Requesting another review.

nbhuiyan avatar Jun 05 '25 16:06 nbhuiyan

~Jenkins build sanity all jdk17,jdk21~

jdmpapin avatar Jun 05 '25 19:06 jdmpapin

Jenkins test sanity all jdk17,jdk21

jdmpapin avatar Jun 05 '25 19:06 jdmpapin

Jenkins test sanity.openjdk zlinux jdk21

jdmpapin avatar Jun 06 '25 14:06 jdmpapin

Jenkins test sanity xlinuxjit,plinuxjit,zlinuxjit jdk17,jdk21

jdmpapin avatar Jun 06 '25 14:06 jdmpapin

The JITServer sanity.openjdk failures are #20995 (and timeouts in the same vector tests, which I'm guessing are probably caused by the same underlying problem)

The other failure is #17270

So the checks are OK, but now there is a merge conflict

jdmpapin avatar Jun 12 '25 19:06 jdmpapin

@jdmpapin The merge conflict is now resolved.

nbhuiyan avatar Jul 07 '25 14:07 nbhuiyan

Running some minimal additional testing since the previous checks were done a month ago

Jenkins test sanity xlinux jdk17

jdmpapin avatar Jul 07 '25 15:07 jdmpapin