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

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

Thanks, Tobias and Vladimir.

> There was problem with RM when run with -XX:+VerifyLoopOptimizations. 
> Please, check that. Otherwise it looks good.

Yes, it makes PhaseIdealLoop::verify() safer since there's no RM inside 
PhaseIdealLoop::build_and_optimize() anymore and verify() access 
PhaseIdealLoop internals after ctor.

Best regards,
Vladimir Ivanov

> On 2/12/19 3:15 PM, 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