< prev index next >
src/hotspot/share/opto/type.cpp
Print this page
@@ -264,15 +264,11 @@
case T_ADDRESS:
assert(type->is_return_address(), "");
return TypeRawPtr::make((address)(intptr_t)type->as_return_address()->bci());
case T_VALUETYPE:
- if (type->is__Value()) {
- return TypeValueTypePtr::NOTNULL;
- } else {
return TypeValueType::make(type->as_value_klass());
- }
default:
// make sure we did not mix up the cases:
assert(type != ciTypeFlow::StateVector::bottom_type(), "");
assert(type != ciTypeFlow::StateVector::top_type(), "");
@@ -601,13 +597,10 @@
TypeNarrowOop::NULL_PTR = TypeNarrowOop::make( TypePtr::NULL_PTR );
TypeNarrowOop::BOTTOM = TypeNarrowOop::make( TypeInstPtr::BOTTOM );
TypeNarrowKlass::NULL_PTR = TypeNarrowKlass::make( TypePtr::NULL_PTR );
- // TypeValueTypePtr::NOTNULL = EnableValhalla ? TypeValueTypePtr::make(TypePtr::NotNull, current->env()->Object_klass()) : NULL;
- TypeValueTypePtr::NOTNULL = NULL;
-
mreg2type[Op_Node] = Type::BOTTOM;
mreg2type[Op_Set ] = 0;
mreg2type[Op_RegN] = TypeNarrowOop::BOTTOM;
mreg2type[Op_RegI] = TypeInt::INT;
mreg2type[Op_RegP] = TypePtr::BOTTOM;
@@ -958,11 +951,10 @@
case OopPtr:
return t->xmeet(this);
case InstPtr:
- case ValueTypePtr:
return t->xmeet(this);
case MetadataPtr:
case KlassPtr:
return t->xmeet(this);
@@ -1190,11 +1182,10 @@
switch (t->base()) { // Switch on original type
case AnyPtr: // Mixing with oops happens when javac
case RawPtr: // reuses local variables
case OopPtr:
case InstPtr:
- case ValueTypePtr:
case AryPtr:
case MetadataPtr:
case KlassPtr:
case NarrowOop:
case NarrowKlass:
@@ -1298,11 +1289,10 @@
switch (t->base()) { // Switch on original type
case AnyPtr: // Mixing with oops happens when javac
case RawPtr: // reuses local variables
case OopPtr:
case InstPtr:
- case ValueTypePtr:
case AryPtr:
case MetadataPtr:
case KlassPtr:
case NarrowOop:
case NarrowKlass:
@@ -1444,11 +1434,10 @@
switch (t->base()) { // Switch on original type
case AnyPtr: // Mixing with oops happens when javac
case RawPtr: // reuses local variables
case OopPtr:
case InstPtr:
- case ValueTypePtr:
case AryPtr:
case MetadataPtr:
case KlassPtr:
case NarrowOop:
case NarrowKlass:
@@ -1704,11 +1693,10 @@
switch (t->base()) { // Switch on original type
case AnyPtr: // Mixing with oops happens when javac
case RawPtr: // reuses local variables
case OopPtr:
case InstPtr:
- case ValueTypePtr:
case AryPtr:
case MetadataPtr:
case KlassPtr:
case NarrowOop:
case NarrowKlass:
@@ -2021,11 +2009,11 @@
int vt_extra = 0;
if (vt_fields_as_args) {
for (int i = 0; i < sig->count(); i++) {
ciType* type = sig->type_at(i);
- if (type->basic_type() == T_VALUETYPE && !type->is__Value()) {
+ if (type->basic_type() == T_VALUETYPE) {
assert(type->is_valuetype(), "inconsistent type");
ciValueKlass* vk = (ciValueKlass*)type;
vt_extra += vk->value_arg_slots()-1;
}
}
@@ -2034,11 +2022,11 @@
uint pos = TypeFunc::Parms;
const Type **field_array;
if (recv != NULL) {
arg_cnt++;
- bool vt_fields_for_recv = vt_fields_as_args && recv->is_valuetype() && !recv->is__Value();
+ bool vt_fields_for_recv = vt_fields_as_args && recv->is_valuetype();
if (vt_fields_for_recv) {
ciValueKlass* vk = (ciValueKlass*)recv;
vt_extra += vk->value_arg_slots()-1;
}
field_array = fields(arg_cnt + vt_extra);
@@ -2083,11 +2071,11 @@
case T_SHORT:
field_array[pos++] = TypeInt::INT;
break;
case T_VALUETYPE: {
assert(type->is_valuetype(), "inconsistent type");
- if (vt_fields_as_args && !type->is__Value()) {
+ if (vt_fields_as_args) {
ciValueKlass* vk = (ciValueKlass*)type;
collect_value_fields(vk, field_array, pos);
} else {
// Value types arguments cannot be NULL
// field_array[pos++] = get_const_type(type)->join_speculative(TypePtr::NOTNULL);
@@ -2235,11 +2223,11 @@
return size;
}
//------------------------------make-------------------------------------------
const TypeAry* TypeAry::make(const Type* elem, const TypeInt* size, bool stable) {
- if (elem->isa_valuetypeptr()) {
+ if (elem->is_valuetypeptr()) {
// Value type array elements cannot be NULL
elem = elem->join_speculative(TypePtr::NOTNULL)->is_oopptr();
}
if (UseCompressedOops && elem->isa_oopptr()) {
elem = elem->make_narrowoop();
@@ -2437,12 +2425,11 @@
case NarrowOop: {
return t->make_ptr()->xmeet(this)->make_narrowoop();
}
case AryPtr:
- case InstPtr:
- case ValueTypePtr: {
+ case InstPtr: {
return t->xmeet(this);
}
case ValueType: {
// All value types inherit from Object
@@ -2709,11 +2696,10 @@
return make(AnyPtr, meet_ptr(tp->ptr()), meet_offset(tp->offset()), speculative, depth);
}
case RawPtr: // For these, flip the call around to cut down
case OopPtr:
case InstPtr: // on the cases I have to handle.
- case ValueTypePtr:
case AryPtr:
case MetadataPtr:
case KlassPtr:
return t->xmeet(this); // Call in reverse direction
default: // All else is a mistake
@@ -3121,11 +3107,10 @@
return make( ptr );
}
case OopPtr:
case InstPtr:
- case ValueTypePtr:
case AryPtr:
case MetadataPtr:
case KlassPtr:
return TypePtr::BOTTOM; // Oop meet raw is not well defined
default: // All else is a mistake
@@ -3243,11 +3228,11 @@
// Perm objects don't use compressed references
} else if (_offset == Offset::bottom || _offset == Offset::top) {
// unsafe access
_is_ptr_to_narrowoop = UseCompressedOops;
} else { // exclude unsafe ops
- assert(this->isa_instptr() || this->isa_valuetypeptr(), "must be an instance ptr.");
+ assert(this->isa_instptr(), "must be an instance ptr.");
if (klass() == ciEnv::current()->Class_klass() &&
(this->offset() == java_lang_Class::klass_offset_in_bytes() ||
this->offset() == java_lang_Class::array_klass_offset_in_bytes())) {
// Special hidden fields from the Class.
assert(this->isa_instptr(), "must be an instance ptr.");
@@ -3401,11 +3386,10 @@
int depth = meet_inline_depth(tp->inline_depth());
return make(meet_ptr(tp->ptr()), meet_offset(tp->offset()), instance_id, speculative, depth);
}
case InstPtr: // For these, flip the call around to cut down
- case ValueTypePtr:
case AryPtr:
return t->xmeet(this); // Call in reverse direction
} // End of switch
return this; // Return the double constant
@@ -3421,13 +3405,11 @@
}
//--------------------------make_from_klass_common-----------------------------
// Computes the element-type given a klass.
const TypeOopPtr* TypeOopPtr::make_from_klass_common(ciKlass *klass, bool klass_change, bool try_for_exact) {
- if (klass->is_valuetype()) {
- return TypeValueTypePtr::make(TypePtr::BotPTR, klass->as_value_klass());
- } else if (klass->is_instance_klass()) {
+ if (klass->is_instance_klass() || klass->is_valuetype()) {
Compile* C = Compile::current();
Dependencies* deps = C->dependencies();
assert((deps != NULL) == (C->method() != NULL && C->method()->code_size() > 0), "sanity");
// Element is an instance
bool klass_is_exact = false;
@@ -3486,20 +3468,12 @@
//------------------------------make_from_constant-----------------------------
// Make a java pointer from an oop constant
const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o, bool require_constant) {
assert(!o->is_null_object(), "null object not yet handled here.");
ciKlass* klass = o->klass();
- if (klass->is_valuetype()) {
- // Element is a value type
- if (require_constant) {
- if (!o->can_be_constant()) return NULL;
- } else if (!o->should_be_constant()) {
- return TypeValueTypePtr::make(TypePtr::NotNull, klass->as_value_klass());
- }
- return TypeValueTypePtr::make(o);
- } else if (klass->is_instance_klass()) {
- // Element is an instance
+ if (klass->is_instance_klass() || klass->is_valuetype()) {
+ // Element is an instance or value type
if (require_constant) {
if (!o->can_be_constant()) return NULL;
} else if (!o->should_be_constant()) {
return TypeInstPtr::make(TypePtr::NotNull, klass, true, NULL, Offset(0));
}
@@ -4192,58 +4166,10 @@
// Now we find the LCA of Java classes
ciKlass* k = this_klass->least_common_ancestor(tinst_klass);
return make(ptr, k, false, NULL, off, instance_id, speculative, depth);
} // End of case InstPtr
- case ValueTypePtr: {
- // All value types inherit from Object
- const TypeValueTypePtr* tp = t->is_valuetypeptr();
- Offset offset = meet_offset(tp->offset());
- PTR ptr = meet_ptr(tp->ptr());
- int instance_id = meet_instance_id(tp->instance_id());
- const TypePtr* speculative = xmeet_speculative(tp);
- int depth = meet_inline_depth(tp->inline_depth());
- switch (ptr) {
- case TopPTR:
- case AnyNull: // Fall 'down' to dual of object klass
- // For instances when a subclass meets a superclass we fall
- // below the centerline when the superclass is exact. We need to
- // do the same here.
- if (klass()->equals(ciEnv::current()->Object_klass()) && !klass_is_exact()) {
- return TypeValueTypePtr::make(ptr, tp->value_klass(), NULL, offset, instance_id, speculative, depth);
- } else {
- // cannot subclass, so the meet has to fall badly below the centerline
- ptr = NotNull;
- instance_id = InstanceBot;
- return TypeInstPtr::make( ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
- }
- case Constant:
- case NotNull:
- case BotPTR: // Fall down to object klass
- // LCA is object_klass, but if we subclass from the top we can do better
- if (above_centerline(_ptr)) { // if( _ptr == TopPTR || _ptr == AnyNull )
- // If 'this' (InstPtr) is above the centerline and it is Object class
- // then we can subclass in the Java class hierarchy.
- // For instances when a subclass meets a superclass we fall
- // below the centerline when the superclass is exact. We need
- // to do the same here.
- if (klass()->equals(ciEnv::current()->Object_klass()) && !klass_is_exact()) {
- // that is, tp's value type is a subtype of my klass
- return TypeValueTypePtr::make(ptr, tp->value_klass(), (ptr == Constant ? tp->const_oop() : NULL), offset, instance_id, speculative, depth);
- }
- }
- // The other case cannot happen, since I cannot be a subtype of a value type.
- // The meet falls down to Object class below centerline.
- if (ptr == Constant) {
- ptr = NotNull;
- }
- instance_id = InstanceBot;
- return make(ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
- default: typerr(t);
- }
- }
-
case ValueType: {
// All value types inherit from Object
return TypeInstPtr::make(ptr(), ciEnv::current()->Object_klass());
}
@@ -4744,20 +4670,10 @@
case ValueType: {
// All value types inherit from Object
return TypeInstPtr::make(ptr(), ciEnv::current()->Object_klass());
}
- case ValueTypePtr: {
- const TypeValueTypePtr* tp = t->is_valuetypeptr();
- Offset offset = meet_offset(tp->offset());
- PTR ptr = meet_ptr(tp->ptr());
- int instance_id = meet_instance_id(tp->instance_id());
- const TypePtr* speculative = xmeet_speculative(tp);
- int depth = meet_inline_depth(tp->inline_depth());
- return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
- }
-
}
return this; // Lint noise
}
//------------------------------xdual------------------------------------------
@@ -4914,246 +4830,10 @@
}
//=============================================================================
-//=============================================================================
-
-const TypeValueTypePtr* TypeValueTypePtr::NOTNULL;
-//------------------------------make-------------------------------------------
-const TypeValueTypePtr* TypeValueTypePtr::make(PTR ptr, ciValueKlass* vk, ciObject* o, Offset offset, int instance_id, const TypePtr* speculative, int inline_depth) {
- return (TypeValueTypePtr*)(new TypeValueTypePtr(ptr, vk, o, offset, instance_id, speculative, inline_depth))->hashcons();
-}
-
-const TypePtr* TypeValueTypePtr::add_offset(intptr_t offset) const {
- return make(_ptr, value_klass(), _const_oop, Offset(offset), _instance_id, _speculative, _inline_depth);
-}
-
-//------------------------------cast_to_ptr_type-------------------------------
-const Type* TypeValueTypePtr::cast_to_ptr_type(PTR ptr) const {
- if (ptr == _ptr) return this;
- return make(ptr, value_klass(), _const_oop, _offset, _instance_id, _speculative, _inline_depth);
-}
-
-//-----------------------------cast_to_instance_id----------------------------
-const TypeOopPtr* TypeValueTypePtr::cast_to_instance_id(int instance_id) const {
- if (instance_id == _instance_id) return this;
- return make(_ptr, value_klass(), _const_oop, _offset, instance_id, _speculative, _inline_depth);
-}
-
-//------------------------------meet-------------------------------------------
-// Compute the MEET of two types. It returns a new Type object.
-const Type* TypeValueTypePtr::xmeet_helper(const Type* t) const {
- // Perform a fast test for common case; meeting the same types together.
- if (this == t) return this; // Meeting same type-rep?
-
- switch (t->base()) { // switch on original type
- case Int: // Mixing ints & oops happens when javac
- case Long: // reuses local variables
- case FloatTop:
- case FloatCon:
- case FloatBot:
- case DoubleTop:
- case DoubleCon:
- case DoubleBot:
- case NarrowOop:
- case NarrowKlass:
- case Bottom: // Ye Olde Default
- return Type::BOTTOM;
-
- case MetadataPtr:
- case KlassPtr:
- case RawPtr:
- return TypePtr::BOTTOM;
-
- case Top:
- return this;
-
- default: // All else is a mistake
- typerr(t);
-
- case OopPtr: {
- // Found a OopPtr type vs self-ValueTypePtr type
- const TypeOopPtr* tp = t->is_oopptr();
- Offset offset = meet_offset(tp->offset());
- PTR ptr = meet_ptr(tp->ptr());
- int instance_id = meet_instance_id(tp->instance_id());
- const TypePtr* speculative = xmeet_speculative(tp);
- int depth = meet_inline_depth(tp->inline_depth());
- switch (tp->ptr()) {
- case TopPTR:
- case AnyNull: {
- return make(ptr, value_klass(), NULL, offset, instance_id, speculative, depth);
- }
- case NotNull:
- case BotPTR: {
- return TypeOopPtr::make(ptr, offset, instance_id, speculative, depth);
- }
- default: typerr(t);
- }
- }
-
- case AnyPtr: {
- // Found an AnyPtr type vs self-ValueTypePtr type
- const TypePtr* tp = t->is_ptr();
- Offset offset = meet_offset(tp->offset());
- PTR ptr = meet_ptr(tp->ptr());
- int instance_id = meet_instance_id(InstanceTop);
- const TypePtr* speculative = xmeet_speculative(tp);
- int depth = meet_inline_depth(tp->inline_depth());
- switch (tp->ptr()) {
- case Null:
- if( ptr == Null ) return TypePtr::make(AnyPtr, ptr, offset, speculative, depth);
- // else fall through to AnyNull
- case TopPTR:
- case AnyNull: {
- return make(ptr, value_klass(), NULL, offset, instance_id, speculative, depth);
- }
- case NotNull:
- case BotPTR:
- return TypePtr::make(AnyPtr, ptr, offset, speculative, depth);
- default: typerr(t);
- }
- }
-
- case ValueTypePtr: {
- // Found an ValueTypePtr type vs self-ValueTypePtr type
- const TypeValueTypePtr* tp = t->is_valuetypeptr();
- Offset offset = meet_offset(tp->offset());
- PTR ptr = meet_ptr(tp->ptr());
- int instance_id = meet_instance_id(InstanceTop);
- const TypePtr* speculative = xmeet_speculative(tp);
- int depth = meet_inline_depth(tp->inline_depth());
- // Compute constant oop
- ciObject* o = NULL;
- ciObject* this_oop = const_oop();
- ciObject* tp_oop = tp->const_oop();
- ciKlass* klass = NULL;
- if (_klass != tp->_klass) {
- // All value types inherit from Object
- return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, o, offset, instance_id, speculative, depth);
- } else {
- klass = _klass;
- }
- if (ptr == Constant) {
- if (this_oop != NULL && tp_oop != NULL &&
- this_oop->equals(tp_oop) ) {
- o = this_oop;
- } else if (above_centerline(this ->_ptr)) {
- o = tp_oop;
- } else if (above_centerline(tp ->_ptr)) {
- o = this_oop;
- } else {
- ptr = NotNull;
- }
- }
- return make(ptr, klass->as_value_klass(), o, offset, instance_id, speculative, depth);
- }
-
- case InstPtr: {
- // All value types inherit from Object
- const TypeInstPtr* tp = t->is_instptr();
- Offset offset = meet_offset(tp->offset());
- PTR ptr = meet_ptr(tp->ptr());
- int instance_id = meet_instance_id(tp->instance_id());
- const TypePtr* speculative = xmeet_speculative(tp);
- int depth = meet_inline_depth(tp->inline_depth());
- switch (ptr) {
- case TopPTR:
- case AnyNull: // Fall 'down' to dual of object klass
- // For instances when a subclass meets a superclass we fall
- // below the centerline when the superclass is exact. We need to
- // do the same here.
- if (tp->klass()->equals(ciEnv::current()->Object_klass()) && !tp->klass_is_exact()) {
- return make(ptr, _klass->as_value_klass(), NULL, offset, instance_id, speculative, depth);
- } else {
- // cannot subclass, so the meet has to fall badly below the centerline
- ptr = NotNull;
- instance_id = InstanceBot;
- return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
- }
- case Constant:
- case NotNull:
- case BotPTR: // Fall down to object klass
- // LCA is object_klass, but if we subclass from the top we can do better
- if (above_centerline(tp->ptr())) {
- // If 'tp' is above the centerline and it is Object class
- // then we can subclass in the Java class hierarchy.
- // For instances when a subclass meets a superclass we fall
- // below the centerline when the superclass is exact. We need
- // to do the same here.
- if (tp->klass()->equals(ciEnv::current()->Object_klass()) && !tp->klass_is_exact()) {
- // that is, my value type is a subtype of 'tp' klass
- return make(ptr, _klass->as_value_klass(), (ptr == Constant ? const_oop() : NULL), offset, instance_id, speculative, depth);
- }
- }
- // The other case cannot happen, since t cannot be a subtype of a value type.
- // The meet falls down to Object class below centerline.
- if (ptr == Constant) {
- ptr = NotNull;
- }
- instance_id = InstanceBot;
- return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL,offset, instance_id, speculative, depth);
- default: typerr(t);
- }
- }
-
- case ValueType: {
- // All value types inherit from Object
- return TypeInstPtr::make(ptr(), ciEnv::current()->Object_klass());
- }
-
- case AryPtr: {
- const TypeAryPtr* tp = t->is_aryptr();
- Offset offset = meet_offset(tp->offset());
- PTR ptr = meet_ptr(tp->ptr());
- int instance_id = meet_instance_id(tp->instance_id());
- const TypePtr* speculative = xmeet_speculative(tp);
- int depth = meet_inline_depth(tp->inline_depth());
- return TypeInstPtr::make(ptr, ciEnv::current()->Object_klass(), false, NULL, offset, instance_id, speculative, depth);
- }
-
- }
- return this;
-}
-
-// Dual: compute field-by-field dual
-const Type* TypeValueTypePtr::xdual() const {
- return new TypeValueTypePtr(dual_ptr(), value_klass(), const_oop(), dual_offset(), dual_instance_id(), dual_speculative(), dual_inline_depth());
-}
-
-//------------------------------eq---------------------------------------------
-// Structural equality check for Type representations
-bool TypeValueTypePtr::eq(const Type* t) const {
- const TypeValueTypePtr* p = t->is_valuetypeptr();
- return klass()->equals(p->klass()) && TypeOopPtr::eq(p);
-}
-
-//------------------------------hash-------------------------------------------
-// Type-specific hashing function.
-int TypeValueTypePtr::hash(void) const {
- return java_add((jint)klass()->hash(), (jint)TypeOopPtr::hash());
-}
-
-//------------------------------is__Value--------------------------------------
-bool TypeValueTypePtr::is__Value() const {
- // FIXME
- return false;
-}
-
-//------------------------------dump2------------------------------------------
-#ifndef PRODUCT
-void TypeValueTypePtr::dump2(Dict &d, uint depth, outputStream *st) const {
- st->print("valuetype* ");
- klass()->print_name_on(st);
- st->print(":%s", ptr_msg[_ptr]);
- _offset.dump2(st);
-}
-#endif
-
-//=============================================================================
-
//------------------------------hash-------------------------------------------
// Type-specific hashing function.
int TypeNarrowPtr::hash(void) const {
return _ptrtype->hash() + 7;
}
@@ -5233,11 +4913,10 @@
case DoubleBot:
case AnyPtr:
case RawPtr:
case OopPtr:
case InstPtr:
- case ValueTypePtr:
case AryPtr:
case MetadataPtr:
case KlassPtr:
case NarrowOop:
case NarrowKlass:
@@ -5419,11 +5098,10 @@
case RawPtr:
case KlassPtr:
case OopPtr:
case InstPtr:
- case ValueTypePtr:
case AryPtr:
return TypePtr::BOTTOM; // Oop meet raw is not well defined
case MetadataPtr: {
const TypeMetadataPtr *tp = t->is_metadataptr();
@@ -5572,11 +5250,11 @@
if (el->isa_narrowoop()) {
el = el->make_ptr();
}
// Get element klass
- if (el->isa_instptr() || el->isa_valuetypeptr()) {
+ if (el->isa_instptr()) {
// Compute object array klass from element klass
k_ary = ciArrayKlass::make(el->is_oopptr()->klass());
} else if (el->isa_valuetype()) {
k_ary = ciArrayKlass::make(el->is_valuetype()->value_klass());
} else if ((tary = el->isa_aryptr()) != NULL) {
@@ -5737,11 +5415,10 @@
case RawPtr:
case MetadataPtr:
case OopPtr:
case AryPtr: // Meet with AryPtr
case InstPtr: // Meet with InstPtr
- case ValueTypePtr:
return TypePtr::BOTTOM;
//
// A-top }
// / | \ } Tops
< prev index next >