JDK-8344609 : Check ResourceMark nesting when allocating a GrowableArray on an alternative ResourceArea
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2024-11-20
  • Updated: 2024-11-26
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
GrowableArrays can be instantiated for allocation from the current threads ResourceArea.
(using this constructor https://github.com/openjdk/jdk/blob/587f2b4b4dd73733a6ee247200371f8a8d0299c1/src/hotspot/share/utilities/growableArray.hpp#L755)

In that case the _metadata is initialized for nesting checks on grow operations of the GrowableArray.
(see https://github.com/openjdk/jdk/blob/587f2b4b4dd73733a6ee247200371f8a8d0299c1/src/hotspot/share/utilities/growableArray.hpp#L759
and https://github.com/openjdk/jdk/blob/587f2b4b4dd73733a6ee247200371f8a8d0299c1/src/hotspot/share/utilities/growableArray.hpp#L646)

The nesting checks are ommited if an allocation Arena is passed to the GrowableArray constructor.
(see https://github.com/openjdk/jdk/blob/587f2b4b4dd73733a6ee247200371f8a8d0299c1/src/hotspot/share/utilities/growableArray.hpp#L652).

Proposed enhancement: do nesting checks if the Arena is in fact a ResourceArea.

Example: PhaseChaitin::_lrg_map::_names is constructed passing an Arena which is in fact the threads ResourceArea.
(see https://github.com/openjdk/jdk/blob/587f2b4b4dd73733a6ee247200371f8a8d0299c1/src/hotspot/share/opto/chaitin.cpp#L212
and https://github.com/openjdk/jdk/blob/5b12a87dcb47b5783f179534e2de43d5a920a489/src/hotspot/share/opto/chaitin.hpp#L378)

These additional nesting checks would have indicated the cause of JDK-8328085
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/22269 Date: 2024-11-20 10:01:24 +0000
20-11-2024