RFR: 8263227: C2: inconsistent spilling due to dead nodes in exception block

Roberto Castañeda Lozano rcastanedalo at openjdk.java.net
Thu Apr 8 10:49:22 UTC 2021


On Tue, 6 Apr 2021 17:54:20 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> This change eliminates dead multi-nodes created by call-catch cleanup after GCM. Eliminating all dead code created by call-catch cleanup avoids potential issues when splitting the live range of call result values, see the analysis in the [bug report](https://bugs.openjdk.java.net/browse/JDK-8263227) for details. This solution is the least invasive of the three alternatives proposed in the bug report (the other two are constraining global code motion and extending live-range splitting).
>> 
>> The change also extends the control-flow graph verification pass to catch similar live-range splitting issues earlier (with `+VerifyRegisterAllocator`).
>> 
>> Tested on:
>> - original bug reproducer
>> - hs-tier1-5 (windows-x64, linux-x64, linux-aarch64, and macosx-x64) with `+VerifyRegisterAllocator`
>> - hs-tier1-3 (windows-x64, linux-x64, linux-aarch64, and macosx-x64) with `+VerifyRegisterAllocator` and `+StressGCM` (5 repetitions)
>
> src/hotspot/share/opto/lcm.cpp line 1415:
> 
>> 1413:       if (dead) {
>> 1414:         // Remove projections if n is a dead multi-node.
>> 1415:         for (uint k = j + n->outcnt(); sb->get_node(k)->is_Proj(); k--) {
> 
> I don't get this logic. The loop is not executed if sb->get_node(j + n->outcnt()) is not Proj node.

Thanks for reviewing, Vladimir! The intention of this loop is to remove all projections of a multi-node `n` before removing `n` itself (if it has been found to be dead). I indeed have to rethink this code as e.g. the loop can be executed if `n` is not a multi-node but `k` ends up pointing to a projection of another node. I will investigate and come back with a new revision.

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

PR: https://git.openjdk.java.net/jdk/pull/3303


More information about the hotspot-compiler-dev mailing list