RFR: 8317507: C2 compilation fails with "Exceeded _node_regs array" [v2]

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Wed Oct 25 14:20:00 UTC 2023


> This changeset avoids incrementing the global node index counter (`Compile::_unique`) when creating a CISC version node that replaces and reuses the index of the original node. This prevents out-of-bounds accesses to `PhaseRegAlloc::_node_regs` in programs with a high-density of CISC spill candidate nodes. Such programs can arise, for example, after extensive unrolling of reduction operations in x64 (see the [failure analysis](https://bugs.openjdk.org/browse/JDK-8317507) for further detail).
> 
> A more general fix to eliminate potential out-of-bounds accesses would be to transform `PhaseRegAlloc::_node_regs` into a growable array. This fix could also reduce memory overhead, as it would obviate the need for [over-allocating space for future nodes](https://github.com/openjdk/jdk/blob/fc29a2e152310ed81bd1bb23e6f17d02f055a454/src/hotspot/share/opto/regalloc.cpp#L113-L114). This is however a more intrusive, architecture-sensitive, and difficult-to-backport change (see prototype [here](https://github.com/openjdk/jdk/compare/master...robcasloz:jdk:JDK-8317507-exceeded-node-regs-growable-array)) that might be best addressed as a separate RFE. Note that the general fix would still benefit from the simpler one proposed in this changeset.
> 
> #### Testing
> 
> - tier1-5, stress test, fuzzing (windows-x64, linux-x64, linux-aarch64, macosx-x64, macosx-aarch64; release and debug mode).
> - tier6-7 (linux-x64 only).

Roberto Castañeda Lozano has updated the pull request incrementally with one additional commit since the last revision:

  Add hand-unrolled regression test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/16306/files
  - new: https://git.openjdk.org/jdk/pull/16306/files/4a98f57d..3d20c485

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=16306&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16306&range=00-01

  Stats: 536 lines in 1 file changed: 532 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/16306.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16306/head:pull/16306

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


More information about the hotspot-compiler-dev mailing list