RFR: Disable barrier optimization on constant when +ShenandoahBarriersForConst

Roland Westrelin rwestrel at redhat.com
Tue Jun 20 15:52:55 UTC 2017


> There is an optimization in
> CmpPNode::shenandoah_optimize_java_mirror_cmp() that eliminates barriers
> when comparing two java mirror objects. We need those barriers when
> running with +ShenandoahBarriersForConst. This patch disables that
> optimization:
>
> http://cr.openjdk.java.net/~rkennke/fixbarriersforconst/webrev.00/
> <http://cr.openjdk.java.net/%7Erkennke/fixbarriersforconst/webrev.00/>

Unless I misread the code, this optimization transforms:

a = o1.getClass();
b = o2.getClass();
if (a != b) {
  a' = read_barrier(a);
  b' = read_barrier(b);
  if (a' == b') {
    ..
  } else {
    ..
 }
} else  {

to:

a = o1.getClass();
b = o2.getClass();
if (a != b) {
  if (a == b) {
    ..
  } else {
    ..
 }
} else  {

then to:

if (o1.klass != o2.klass) {
  if (o1.klass == o2.klass) {
    ..
  } else {
    ..
 }
} else  {

so I'm surprised it affects a correctness. 

Roland.


More information about the shenandoah-dev mailing list