eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.29k stars 721 forks source link

JIT does not generate arraytranslate nodes #20658

Open knn-k opened 1 day ago

knn-k commented 1 day ago

JIT compiler generates arraytranslate nodes for char[] to byte[] cases, but I haven't been able to make it generate arraytranslate nodes for byte[] to char[] cases.

I used the following binary on plinux for testing, because JIT codegen for Power has an environment variable that shows verbose output in the arraytranslate evaluator:

$ jdk-17.0.13+11/bin/java -version
openjdk version "17.0.13" 2024-10-15
IBM Semeru Runtime Open Edition 17.0.13.11 (build 17.0.13+11)
Eclipse OpenJ9 VM 17.0.13.11 (build openj9-0.48.0, JRE 17 Linux ppc64le-64-Bit Compressed References 20241015_861 (JIT enabled, AOT enabled)
OpenJ9   - 1d5831436e
OMR      - d10a4d553
JCL      - d17dd58f8d7 based on jdk-17.0.13+11)

See the following output:

[ arraytranslateTRTO: char[] to byte[] ] -- An arraytranslate node was generated

$ TR_verbosePPCTRTOOT=y jdk-17.0.13+11/bin/java -Xjit:limit=arrayTranslateTRTO,count=0,optlevel=scorching ArrayTranslateTRTOTest
JIT: env var TR_verbosePPCTRTOOT is set to y
ArrayTranslateTRTOTest.arrayTranslateTRTO([CI[BII)I @ scorching [isSourceByte: 0] [isOT: 0] [0 && 1 && 0]: arraytranslate
Done

[ arraytranslateTROT: byte[] to char[] ] -- No output from arraytranslate evaluator

$ TR_verbosePPCTRTOOT=y jdk-17.0.13+11/bin/java -Xjit:limit=arrayTranslateTROT,count=0,optlevel=scorching ArrayTranslateTROTTest
Done

Power codegen supports arraytranslateTROT.

This issue is common across platforms, except that AArch64 codegen does not support arraytranslateTROT at the moment. I found this issue when I was trying to add the support on AArch64.

github-actions[bot] commented 1 day ago

Issue Number: 20658 Status: Open Recommended Components: comp:vm, comp:gc, comp:test

knn-k commented 1 day ago

These testcases do not depend on method recognition. ArrayTranslateTests.zip

knn-k commented 1 day ago

I haven't been able to make JIT generate arraytranslateTROTNoBreak nodes, either.

[ arraytranslateTROTNoBreak: byte[] to char[] ] -- No output from arraytranslate evaluator

$ TR_verbosePPCTRTOOT=y jdk-17.0.13+11/bin/java -Xjit:limit=arrayTranslateTROTNB,count=0,optlevel=scorching ArrayTranslateTROTNBTest
Done

ArrayTranslateTROTNBTest.zip