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

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Thu Feb 14 21:29:46 UTC 2019

> 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).

Good point, will add a comment.

Best regards,
Vladimir Ivanov

> 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