src/share/vm/opto/memnode.cpp
Print this page
rev 3688 : 7054512: Compress class pointers after perm gen removal
Summary: support of compress class pointers in the compilers.
Reviewed-by:
@@ -712,14 +712,16 @@
case Op_AddP: // No change to NULL-ness, so peek thru AddP's
adr = adr->in(AddPNode::Base);
continue;
case Op_DecodeN: // No change to NULL-ness, so peek thru
+ case Op_DecodeNKlass:
adr = adr->in(1);
continue;
case Op_EncodeP:
+ case Op_EncodePKlass:
// EncodeP node's control edge could be set by this method
// when EncodeP node depends on CastPP node.
//
// Use its control edge for memory op because EncodeP may go away
// later when it is folded with following or preceding DecodeN node.
@@ -792,10 +794,11 @@
case Op_LoadN: // Loading from within a klass
case Op_LoadKlass: // Loading from within a klass
case Op_LoadNKlass: // Loading from within a klass
case Op_ConP: // Loading from a klass
case Op_ConN: // Loading from a klass
+ case Op_ConNKlass: // Loading from a klass
case Op_CreateEx: // Sucking up the guts of an exception oop
case Op_Con: // Reading from TLS
case Op_CMoveP: // CMoveP is pinned
case Op_CMoveN: // CMoveN is pinned
break; // No progress
@@ -898,11 +901,11 @@
Node* load = gvn.transform(new (C) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop()));
return new (C) DecodeNNode(load, load->bottom_type()->make_ptr());
} else
#endif
{
- assert(!adr->bottom_type()->is_ptr_to_narrowoop(), "should have got back a narrow oop");
+ assert(!adr->bottom_type()->is_ptr_to_narrowoop() && !adr->bottom_type()->is_ptr_to_narrowklass(), "should have got back a narrow oop");
return new (C) LoadPNode(ctl, mem, adr, adr_type, rt->is_oopptr());
}
}
ShouldNotReachHere();
return (LoadNode*)NULL;
@@ -1892,17 +1895,17 @@
Node *ctl = NULL;
// sanity check the alias category against the created node type
const TypePtr *adr_type = adr->bottom_type()->isa_ptr();
assert(adr_type != NULL, "expecting TypeKlassPtr");
#ifdef _LP64
- if (adr_type->is_ptr_to_narrowoop()) {
+ if (adr_type->is_ptr_to_narrowklass()) {
assert(UseCompressedKlassPointers, "no compressed klasses");
- Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop()));
- return new (C) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr());
+ Node* load_klass = gvn.transform(new (C) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowklass()));
+ return new (C) DecodeNKlassNode(load_klass, load_klass->bottom_type()->make_ptr());
}
#endif
- assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
+ assert(!adr_type->is_ptr_to_narrowklass() && !adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
return new (C) LoadKlassNode(ctl, mem, adr, at, tk);
}
//------------------------------Value------------------------------------------
const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
@@ -2108,24 +2111,25 @@
const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const {
const Type *t = klass_value_common(phase);
if (t == Type::TOP)
return t;
- return t->make_narrowoop();
+ return t->make_narrowklass();
}
//------------------------------Identity---------------------------------------
// To clean up reflective code, simplify k.java_mirror.as_klass to narrow k.
// Also feed through the klass in Allocate(...klass...)._klass.
Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
Node *x = klass_identity_common(phase);
const Type *t = phase->type( x );
if( t == Type::TOP ) return x;
- if( t->isa_narrowoop()) return x;
+ if( t->isa_narrowklass()) return x;
+ assert (!t->isa_narrowoop(), "no narrow oop here");
- return phase->transform(new (phase->C) EncodePNode(x, t->make_narrowoop()));
+ return phase->transform(new (phase->C) EncodePKlassNode(x, t->make_narrowklass()));
}
//------------------------------Value-----------------------------------------
const Type *LoadRangeNode::Value( PhaseTransform *phase ) const {
// Either input is TOP ==> the result is TOP
@@ -2226,16 +2230,19 @@
case T_DOUBLE: return new (C) StoreDNode(ctl, mem, adr, adr_type, val);
case T_METADATA:
case T_ADDRESS:
case T_OBJECT:
#ifdef _LP64
- if (adr->bottom_type()->is_ptr_to_narrowoop() ||
- (UseCompressedKlassPointers && val->bottom_type()->isa_klassptr() &&
- adr->bottom_type()->isa_rawptr())) {
+ if (adr->bottom_type()->is_ptr_to_narrowoop()) {
val = gvn.transform(new (C) EncodePNode(val, val->bottom_type()->make_narrowoop()));
return new (C) StoreNNode(ctl, mem, adr, adr_type, val);
- } else
+ } else if (adr->bottom_type()->is_ptr_to_narrowklass() ||
+ (UseCompressedKlassPointers && val->bottom_type()->isa_klassptr() &&
+ adr->bottom_type()->isa_rawptr())) {
+ val = gvn.transform(new (C) EncodePKlassNode(val, val->bottom_type()->make_narrowklass()));
+ return new (C) StoreNKlassNode(ctl, mem, adr, adr_type, val);
+ }
#endif
{
return new (C) StorePNode(ctl, mem, adr, adr_type, val);
}
}