RFR: 8296243: [IR Framework] Fix issues with IRNode.ALLOC* regexes

Christian Hagedorn chagedorn at openjdk.org
Tue Nov 8 10:10:37 UTC 2022


There are currently two problems with `IRNode.ALLOC*` regexes:
1. On PPC64, we do not account for an `LI` instruction which matches the array size. As a result, we could miss some array allocations with the `ALLOC_ARRAY*` regexes:

2e4     LD      R3, offset, R3   // load ptr precise [java/lang/Object:
0x0000200058006e40 *: :Constant:exact * from TOC (lo)
2e8     STD     R17, [R1_SP + #104+0]    // spill copy
2ec     LI      R4, #1    <------- we only look for LGHI here which is specific to s390 while LI is used for PPC64
2f0     CALL,static 0x00002000177cd300   // ==>  wrapper for: _new_array_Java

This was revealed by a new test added by [JDK-8280378](https://bugs.openjdk.org/browse/JDK-8280378) but was already a problem before this change.

2. The newly added `IRNode.ALLOC*` regexes in JDK-8280378 which can be matched on the independent ideal compile phases by using the name of the IR node "Allocate" also matches "AllocateArray" (substring match). This is unexpected. I've changed this by matching "Allocate" exactly.

I've additionally removed the matching of `LI` and `LGHI` for the `ALLOC` regexes on normal objects as we do not have an array size. I think it's safe to remove these (might need some additional testing on PPC64/s390).

Thanks @TheRealMDoerr for helping to test the initial fix on PPC64!

Thanks,
Christian

-------------

Commit messages:
 - 8296243: [IR Framework] IRNode.ALLOC_ARRAY* PrintOptoAssembly regex does not work properly for PPC64

Changes: https://git.openjdk.org/jdk/pull/11037/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11037&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8296243
  Stats: 22 lines in 2 files changed: 12 ins; 2 del; 8 mod
  Patch: https://git.openjdk.org/jdk/pull/11037.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11037/head:pull/11037

PR: https://git.openjdk.org/jdk/pull/11037


More information about the hotspot-compiler-dev mailing list