Final Fields with Shenandoah

Eugeniu Rabii eugen.rabii at gmail.com
Tue Dec 17 12:14:38 UTC 2019


Hi,

I am trying  to run this example 
http://hg.openjdk.java.net/code-tools/jcstress/file/3dcb38e98aa6/jcstress-samples/src/main/java/org/openjdk/jcstress/samples/JMMSample_06_Finals.java

with Shenandoah. Specifically I run it with:

       -XX:+UnlockExperimentalVMOptions

       -XX:+UseShenandoahGC

I was  expecting it to fail, but it did not. My ultimate goal was trying 
to prove myself that running that same example, but making some 
variables final would still employ an error. Meaning, if I would change 
that example to:


public static class MyObject {

     final int x1, x2, x3, x4; int x5, x6, x7, x8; public MyObject(int v) {
         x1 =v; x2 =v; x3 =v; x4 =v; x5 =v; x6 =v; x7 =v; x8 =v; }
}


And run it with:


            -XX:+UnlockExperimentalVMOptions +

            -XX:+UseShenandoahGC

            -XX:+ShenandoahOptimizeInstanceFinals

           -XX:-TieredCompilation


I would see it break...

I hope this makes  sense.

Thank you,

Eugene.




More information about the jcstress-dev mailing list