changeset 59306:184d94d22d72

8235729: Shenandoah: Remove useless casting to non-constant Reviewed-by: roland
author rkennke
date Wed, 11 Dec 2019 16:43:02 +0100
parents 0d33d0db0c96
children bb39b624948d
files src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp src/hotspot/share/opto/type.cpp src/hotspot/share/opto/type.hpp
diffstat 3 files changed, 4 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp	Wed Dec 11 16:24:10 2019 +0100
+++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp	Wed Dec 11 16:43:02 2019 +0100
@@ -1018,7 +1018,7 @@
 
 void ShenandoahBarrierC2Support::call_lrb_stub(Node*& ctrl, Node*& val, Node* load_addr, Node*& result_mem, Node* raw_mem, bool is_native, PhaseIdealLoop* phase) {
   IdealLoopTree*loop = phase->get_loop(ctrl);
-  const TypePtr* obj_type = phase->igvn().type(val)->is_oopptr()->cast_to_nonconst();
+  const TypePtr* obj_type = phase->igvn().type(val)->is_oopptr();
 
   // The slow path stub consumes and produces raw memory in addition
   // to the existing memory edges
@@ -2138,7 +2138,7 @@
   if (t == TypePtr::NULL_PTR) {
     return t;
   }
-  return t->is_oopptr()->cast_to_nonconst();
+  return t->is_oopptr();
 }
 
 const Type* ShenandoahEnqueueBarrierNode::Value(PhaseGVN* phase) const {
@@ -2152,7 +2152,7 @@
   if (t == TypePtr::NULL_PTR) {
     return t;
   }
-  return t->is_oopptr()->cast_to_nonconst();
+  return t->is_oopptr();
 }
 
 int ShenandoahEnqueueBarrierNode::needed(Node* n) {
@@ -3079,7 +3079,7 @@
     return t2;
   }
 
-  const Type* type = t2->is_oopptr()/*->cast_to_nonconst()*/;
+  const Type* type = t2->is_oopptr();
   return type;
 }
 
--- a/src/hotspot/share/opto/type.cpp	Wed Dec 11 16:24:10 2019 +0100
+++ b/src/hotspot/share/opto/type.cpp	Wed Dec 11 16:43:02 2019 +0100
@@ -3051,10 +3051,6 @@
   return this;
 }
 
-const TypeOopPtr *TypeOopPtr::cast_to_nonconst() const {
-  return this;
-}
-
 //-----------------------------cast_to_exactness-------------------------------
 const Type *TypeOopPtr::cast_to_exactness(bool klass_is_exact) const {
   // There is no such thing as an exact general oop.
@@ -3561,11 +3557,6 @@
   return make(_ptr, klass(), _klass_is_exact, const_oop(), _offset, instance_id, _speculative, _inline_depth);
 }
 
-const TypeOopPtr *TypeInstPtr::cast_to_nonconst() const {
-  if (const_oop() == NULL) return this;
-  return make(NotNull, klass(), _klass_is_exact, NULL, _offset, _instance_id, _speculative, _inline_depth);
-}
-
 //------------------------------xmeet_unloaded---------------------------------
 // Compute the MEET of two InstPtrs when at least one is unloaded.
 // Assume classes are different since called after check for same name/class-loader
@@ -4098,11 +4089,6 @@
   return make(_ptr, const_oop(), _ary, klass(), _klass_is_exact, _offset, instance_id, _speculative, _inline_depth);
 }
 
-const TypeOopPtr *TypeAryPtr::cast_to_nonconst() const {
-  if (const_oop() == NULL) return this;
-  return make(NotNull, NULL, _ary, klass(), _klass_is_exact, _offset, _instance_id, _speculative, _inline_depth);
-}
-
 
 //-----------------------------max_array_length-------------------------------
 // A wrapper around arrayOopDesc::max_array_length(etype) with some input normalization.
--- a/src/hotspot/share/opto/type.hpp	Wed Dec 11 16:24:10 2019 +0100
+++ b/src/hotspot/share/opto/type.hpp	Wed Dec 11 16:43:02 2019 +0100
@@ -1030,8 +1030,6 @@
 
   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
 
-  virtual const TypeOopPtr *cast_to_nonconst() const;
-
   // corresponding pointer to klass, for a given instance
   const TypeKlassPtr* as_klass_type() const;
 
@@ -1116,8 +1114,6 @@
 
   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
 
-  virtual const TypeOopPtr *cast_to_nonconst() const;
-
   virtual const TypePtr *add_offset( intptr_t offset ) const;
 
   // Speculative type helper methods.
@@ -1202,8 +1198,6 @@
 
   virtual const TypeOopPtr *cast_to_instance_id(int instance_id) const;
 
-  virtual const TypeOopPtr *cast_to_nonconst() const;
-
   virtual const TypeAryPtr* cast_to_size(const TypeInt* size) const;
   virtual const TypeInt* narrow_size_type(const TypeInt* size) const;