[13] RFR (S): 8188133: C2: Static field accesses in clinit can trigger deoptimizations

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Fri Feb 1 18:14:42 UTC 2019


> If we consider solving general case, I had the following idea in mind: 
> compile special versions for method of not-yet-initialized classes and 
> throw them away once the class is fully initialized.
> 
> Special versions would contain 2 guards:
>    (1) if holder_klass is initialized, then deoptimize and recompile;
>    (2) if current_thread != thread_running_clinit, then deoptimize and 
> recompile;
> 
> The former eliminates initialization check once it becomes redundant and 
> the latter blocks invocations from other threads until the class is 
> fully initialized.

Also, former check (holder_klass is initialized) can be implemented as a 
nmethod dependency.

Best regards,
Vladimir Ivanov


More information about the hotspot-compiler-dev mailing list