8229416: Shenandoah: Demote or remove ShenandoahOptimize*Final optimizations
authorshade
Mon, 12 Aug 2019 20:27:14 +0200
changeset 57715 6390e7056d12
parent 57714 9f44485e7441
child 57716 bfcdcd00e4fb
8229416: Shenandoah: Demote or remove ShenandoahOptimize*Final optimizations Reviewed-by: rkennke
src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp
src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp
--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp	Mon Aug 12 15:27:57 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp	Mon Aug 12 20:27:14 2019 +0200
@@ -179,10 +179,6 @@
       if (trace) {tty->print_cr("NULL");}
     } else if (!in->bottom_type()->make_ptr()->make_oopptr()) {
       if (trace) {tty->print_cr("Non oop");}
-    } else if (t == ShenandoahLoad && ShenandoahOptimizeStableFinals &&
-               in->bottom_type()->make_ptr()->isa_aryptr() &&
-               in->bottom_type()->make_ptr()->is_aryptr()->is_stable()) {
-      if (trace) {tty->print_cr("Stable array load");}
     } else {
       if (in->is_ConstraintCast()) {
         in = in->in(1);
@@ -323,34 +319,8 @@
                    adr_type->is_instptr()->klass()->is_subtype_of(Compile::current()->env()->Reference_klass()) &&
                    adr_type->is_instptr()->offset() == java_lang_ref_Reference::referent_offset) {
           if (trace) {tty->print_cr("Reference.get()");}
-        } else {
-          bool verify = true;
-          if (adr_type->isa_instptr()) {
-            const TypeInstPtr* tinst = adr_type->is_instptr();
-            ciKlass* k = tinst->klass();
-            assert(k->is_instance_klass(), "");
-            ciInstanceKlass* ik = (ciInstanceKlass*)k;
-            int offset = adr_type->offset();
-
-            if ((ik->debug_final_field_at(offset) && ShenandoahOptimizeInstanceFinals) ||
-                (ik->debug_stable_field_at(offset) && ShenandoahOptimizeStableFinals)) {
-              if (trace) {tty->print_cr("Final/stable");}
-              verify = false;
-            } else if (k == ciEnv::current()->Class_klass() &&
-                       tinst->const_oop() != NULL &&
-                       tinst->offset() >= (ik->size_helper() * wordSize)) {
-              ciInstanceKlass* k = tinst->const_oop()->as_instance()->java_lang_Class_klass()->as_instance_klass();
-              ciField* field = k->get_field_by_offset(tinst->offset(), true);
-              if ((ShenandoahOptimizeStaticFinals && field->is_final()) ||
-                  (ShenandoahOptimizeStableFinals && field->is_stable())) {
-                verify = false;
-              }
-            }
-          }
-
-          if (verify && !verify_helper(n->in(MemNode::Address), phis, visited, ShenandoahLoad, trace, barriers_used)) {
-            report_verify_failure("Shenandoah verification: Load should have barriers", n);
-          }
+        } else if (!verify_helper(n->in(MemNode::Address), phis, visited, ShenandoahLoad, trace, barriers_used)) {
+          report_verify_failure("Shenandoah verification: Load should have barriers", n);
         }
       }
     } else if (n->is_Store()) {
@@ -3215,36 +3185,20 @@
         ciField* field = alias_type->field();
         bool is_static = field != NULL && field->is_static();
         bool is_final = field != NULL && field->is_final();
-        bool is_stable = field != NULL && field->is_stable();
         if (ShenandoahOptimizeStaticFinals && is_static && is_final) {
           // Leave strength as is.
-        } else if (ShenandoahOptimizeInstanceFinals && !is_static && is_final) {
-          // Leave strength as is.
-        } else if (ShenandoahOptimizeStableFinals && (is_stable || (adr_type->isa_aryptr() && adr_type->isa_aryptr()->is_stable()))) {
-          // Leave strength as is.
         } else {
           strength = WEAK;
         }
         break;
       }
-      case Op_AryEq: {
-        Node* n1 = n->in(2);
-        Node* n2 = n->in(3);
-        if (!ShenandoahOptimizeStableFinals ||
-            !n1->bottom_type()->isa_aryptr() || !n1->bottom_type()->isa_aryptr()->is_stable() ||
-            !n2->bottom_type()->isa_aryptr() || !n2->bottom_type()->isa_aryptr()->is_stable()) {
-          strength = WEAK;
-        }
-        break;
-      }
+      case Op_AryEq:
       case Op_StrEquals:
       case Op_StrComp:
       case Op_StrIndexOf:
       case Op_StrIndexOfChar:
       case Op_HasNegatives:
-        if (!ShenandoahOptimizeStableFinals) {
-           strength = WEAK;
-        }
+        strength = WEAK;
         break;
       case Op_Conv2B:
       case Op_LoadRange:
--- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp	Mon Aug 12 15:27:57 2019 +0200
+++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp	Mon Aug 12 20:27:14 2019 +0200
@@ -378,21 +378,11 @@
           " 1 - parallel iterator;"                                         \
           " 2 - parallel iterator with cset filters;")                      \
                                                                             \
-  experimental(bool, ShenandoahOptimizeStaticFinals, true,                  \
+  diagnostic(bool, ShenandoahOptimizeStaticFinals, true,                    \
           "Optimize barriers on static final fields. "                      \
           "Turn it off for maximum compatibility with reflection or JNI "   \
           "code that manipulates final fields.")                            \
                                                                             \
-  experimental(bool, ShenandoahOptimizeInstanceFinals, false,               \
-          "Optimize barriers on final instance fields."                     \
-          "Turn it off for maximum compatibility with reflection or JNI "   \
-          "code that manipulates final fields.")                            \
-                                                                            \
-  experimental(bool, ShenandoahOptimizeStableFinals, false,                 \
-          "Optimize barriers on stable fields."                             \
-          "Turn it off for maximum compatibility with reflection or JNI "   \
-          "code that manipulates final fields.")                            \
-                                                                            \
   experimental(bool, ShenandoahCommonGCStateLoads, false,                   \
          "Enable commonming for GC state loads in generated code.")         \
                                                                             \