[13] RFR (M): 8223216: C2: Unify class initialization checks between new, getstatic, and putstatic

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Wed May 1 23:37:22 UTC 2019


http://cr.openjdk.java.net/~vlivanov/8223216/webrev.00/
https://bugs.openjdk.java.net/browse/JDK-8223216

(The patch has minor dependencies on 8223213 [1] I sent out for review 
earlier.)

C2 implements class initialization checks for new and 
getstatic/putstatic differently: while "new" supports fast class 
initialization checks, static field accesses rely on uncommon traps 
which may lead to deoptimization/recompilation storms during 
long-running class initialisation.

Proposed patch unifies implementation between them and uses the 
following barrier:
    if (holder->is_initialized()) {
      uncommon_trap(initialized, reinterpret);
    }
    if (!holder->is_reentrant_initialization(current_thread)) {
      uncommon_trap(uninitialized, none);
    }

It also enhances checks for not-yet-initialized classes 
(Compile::needs_clinit_barrier) and unifies the implementation between 
new, invokestatic, and getfield/putfield.

Testing: tier1-5, targeted microbenchmarks, new test from 8223213

Thanks!

Best regards,
Vladimir Ivanov

[1] http://cr.openjdk.java.net/~vlivanov/8223213/webrev.00/
     https://bugs.openjdk.java.net/browse/JDK-8223213



More information about the hotspot-compiler-dev mailing list