[13] RFR (S): 8218874: C2: Unsafe to access PhaseIdealLoop outside of constructors

Tobias Hartmann tobias.hartmann at oracle.com
Wed Feb 13 07:57:00 UTC 2019

Hi Vladimir,

looks good to me but maybe add a comment to the static 'optimize' method. Otherwise, someone might
refactor it away in the future and accidentally re-introduce the problem (no new webrev required).

Best regards,

On 13.02.19 00:15, Vladimir Ivanov wrote:
> http://cr.openjdk.java.net/~vlivanov/8218874/webrev.00/
> https://bugs.openjdk.java.net/browse/JDK-8218874
> It's unsafe to access PhaseIdealLoop outside of its constructors: its internal data structures may
> be corrupted because PhaseIdealLoop::build_and_optimize() allocates some of them under local
> ResourceMark.
> Proposed fix is:
>   * use caller scope for memory allocation (as other Phases do);
>   * to simplify PhaseIdealLoop usage, introduce static method optimize() and allocate PhaseIdealLoop
> there prepended by ResourceMark;
> Testing: hs-precheckin-comp, tier1-5
> Best regards,
> Vladimir Ivanov

More information about the hotspot-compiler-dev mailing list