JDK-8319209 : C2: make node_regs and scheduling data structures growable
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 22
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2023-11-01
  • Updated: 2023-11-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
RegAlloc::_node_regs maintains an assignment of registers to nodes between register allocation and code emission. This mapping is currently implemented as a raw array. To accommodate nodes created after its allocation, it is given a fixed length of n + n / 2 + 200, where n is the number of nodes at its allocation point. The fixed-length array implementation has two issues:

1. Lack of correctness guarantees: it does not prevent by construction out-of-bounds accesses, e.g. in the face of programs with a high density of CISC spill instructions (see JDK-8317507) or target-specific peephole optimizations creating a large number of nodes.

2. Memory inefficiency: it generally allocates considerably more memory than necessary.

RegAlloc::_node_regs could be implemented as a growable array instead. Using a growable array would prevent out-of-bound accesses by construction and make it possible to allocate significantly less memory while still avoiding expensive array grow operations in the vast majority of compilations.

Three scheduling mappings are currently also implemented as raw arrays of the same length as _node_regs. They could be revisited as well.