1.1 --- a/src/share/vm/opto/type.cpp Mon Jun 18 12:29:21 2012 -0700 1.2 +++ b/src/share/vm/opto/type.cpp Mon Jun 18 15:17:30 2012 -0700 1.3 @@ -2613,18 +2613,26 @@ 1.4 //------------------------------make_from_constant----------------------------- 1.5 // Make a java pointer from an oop constant 1.6 const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_constant) { 1.7 - if (o->is_method_data() || o->is_method() || o->is_cpcache()) { 1.8 + if (o->is_method_data() || o->is_method()) { 1.9 // Treat much like a typeArray of bytes, like below, but fake the type... 1.10 - const Type* etype = (Type*)get_const_basic_type(T_BYTE); 1.11 + const BasicType bt = T_BYTE; 1.12 + const Type* etype = get_const_basic_type(bt); 1.13 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS); 1.14 - ciKlass *klass = ciTypeArrayKlass::make((BasicType) T_BYTE); 1.15 - assert(o->can_be_constant(), "method data oops should be tenured"); 1.16 - const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); 1.17 - return arr; 1.18 + ciKlass* klass = ciArrayKlass::make(ciType::make(bt)); 1.19 + assert(o->can_be_constant(), "should be tenured"); 1.20 + return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); 1.21 + } else if (o->is_cpcache()) { 1.22 + // Treat much like a objArray, like below, but fake the type... 1.23 + const BasicType bt = T_OBJECT; 1.24 + const Type* etype = get_const_basic_type(bt); 1.25 + const TypeAry* arr0 = TypeAry::make(etype, TypeInt::POS); 1.26 + ciKlass* klass = ciArrayKlass::make(ciType::make(bt)); 1.27 + assert(o->can_be_constant(), "should be tenured"); 1.28 + return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); 1.29 } else { 1.30 assert(o->is_java_object(), "must be java language object"); 1.31 assert(!o->is_null_object(), "null object not yet handled here."); 1.32 - ciKlass *klass = o->klass(); 1.33 + ciKlass* klass = o->klass(); 1.34 if (klass->is_instance_klass()) { 1.35 // Element is an instance 1.36 if (require_constant) { 1.37 @@ -2635,8 +2643,7 @@ 1.38 return TypeInstPtr::make(o); 1.39 } else if (klass->is_obj_array_klass()) { 1.40 // Element is an object array. Recursively call ourself. 1.41 - const Type *etype = 1.42 - TypeOopPtr::make_from_klass_raw(klass->as_obj_array_klass()->element_klass()); 1.43 + const Type *etype = make_from_klass_raw(klass->as_obj_array_klass()->element_klass()); 1.44 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::make(o->as_array()->length())); 1.45 // We used to pass NotNull in here, asserting that the sub-arrays 1.46 // are all not-null. This is not true in generally, as code can 1.47 @@ -2646,12 +2653,10 @@ 1.48 } else if (!o->should_be_constant()) { 1.49 return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0); 1.50 } 1.51 - const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); 1.52 - return arr; 1.53 + return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); 1.54 } else if (klass->is_type_array_klass()) { 1.55 // Element is an typeArray 1.56 - const Type* etype = 1.57 - (Type*)get_const_basic_type(klass->as_type_array_klass()->element_type()); 1.58 + const Type* etype = get_const_basic_type(klass->as_type_array_klass()->element_type()); 1.59 const TypeAry* arr0 = TypeAry::make(etype, TypeInt::make(o->as_array()->length())); 1.60 // We used to pass NotNull in here, asserting that the array pointer 1.61 // is not-null. That was not true in general. 1.62 @@ -2660,12 +2665,11 @@ 1.63 } else if (!o->should_be_constant()) { 1.64 return TypeAryPtr::make(TypePtr::NotNull, arr0, klass, true, 0); 1.65 } 1.66 - const TypeAryPtr* arr = TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); 1.67 - return arr; 1.68 + return TypeAryPtr::make(TypePtr::Constant, o, arr0, klass, true, 0); 1.69 } 1.70 } 1.71 1.72 - ShouldNotReachHere(); 1.73 + fatal("unhandled object type"); 1.74 return NULL; 1.75 } 1.76