< prev index next >

src/hotspot/share/c1/c1_Canonicalizer.cpp

Print this page
@@ -279,11 +279,11 @@
    IntConstant* index = x->index()->type()->as_IntConstant();
  
    assert(array == nullptr || FoldStableValues, "not enabled");
  
    // Constant fold loads from stable arrays.
-   if (!x->mismatched() && array != nullptr && index != nullptr) {
+   if (!x->should_profile() && !x->mismatched() && array != nullptr && index != nullptr) {
      jint idx = index->value();
      if (idx < 0 || idx >= array->value()->length()) {
        // Leave the load as is. The range check will handle it.
        return;
      }

@@ -638,11 +638,11 @@
    }
  
  }
  
  void Canonicalizer::do_NullCheck      (NullCheck*       x) {
-   if (x->obj()->as_NewArray() != nullptr || x->obj()->as_NewInstance() != nullptr) {
+   if (x->obj()->as_NewArray() != nullptr || x->obj()->as_NewInstance() != nullptr || x->obj()->as_NewInlineTypeInstance()) {
      set_canonical(x->obj());
    } else {
      Constant* con = x->obj()->as_Constant();
      if (con) {
        ObjectType* c = con->type()->as_ObjectType();

@@ -657,13 +657,15 @@
  }
  
  void Canonicalizer::do_TypeCast       (TypeCast*        x) {}
  void Canonicalizer::do_Invoke         (Invoke*          x) {}
  void Canonicalizer::do_NewInstance    (NewInstance*     x) {}
+ void Canonicalizer::do_NewInlineTypeInstance(NewInlineTypeInstance* x) {}
  void Canonicalizer::do_NewTypeArray   (NewTypeArray*    x) {}
  void Canonicalizer::do_NewObjectArray (NewObjectArray*  x) {}
  void Canonicalizer::do_NewMultiArray  (NewMultiArray*   x) {}
+ void Canonicalizer::do_Deoptimize     (Deoptimize*      x) {}
  void Canonicalizer::do_CheckCast      (CheckCast*       x) {
    if (x->klass()->is_loaded()) {
      Value obj = x->obj();
      ciType* klass = obj->exact_type();
      if (klass == nullptr) {

@@ -672,31 +674,32 @@
      if (klass != nullptr && klass->is_loaded()) {
        bool is_interface = klass->is_instance_klass() &&
                            klass->as_instance_klass()->is_interface();
        // Interface casts can't be statically optimized away since verifier doesn't
        // enforce interface types in bytecode.
-       if (!is_interface && klass->is_subtype_of(x->klass())) {
+       if (!is_interface && klass->is_subtype_of(x->klass()) && (!x->is_null_free() || obj->is_null_free())) {
+         assert(!x->klass()->is_inlinetype() || x->klass() == klass, "Inline klasses can't have subtypes");
          set_canonical(obj);
          return;
        }
      }
-     // checkcast of null returns null
-     if (obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) {
+     // checkcast of null returns null for non null-free klasses
+     if (!x->is_null_free() && obj->is_null_obj()) {
        set_canonical(obj);
      }
    }
  }
  void Canonicalizer::do_InstanceOf     (InstanceOf*      x) {
    if (x->klass()->is_loaded()) {
      Value obj = x->obj();
      ciType* exact = obj->exact_type();
-     if (exact != nullptr && exact->is_loaded() && (obj->as_NewInstance() || obj->as_NewArray())) {
+     if (exact != nullptr && exact->is_loaded() && (obj->as_NewInstance() || obj->as_NewArray() || obj->as_NewInlineTypeInstance())) {
        set_constant(exact->is_subtype_of(x->klass()) ? 1 : 0);
        return;
      }
      // instanceof null returns false
-     if (obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) {
+     if (obj->as_Constant() && obj->is_null_obj()) {
        set_constant(0);
      }
    }
  
  }

@@ -810,11 +813,11 @@
            set_canonical(canon);
          }
        }
      }
    } else if (rt == objectNull &&
-            (l->as_NewInstance() || l->as_NewArray() ||
+            (l->as_NewInstance() || l->as_NewArray() || l->as_NewInlineTypeInstance() ||
               (l->as_Local() && l->as_Local()->is_receiver()))) {
      if (x->cond() == Instruction::eql) {
        BlockBegin* sux = x->fsux();
        set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux)));
      } else {

@@ -861,12 +864,13 @@
  void Canonicalizer::do_UnsafeGet      (UnsafeGet*       x) {}
  void Canonicalizer::do_UnsafePut      (UnsafePut*       x) {}
  void Canonicalizer::do_UnsafeGetAndSet(UnsafeGetAndSet* x) {}
  void Canonicalizer::do_ProfileCall    (ProfileCall*     x) {}
  void Canonicalizer::do_ProfileReturnType(ProfileReturnType* x) {}
- void Canonicalizer::do_ProfileInvoke  (ProfileInvoke*   x) {}
- void Canonicalizer::do_RuntimeCall    (RuntimeCall*     x) {}
+ void Canonicalizer::do_ProfileInvoke    (ProfileInvoke* x) {}
+ void Canonicalizer::do_ProfileACmpTypes (ProfileACmpTypes* x) {}
+ void Canonicalizer::do_RuntimeCall      (RuntimeCall* x) {}
  void Canonicalizer::do_RangeCheckPredicate(RangeCheckPredicate* x) {}
  #ifdef ASSERT
  void Canonicalizer::do_Assert         (Assert*          x) {}
  #endif
  void Canonicalizer::do_MemBar         (MemBar*          x) {}
< prev index next >