RFR: 8337660: C2: basic blocks with only BoxLock nodes are wrongly treated as empty
Quan Anh Mai
qamai at openjdk.org
Mon Nov 18 13:08:44 UTC 2024
On Tue, 12 Nov 2024 12:37:21 GMT, Roberto Castañeda Lozano <rcastanedalo at openjdk.org> wrote:
> 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-833766
0)).
>
> #### Testing
>
> - tier1-5 (windows-x64, linux-x64, linux-aarch64, macosx-x64, macosx-aarch64; release and debug mode)
Marked as reviewed by qamai (Committer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/22038#pullrequestreview-2442568149
More information about the hotspot-compiler-dev
mailing list