RFR: 8337660: C2: basic blocks with only BoxLock nodes are wrongly treated as empty
Roberto Castañeda Lozano
rcastanedalo at openjdk.org
Tue Nov 12 13:37:16 UTC 2024
This changeset takes into account the presence of `BoxLock` nodes in a basic block when determining whether the block is empty and [can be removed](https://github.com/openjdk/jdk/blob/5729227651969f542f040e5d0bfbf9b0b99b5698/src/hotspot/share/opto/compile.cpp#L2997). Special treatment of `BoxLock` nodes is required because these are not Mach nodes, yet they [are preserved in C2's back-end](https://github.com/openjdk/jdk/blob/f0b251d76078e8d5b47e967b0449c4cbdcb5a005/src/hotspot/share/opto/matcher.cpp#L2278) and result in [actual machine code being generated](https://github.com/openjdk/jdk/blob/f0b251d76078e8d5b47e967b0449c4cbdcb5a005/src/hotspot/cpu/x86/x86_64.ad#L1544). The proposed change avoids wrongly removing basic blocks consisting only of `BoxLock` and other non-Mach nodes, and crashing when the register that should have been defined by the wrongly removed `BoxLock` node is used (see complete failure analysis in the [JBS description](https://bugs.openjdk.org/browse/JDK-8337660)
).
#### Testing
- tier1-5 (windows-x64, linux-x64, linux-aarch64, macosx-x64, macosx-aarch64; release and debug mode)
-------------
Commit messages:
- Take into account BoxLock nodes when determining if a block is empty
Changes: https://git.openjdk.org/jdk/pull/22038/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22038&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8337660
Stats: 93 lines in 2 files changed: 88 ins; 0 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/22038.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/22038/head:pull/22038
PR: https://git.openjdk.org/jdk/pull/22038
More information about the hotspot-compiler-dev
mailing list