< prev index next >

src/hotspot/share/c1/c1_Canonicalizer.cpp

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

*** 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 == NULL) {

*** 672,17 ***
      if (klass != NULL && 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())) {
          set_canonical(obj);
          return;
        }
      }
!     // checkcast of null returns null
!     if (obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) {
        set_canonical(obj);
      }
    }
  }
  void Canonicalizer::do_InstanceOf     (InstanceOf*      x) {
--- 674,18 ---
      if (klass != NULL && 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()) && (!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 for non null-free klasses
!     if (!x->is_null_free() && obj->is_null_obj()) {
        set_canonical(obj);
      }
    }
  }
  void Canonicalizer::do_InstanceOf     (InstanceOf*      x) {

*** 692,11 ***
      if (exact != NULL && exact->is_loaded() && (obj->as_NewInstance() || obj->as_NewArray())) {
        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()) {
        set_constant(0);
      }
    }
  
  }
--- 695,11 ---
      if (exact != NULL && exact->is_loaded() && (obj->as_NewInstance() || obj->as_NewArray())) {
        set_constant(exact->is_subtype_of(x->klass()) ? 1 : 0);
        return;
      }
      // instanceof null returns false
!     if (obj->as_Constant() && obj->is_null_obj()) {
        set_constant(0);
      }
    }
  
  }

*** 861,12 ***
  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_RangeCheckPredicate(RangeCheckPredicate* x) {}
  #ifdef ASSERT
  void Canonicalizer::do_Assert         (Assert*          x) {}
  #endif
  void Canonicalizer::do_MemBar         (MemBar*          x) {}
--- 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_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 >