Blocks :
|
|
Relates :
|
This is observed in VarHandles work for JDK-8130923. The reason is that C1 canonicalizer seems to assume a particular constant shape (InstanceConstant), while the Class instances coming through @Stable/static-final seem to be ObjectConstants. Accepting ObjectConstants as well fixes it: http://cr.openjdk.java.net/~shade/8131782/webrev.01/ Simple benchmark articulates it clearly: http://cr.openjdk.java.net/~shade/8131782/ClassCastConstants.java (Runnable JAR: http://cr.openjdk.java.net/~shade/8131782/benchmarks.jar) Baseline result calls into Runtime::isInstance in "static final" case, experiencing the 2x hit: http://cr.openjdk.java.net/~shade/8131782/baseline.perfasm Patched VM behaves perfectly well in both cases: http://cr.openjdk.java.net/~shade/8131782/patched.perfasm