RFR: allow substituability test when EnableValhalla is false

Roland Westrelin rwestrel at redhat.com
Mon Jan 28 14:22:23 UTC 2019


So we can run performance experiment to evaluate the cost of the
substituability test on legacy workloads with no values.

Roland.

diff --git a/src/hotspot/share/opto/mulnode.cpp b/src/hotspot/share/opto/mulnode.cpp
--- a/src/hotspot/share/opto/mulnode.cpp
+++ b/src/hotspot/share/opto/mulnode.cpp
@@ -598,7 +598,7 @@
     }
 
     if (con == markOopDesc::always_locked_pattern) {
-      assert(EnableValhalla, "should only be used for value types");
+      assert(EnableValhalla || ACmpOnValues == 3, "should only be used for value types");
       if (in(1)->is_Load() && phase->type(in(1)->in(MemNode::Address))->is_valuetypeptr()) {
         return in(2); // Obj is known to be a value type
       }
diff --git a/src/hotspot/share/opto/parse2.cpp b/src/hotspot/share/opto/parse2.cpp
--- a/src/hotspot/share/opto/parse2.cpp
+++ b/src/hotspot/share/opto/parse2.cpp
@@ -1820,7 +1820,7 @@
   // If current method is ValueBootstrapMethods::isSubstitutable(),
   // compile the acmp as a regular pointer comparison otherwise we
   // could call ValueBootstrapMethods::isSubstitutable() back
-  if (ACmpOnValues == 0 || !EnableValhalla || method() == subst_method) {
+  if (ACmpOnValues == 0 || method() == subst_method) {
     Node* cmp = CmpP(a, b);
     cmp = optimize_cmp_with_klass(cmp);
     do_if(btest, cmp);
@@ -1843,8 +1843,8 @@
     const TypeOopPtr* ta = _gvn.type(a)->isa_oopptr();
     const TypeOopPtr* tb = _gvn.type(b)->isa_oopptr();
 
-    if (ta == NULL || !ta->can_be_value_type() ||
-        tb == NULL || !tb->can_be_value_type()) {
+    if (ta == NULL || !ta->can_be_value_type_raw() ||
+        tb == NULL || !tb->can_be_value_type_raw()) {
       Node* cmp = CmpP(a, b);
       cmp = optimize_cmp_with_klass(cmp);
       do_if(btest, cmp);
diff --git a/src/hotspot/share/opto/type.hpp b/src/hotspot/share/opto/type.hpp
--- a/src/hotspot/share/opto/type.hpp
+++ b/src/hotspot/share/opto/type.hpp
@@ -1094,7 +1094,8 @@
   int  instance_id()             const { return _instance_id; }
   bool is_known_instance_field() const { return is_known_instance() && _offset.get() >= 0; }
 
-  virtual bool can_be_value_type() const { return EnableValhalla && (_klass == NULL || _klass->is_valuetype() || ((_klass->is_java_lang_Object() || _klass->is_interface()) && !klass_is_exact())); }
+  virtual bool can_be_value_type() const { return EnableValhalla && can_be_value_type_raw(); }
+  virtual bool can_be_value_type_raw() const { return _klass == NULL || _klass->is_valuetype() || ((_klass->is_java_lang_Object() || _klass->is_interface()) && !klass_is_exact()); }
 
   virtual intptr_t get_con() const;
 
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
--- a/src/hotspot/share/runtime/arguments.cpp
+++ b/src/hotspot/share/runtime/arguments.cpp
@@ -2076,7 +2076,10 @@
   } else {
     FLAG_SET_CMDLINE(bool, ValueArrayFlatten, false);
   }
-
+  if (!EnableValhalla && ACmpOnValues != 3) {
+    FLAG_SET_CMDLINE(uint, ACmpOnValues, 0);
+  }
+  
   return status;
 }
 



More information about the valhalla-dev mailing list