src/share/vm/opto/type.cpp

changeset 1424
148e5441d916
parent 1393
c7e94e8fff43
child 1427
6a8ccac44f41
     1.1 --- a/src/share/vm/opto/type.cpp	Tue Sep 15 11:09:34 2009 -0700
     1.2 +++ b/src/share/vm/opto/type.cpp	Tue Sep 15 21:53:47 2009 -0700
     1.3 @@ -2411,14 +2411,13 @@
     1.4  
     1.5  //------------------------------make_from_constant-----------------------------
     1.6  // Make a java pointer from an oop constant
     1.7 -const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o) {
     1.8 +const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_constant) {
     1.9    if (o->is_method_data() || o->is_method()) {
    1.10      // Treat much like a typeArray of bytes, like below, but fake the type...
    1.11 -    assert(o->has_encoding(), "must be a perm space object");
    1.12      const Type* etype = (Type*)get_const_basic_type(T_BYTE);
    1.13      const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS);
    1.14      ciKlass *klass = ciTypeArrayKlass::make((BasicType) T_BYTE);
    1.15 -    assert(o->has_encoding(), "method data oops should be tenured");
    1.16 +    assert(o->can_be_constant(), "method data oops should be tenured");
    1.17      const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0);
    1.18      return arr;
    1.19    } else {
    1.20 @@ -2427,8 +2426,9 @@
    1.21      ciKlass *klass = o->klass();
    1.22      if (klass->is_instance_klass()) {
    1.23        // Element is an instance
    1.24 -      if (!o->has_encoding()) {  // not a perm-space constant
    1.25 -        // %%% remove this restriction by rewriting non-perm ConPNodes in a later phase
    1.26 +      if (require_constant) {
    1.27 +        if (!o->can_be_constant())  return NULL;
    1.28 +      } else if (!o->should_be_constant()) {
    1.29          return TypeInstPtr::make(TypePtr::NotNull, klass, true, NULL, 0);
    1.30        }
    1.31        return TypeInstPtr::make(o);
    1.32 @@ -2440,8 +2440,9 @@
    1.33        // We used to pass NotNull in here, asserting that the sub-arrays
    1.34        // are all not-null.  This is not true in generally, as code can
    1.35        // slam NULLs down in the subarrays.
    1.36 -      if (!o->has_encoding()) {  // not a perm-space constant
    1.37 -        // %%% remove this restriction by rewriting non-perm ConPNodes in a later phase
    1.38 +      if (require_constant) {
    1.39 +        if (!o->can_be_constant())  return NULL;
    1.40 +      } else if (!o->should_be_constant()) {
    1.41          return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0);
    1.42        }
    1.43        const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0);
    1.44 @@ -2453,8 +2454,9 @@
    1.45        const TypeAry* arr0 = TypeAry::make(etype, TypeInt::make(o->as_array()->length()));
    1.46        // We used to pass NotNull in here, asserting that the array pointer
    1.47        // is not-null. That was not true in general.
    1.48 -      if (!o->has_encoding()) {  // not a perm-space constant
    1.49 -        // %%% remove this restriction by rewriting non-perm ConPNodes in a later phase
    1.50 +      if (require_constant) {
    1.51 +        if (!o->can_be_constant())  return NULL;
    1.52 +      } else if (!o->should_be_constant()) {
    1.53          return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0);
    1.54        }
    1.55        const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0);
    1.56 @@ -2483,7 +2485,7 @@
    1.57      ShouldNotReachHere();
    1.58    }
    1.59  
    1.60 -  return (intptr_t)const_oop()->encoding();
    1.61 +  return (intptr_t)const_oop()->constant_encoding();
    1.62  }
    1.63  
    1.64  
    1.65 @@ -3338,14 +3340,19 @@
    1.66        ciObject* o = const_oop();
    1.67        if( _ptr == Constant ) {
    1.68          if( tap->const_oop() != NULL && !o->equals(tap->const_oop()) ) {
    1.69 +          xk = (klass() == tap->klass());
    1.70            ptr = NotNull;
    1.71            o = NULL;
    1.72            instance_id = InstanceBot;
    1.73 +        } else {
    1.74 +          xk = true;
    1.75          }
    1.76        } else if( above_centerline(_ptr) ) {
    1.77          o = tap->const_oop();
    1.78 +        xk = true;
    1.79 +      } else {
    1.80 +        xk = this->_klass_is_exact;
    1.81        }
    1.82 -      xk = true;
    1.83        return TypeAryPtr::make( ptr, o, tary, tap->_klass, xk, off, instance_id );
    1.84      }
    1.85      case NotNull:

mercurial