提交 d38d0b0b 编写于 作者: K kvn

6710487: More than half of JDI Regression tests hang with COOPs in -Xcomp mode

Summary: Remove DecodeNNode::decode() and EncodePNode::encode() methods.
Reviewed-by: rasbold, never
上级 61aaa88e
...@@ -5955,7 +5955,7 @@ instruct storeA8B(memory mem, regD src) %{ ...@@ -5955,7 +5955,7 @@ instruct storeA8B(memory mem, regD src) %{
// Convert oop pointer into compressed form // Convert oop pointer into compressed form
instruct encodeHeapOop(iRegN dst, iRegP src) %{ instruct encodeHeapOop(iRegN dst, iRegP src) %{
predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() != TypePtr::NotNull); predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull);
match(Set dst (EncodeP src)); match(Set dst (EncodeP src));
format %{ "encode_heap_oop $src, $dst" %} format %{ "encode_heap_oop $src, $dst" %}
ins_encode %{ ins_encode %{
...@@ -5965,7 +5965,7 @@ instruct encodeHeapOop(iRegN dst, iRegP src) %{ ...@@ -5965,7 +5965,7 @@ instruct encodeHeapOop(iRegN dst, iRegP src) %{
%} %}
instruct encodeHeapOop_not_null(iRegN dst, iRegP src) %{ instruct encodeHeapOop_not_null(iRegN dst, iRegP src) %{
predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() == TypePtr::NotNull); predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull);
match(Set dst (EncodeP src)); match(Set dst (EncodeP src));
format %{ "encode_heap_oop_not_null $src, $dst" %} format %{ "encode_heap_oop_not_null $src, $dst" %}
ins_encode %{ ins_encode %{
......
...@@ -7060,7 +7060,7 @@ instruct castP2X(rRegL dst, rRegP src) ...@@ -7060,7 +7060,7 @@ instruct castP2X(rRegL dst, rRegP src)
// Convert oop pointer into compressed form // Convert oop pointer into compressed form
instruct encodeHeapOop(rRegN dst, rRegP src, rFlagsReg cr) %{ instruct encodeHeapOop(rRegN dst, rRegP src, rFlagsReg cr) %{
predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() != TypePtr::NotNull); predicate(n->bottom_type()->make_ptr()->ptr() != TypePtr::NotNull);
match(Set dst (EncodeP src)); match(Set dst (EncodeP src));
effect(KILL cr); effect(KILL cr);
format %{ "encode_heap_oop $dst,$src" %} format %{ "encode_heap_oop $dst,$src" %}
...@@ -7076,7 +7076,7 @@ instruct encodeHeapOop(rRegN dst, rRegP src, rFlagsReg cr) %{ ...@@ -7076,7 +7076,7 @@ instruct encodeHeapOop(rRegN dst, rRegP src, rFlagsReg cr) %{
%} %}
instruct encodeHeapOop_not_null(rRegN dst, rRegP src, rFlagsReg cr) %{ instruct encodeHeapOop_not_null(rRegN dst, rRegP src, rFlagsReg cr) %{
predicate(n->bottom_type()->is_narrowoop()->make_oopptr()->ptr() == TypePtr::NotNull); predicate(n->bottom_type()->make_ptr()->ptr() == TypePtr::NotNull);
match(Set dst (EncodeP src)); match(Set dst (EncodeP src));
effect(KILL cr); effect(KILL cr);
format %{ "encode_heap_oop_not_null $dst,$src" %} format %{ "encode_heap_oop_not_null $dst,$src" %}
......
...@@ -854,7 +854,8 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const { ...@@ -854,7 +854,8 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const {
// Until we have harmony between classes and interfaces in the type // Until we have harmony between classes and interfaces in the type
// lattice, we must tread carefully around phis which implicitly // lattice, we must tread carefully around phis which implicitly
// convert the one to the other. // convert the one to the other.
const TypeInstPtr* ttip = _type->isa_narrowoop() ? _type->isa_narrowoop()->make_oopptr()->isa_instptr() :_type->isa_instptr(); const TypePtr* ttp = _type->make_ptr();
const TypeInstPtr* ttip = (ttp != NULL) ? ttp->isa_instptr() : NULL;
bool is_intf = false; bool is_intf = false;
if (ttip != NULL) { if (ttip != NULL) {
ciKlass* k = ttip->klass(); ciKlass* k = ttip->klass();
...@@ -873,7 +874,8 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const { ...@@ -873,7 +874,8 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const {
// of all the input types. The lattice is not distributive in // of all the input types. The lattice is not distributive in
// such cases. Ward off asserts in type.cpp by refusing to do // such cases. Ward off asserts in type.cpp by refusing to do
// meets between interfaces and proper classes. // meets between interfaces and proper classes.
const TypeInstPtr* tiip = ti->isa_narrowoop() ? ti->is_narrowoop()->make_oopptr()->isa_instptr() : ti->isa_instptr(); const TypePtr* tip = ti->make_ptr();
const TypeInstPtr* tiip = (tip != NULL) ? tip->isa_instptr() : NULL;
if (tiip) { if (tiip) {
bool ti_is_intf = false; bool ti_is_intf = false;
ciKlass* k = tiip->klass(); ciKlass* k = tiip->klass();
...@@ -930,13 +932,14 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const { ...@@ -930,13 +932,14 @@ const Type *PhiNode::Value( PhaseTransform *phase ) const {
// class-typed Phi and an interface flows in, it's possible that the meet & // class-typed Phi and an interface flows in, it's possible that the meet &
// join report an interface back out. This isn't possible but happens // join report an interface back out. This isn't possible but happens
// because the type system doesn't interact well with interfaces. // because the type system doesn't interact well with interfaces.
const TypeInstPtr *jtip = jt->isa_narrowoop() ? jt->isa_narrowoop()->make_oopptr()->isa_instptr() : jt->isa_instptr(); const TypePtr *jtp = jt->make_ptr();
const TypeInstPtr *jtip = (jtp != NULL) ? jtp->isa_instptr() : NULL;
if( jtip && ttip ) { if( jtip && ttip ) {
if( jtip->is_loaded() && jtip->klass()->is_interface() && if( jtip->is_loaded() && jtip->klass()->is_interface() &&
ttip->is_loaded() && !ttip->klass()->is_interface() ) { ttip->is_loaded() && !ttip->klass()->is_interface() ) {
// Happens in a CTW of rt.jar, 320-341, no extra flags // Happens in a CTW of rt.jar, 320-341, no extra flags
assert(ft == ttip->cast_to_ptr_type(jtip->ptr()) || assert(ft == ttip->cast_to_ptr_type(jtip->ptr()) ||
ft->isa_narrowoop() && ft->isa_narrowoop()->make_oopptr() == ttip->cast_to_ptr_type(jtip->ptr()), ""); ft->isa_narrowoop() && ft->make_ptr() == ttip->cast_to_ptr_type(jtip->ptr()), "");
jt = ft; jt = ft;
} }
} }
......
...@@ -2017,7 +2017,7 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) { ...@@ -2017,7 +2017,7 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) {
for (uint i = 0; i < cnt; i++) { for (uint i = 0; i < cnt; i++) {
Node* m = r->raw_out(i); Node* m = r->raw_out(i);
if (m!= NULL && m->Opcode() == Op_ConN && if (m!= NULL && m->Opcode() == Op_ConN &&
m->bottom_type()->is_narrowoop()->make_oopptr() == t) { m->bottom_type()->make_ptr() == t) {
nn = m; nn = m;
break; break;
} }
...@@ -2070,7 +2070,7 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) { ...@@ -2070,7 +2070,7 @@ static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) {
} }
} }
} else if (t->isa_oopptr()) { } else if (t->isa_oopptr()) {
in2 = ConNode::make(C, t->is_oopptr()->make_narrowoop()); in2 = ConNode::make(C, t->make_narrowoop());
} }
} }
if( in2 != NULL ) { if( in2 != NULL ) {
......
...@@ -570,23 +570,7 @@ const Type *DecodeNNode::Value( PhaseTransform *phase ) const { ...@@ -570,23 +570,7 @@ const Type *DecodeNNode::Value( PhaseTransform *phase ) const {
if (t == TypeNarrowOop::NULL_PTR) return TypePtr::NULL_PTR; if (t == TypeNarrowOop::NULL_PTR) return TypePtr::NULL_PTR;
assert(t->isa_narrowoop(), "only narrowoop here"); assert(t->isa_narrowoop(), "only narrowoop here");
return t->is_narrowoop()->make_oopptr(); return t->make_ptr();
}
Node* DecodeNNode::decode(PhaseTransform* phase, Node* value) {
if (value->is_EncodeP()) {
// (DecodeN (EncodeP p)) -> p
return value->in(1);
}
const Type* newtype = value->bottom_type();
if (newtype == TypeNarrowOop::NULL_PTR) {
return phase->transform(new (phase->C, 1) ConPNode(TypePtr::NULL_PTR));
} else if (newtype->isa_narrowoop()) {
return phase->transform(new (phase->C, 2) DecodeNNode(value, newtype->is_narrowoop()->make_oopptr()));
} else {
ShouldNotReachHere();
return NULL; // to make C++ compiler happy.
}
} }
Node* EncodePNode::Identity(PhaseTransform* phase) { Node* EncodePNode::Identity(PhaseTransform* phase) {
...@@ -606,24 +590,9 @@ const Type *EncodePNode::Value( PhaseTransform *phase ) const { ...@@ -606,24 +590,9 @@ const Type *EncodePNode::Value( PhaseTransform *phase ) const {
if (t == TypePtr::NULL_PTR) return TypeNarrowOop::NULL_PTR; if (t == TypePtr::NULL_PTR) return TypeNarrowOop::NULL_PTR;
assert(t->isa_oopptr(), "only oopptr here"); assert(t->isa_oopptr(), "only oopptr here");
return t->is_oopptr()->make_narrowoop(); return t->make_narrowoop();
} }
Node* EncodePNode::encode(PhaseTransform* phase, Node* value) {
if (value->is_DecodeN()) {
// (EncodeP (DecodeN p)) -> p
return value->in(1);
}
const Type* newtype = value->bottom_type();
if (newtype == TypePtr::NULL_PTR) {
return phase->transform(new (phase->C, 1) ConNNode(TypeNarrowOop::NULL_PTR));
} else if (newtype->isa_oopptr()) {
return phase->transform(new (phase->C, 2) EncodePNode(value, newtype->is_oopptr()->make_narrowoop()));
} else {
ShouldNotReachHere();
return NULL; // to make C++ compiler happy.
}
}
Node *EncodePNode::Ideal_DU_postCCP( PhaseCCP *ccp ) { Node *EncodePNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
return MemNode::Ideal_common_DU_postCCP(ccp, this, in(1)); return MemNode::Ideal_common_DU_postCCP(ccp, this, in(1));
......
...@@ -280,7 +280,6 @@ class EncodePNode : public TypeNode { ...@@ -280,7 +280,6 @@ class EncodePNode : public TypeNode {
virtual const Type *Value( PhaseTransform *phase ) const; virtual const Type *Value( PhaseTransform *phase ) const;
virtual uint ideal_reg() const { return Op_RegN; } virtual uint ideal_reg() const { return Op_RegN; }
static Node* encode(PhaseTransform* phase, Node* value);
virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp ); virtual Node *Ideal_DU_postCCP( PhaseCCP *ccp );
}; };
...@@ -300,8 +299,6 @@ class DecodeNNode : public TypeNode { ...@@ -300,8 +299,6 @@ class DecodeNNode : public TypeNode {
virtual Node *Identity( PhaseTransform *phase ); virtual Node *Identity( PhaseTransform *phase );
virtual const Type *Value( PhaseTransform *phase ) const; virtual const Type *Value( PhaseTransform *phase ) const;
virtual uint ideal_reg() const { return Op_RegP; } virtual uint ideal_reg() const { return Op_RegP; }
static Node* decode(PhaseTransform* phase, Node* value);
}; };
//------------------------------Conv2BNode------------------------------------- //------------------------------Conv2BNode-------------------------------------
......
...@@ -962,13 +962,8 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist) ...@@ -962,13 +962,8 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist)
assert(tinst != NULL && tinst->is_instance() && assert(tinst != NULL && tinst->is_instance() &&
tinst->instance_id() == elem , "instance type expected."); tinst->instance_id() == elem , "instance type expected.");
const TypeOopPtr *tn_t = NULL;
const Type *tn_type = igvn->type(tn); const Type *tn_type = igvn->type(tn);
if (tn_type->isa_narrowoop()) { const TypeOopPtr *tn_t = tn_type->make_ptr()->isa_oopptr();
tn_t = tn_type->is_narrowoop()->make_oopptr()->isa_oopptr();
} else {
tn_t = tn_type->isa_oopptr();
}
if (tn_t != NULL && if (tn_t != NULL &&
tinst->cast_to_instance(TypeOopPtr::UNKNOWN_INSTANCE)->higher_equal(tn_t)) { tinst->cast_to_instance(TypeOopPtr::UNKNOWN_INSTANCE)->higher_equal(tn_t)) {
...@@ -1921,9 +1916,7 @@ void ConnectionGraph::record_for_escape_analysis(Node *n, PhaseTransform *phase) ...@@ -1921,9 +1916,7 @@ void ConnectionGraph::record_for_escape_analysis(Node *n, PhaseTransform *phase)
case Op_StoreN: case Op_StoreN:
{ {
const Type *adr_type = phase->type(n->in(MemNode::Address)); const Type *adr_type = phase->type(n->in(MemNode::Address));
if (adr_type->isa_narrowoop()) { adr_type = adr_type->make_ptr();
adr_type = adr_type->is_narrowoop()->make_oopptr();
}
if (adr_type->isa_oopptr()) { if (adr_type->isa_oopptr()) {
add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false);
} else { } else {
...@@ -1948,9 +1941,7 @@ void ConnectionGraph::record_for_escape_analysis(Node *n, PhaseTransform *phase) ...@@ -1948,9 +1941,7 @@ void ConnectionGraph::record_for_escape_analysis(Node *n, PhaseTransform *phase)
case Op_CompareAndSwapN: case Op_CompareAndSwapN:
{ {
const Type *adr_type = phase->type(n->in(MemNode::Address)); const Type *adr_type = phase->type(n->in(MemNode::Address));
if (adr_type->isa_narrowoop()) { adr_type = adr_type->make_ptr();
adr_type = adr_type->is_narrowoop()->make_oopptr();
}
if (adr_type->isa_oopptr()) { if (adr_type->isa_oopptr()) {
add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false); add_node(n, PointsToNode::UnknownType, PointsToNode::UnknownEscape, false);
} else { } else {
...@@ -2131,10 +2122,7 @@ void ConnectionGraph::build_connection_graph(Node *n, PhaseTransform *phase) { ...@@ -2131,10 +2122,7 @@ void ConnectionGraph::build_connection_graph(Node *n, PhaseTransform *phase) {
case Op_CompareAndSwapN: case Op_CompareAndSwapN:
{ {
Node *adr = n->in(MemNode::Address); Node *adr = n->in(MemNode::Address);
const Type *adr_type = phase->type(adr); const Type *adr_type = phase->type(adr)->make_ptr();
if (adr_type->isa_narrowoop()) {
adr_type = adr_type->is_narrowoop()->make_oopptr();
}
#ifdef ASSERT #ifdef ASSERT
if (!adr_type->isa_oopptr()) if (!adr_type->isa_oopptr())
assert(phase->type(adr) == TypeRawPtr::NOTNULL, "Op_StoreP"); assert(phase->type(adr) == TypeRawPtr::NOTNULL, "Op_StoreP");
......
...@@ -2194,9 +2194,10 @@ bool LibraryCallKit::inline_unsafe_CAS(BasicType type) { ...@@ -2194,9 +2194,10 @@ bool LibraryCallKit::inline_unsafe_CAS(BasicType type) {
pre_barrier(control(), base, adr, alias_idx, newval, value_type, T_OBJECT); pre_barrier(control(), base, adr, alias_idx, newval, value_type, T_OBJECT);
#ifdef _LP64 #ifdef _LP64
if (adr->bottom_type()->is_ptr_to_narrowoop()) { if (adr->bottom_type()->is_ptr_to_narrowoop()) {
Node *newval_enc = _gvn.transform(new (C, 2) EncodePNode(newval, newval->bottom_type()->make_narrowoop()));
Node *oldval_enc = _gvn.transform(new (C, 2) EncodePNode(oldval, oldval->bottom_type()->make_narrowoop()));
cas = _gvn.transform(new (C, 5) CompareAndSwapNNode(control(), mem, adr, cas = _gvn.transform(new (C, 5) CompareAndSwapNNode(control(), mem, adr,
EncodePNode::encode(&_gvn, newval), newval_enc, oldval_enc));
EncodePNode::encode(&_gvn, oldval)));
} else } else
#endif #endif
{ {
......
...@@ -262,19 +262,19 @@ const Node* MachNode::get_base_and_disp(intptr_t &offset, const TypePtr* &adr_ty ...@@ -262,19 +262,19 @@ const Node* MachNode::get_base_and_disp(intptr_t &offset, const TypePtr* &adr_ty
// Now we have collected every part of the ADLC MEMORY_INTER. // Now we have collected every part of the ADLC MEMORY_INTER.
// See if it adds up to a base + offset. // See if it adds up to a base + offset.
if (index != NULL) { if (index != NULL) {
const TypeNarrowOop* narrowoop = index->bottom_type()->isa_narrowoop(); const Type* t_index = index->bottom_type();
if (narrowoop != NULL) { // EncodeN, LoadN, LoadConN, LoadNKlass. if (t_index->isa_narrowoop()) { // EncodeN, LoadN, LoadConN, LoadNKlass.
// Memory references through narrow oops have a // Memory references through narrow oops have a
// funny base so grab the type from the index: // funny base so grab the type from the index:
// [R12 + narrow_oop_reg<<3 + offset] // [R12 + narrow_oop_reg<<3 + offset]
assert(base == NULL, "Memory references through narrow oops have no base"); assert(base == NULL, "Memory references through narrow oops have no base");
offset = disp; offset = disp;
adr_type = narrowoop->make_oopptr()->add_offset(offset); adr_type = t_index->make_ptr()->add_offset(offset);
return NULL; return NULL;
} else if (!index->is_Con()) { } else if (!index->is_Con()) {
disp = Type::OffsetBot; disp = Type::OffsetBot;
} else if (disp != Type::OffsetBot) { } else if (disp != Type::OffsetBot) {
const TypeX* ti = index->bottom_type()->isa_intptr_t(); const TypeX* ti = t_index->isa_intptr_t();
if (ti == NULL) { if (ti == NULL) {
disp = Type::OffsetBot; // a random constant?? disp = Type::OffsetBot; // a random constant??
} else { } else {
......
...@@ -598,7 +598,7 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray <Sa ...@@ -598,7 +598,7 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray <Sa
field_type = TypeOopPtr::make_from_klass(elem_type->as_klass()); field_type = TypeOopPtr::make_from_klass(elem_type->as_klass());
} }
if (UseCompressedOops) { if (UseCompressedOops) {
field_type = field_type->is_oopptr()->make_narrowoop(); field_type = field_type->make_narrowoop();
basic_elem_type = T_NARROWOOP; basic_elem_type = T_NARROWOOP;
} }
} else { } else {
...@@ -666,9 +666,11 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray <Sa ...@@ -666,9 +666,11 @@ bool PhaseMacroExpand::scalar_replacement(AllocateNode *alloc, GrowableArray <Sa
if (UseCompressedOops && field_type->isa_narrowoop()) { if (UseCompressedOops && field_type->isa_narrowoop()) {
// Enable "DecodeN(EncodeP(Allocate)) --> Allocate" transformation // Enable "DecodeN(EncodeP(Allocate)) --> Allocate" transformation
// to be able scalar replace the allocation. // to be able scalar replace the allocation.
_igvn.set_delay_transform(false); if (field_val->is_EncodeP()) {
field_val = DecodeNNode::decode(&_igvn, field_val); field_val = field_val->in(1);
_igvn.set_delay_transform(true); } else {
field_val = transform_later(new (C, 2) DecodeNNode(field_val, field_val->bottom_type()->make_ptr()));
}
} }
sfpt->add_req(field_val); sfpt->add_req(field_val);
} }
......
...@@ -1766,8 +1766,8 @@ void Matcher::find_shared( Node *n ) { ...@@ -1766,8 +1766,8 @@ void Matcher::find_shared( Node *n ) {
} }
case Op_ConN: { // Convert narrow pointers above the centerline to NUL case Op_ConN: { // Convert narrow pointers above the centerline to NUL
TypeNode *tn = n->as_Type(); // Constants derive from type nodes TypeNode *tn = n->as_Type(); // Constants derive from type nodes
const TypePtr* tp = tn->type()->is_narrowoop()->make_oopptr(); const TypePtr* tp = tn->type()->make_ptr();
if (tp->_ptr == TypePtr::AnyNull) { if (tp && tp->_ptr == TypePtr::AnyNull) {
tn->set_type(TypeNarrowOop::NULL_PTR); tn->set_type(TypeNarrowOop::NULL_PTR);
} }
break; break;
......
...@@ -769,15 +769,8 @@ Node *LoadNode::make( PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const Type ...@@ -769,15 +769,8 @@ Node *LoadNode::make( PhaseGVN& gvn, Node *ctl, Node *mem, Node *adr, const Type
case T_OBJECT: case T_OBJECT:
#ifdef _LP64 #ifdef _LP64
if (adr->bottom_type()->is_ptr_to_narrowoop()) { if (adr->bottom_type()->is_ptr_to_narrowoop()) {
const TypeNarrowOop* narrowtype; Node* load = gvn.transform(new (C, 3) LoadNNode(ctl, mem, adr, adr_type, rt->make_narrowoop()));
if (rt->isa_narrowoop()) { return new (C, 2) DecodeNNode(load, load->bottom_type()->make_ptr());
narrowtype = rt->is_narrowoop();
} else {
narrowtype = rt->is_oopptr()->make_narrowoop();
}
Node* load = gvn.transform(new (C, 3) LoadNNode(ctl, mem, adr, adr_type, narrowtype));
return DecodeNNode::decode(&gvn, load);
} else } else
#endif #endif
{ {
...@@ -1631,9 +1624,8 @@ Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* a ...@@ -1631,9 +1624,8 @@ Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* a
assert(adr_type != NULL, "expecting TypeOopPtr"); assert(adr_type != NULL, "expecting TypeOopPtr");
#ifdef _LP64 #ifdef _LP64
if (adr_type->is_ptr_to_narrowoop()) { if (adr_type->is_ptr_to_narrowoop()) {
const TypeNarrowOop* narrowtype = tk->is_oopptr()->make_narrowoop(); Node* load_klass = gvn.transform(new (C, 3) LoadNKlassNode(ctl, mem, adr, at, tk->make_narrowoop()));
Node* load_klass = gvn.transform(new (C, 3) LoadNKlassNode(ctl, mem, adr, at, narrowtype)); return new (C, 2) DecodeNNode(load_klass, load_klass->bottom_type()->make_ptr());
return DecodeNNode::decode(&gvn, load_klass);
} }
#endif #endif
assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop"); assert(!adr_type->is_ptr_to_narrowoop(), "should have got back a narrow oop");
...@@ -1843,15 +1835,10 @@ Node* LoadNode::klass_identity_common(PhaseTransform *phase ) { ...@@ -1843,15 +1835,10 @@ Node* LoadNode::klass_identity_common(PhaseTransform *phase ) {
//------------------------------Value------------------------------------------ //------------------------------Value------------------------------------------
const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const { const Type *LoadNKlassNode::Value( PhaseTransform *phase ) const {
const Type *t = klass_value_common(phase); const Type *t = klass_value_common(phase);
if (t == Type::TOP)
if (t == TypePtr::NULL_PTR) {
return TypeNarrowOop::NULL_PTR;
}
if (t != Type::TOP && !t->isa_narrowoop()) {
assert(t->is_oopptr(), "sanity");
t = t->is_oopptr()->make_narrowoop();
}
return t; return t;
return t->make_narrowoop();
} }
//------------------------------Identity--------------------------------------- //------------------------------Identity---------------------------------------
...@@ -1864,7 +1851,7 @@ Node* LoadNKlassNode::Identity( PhaseTransform *phase ) { ...@@ -1864,7 +1851,7 @@ Node* LoadNKlassNode::Identity( PhaseTransform *phase ) {
if( t == Type::TOP ) return x; if( t == Type::TOP ) return x;
if( t->isa_narrowoop()) return x; if( t->isa_narrowoop()) return x;
return EncodePNode::encode(phase, x); return phase->transform(new (phase->C, 2) EncodePNode(x, t->make_narrowoop()));
} }
//------------------------------Value----------------------------------------- //------------------------------Value-----------------------------------------
...@@ -1930,9 +1917,8 @@ StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, cons ...@@ -1930,9 +1917,8 @@ StoreNode* StoreNode::make( PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, cons
if (adr->bottom_type()->is_ptr_to_narrowoop() || if (adr->bottom_type()->is_ptr_to_narrowoop() ||
(UseCompressedOops && val->bottom_type()->isa_klassptr() && (UseCompressedOops && val->bottom_type()->isa_klassptr() &&
adr->bottom_type()->isa_rawptr())) { adr->bottom_type()->isa_rawptr())) {
const TypePtr* type = val->bottom_type()->is_ptr(); val = gvn.transform(new (C, 2) EncodePNode(val, val->bottom_type()->make_narrowoop()));
Node* cp = EncodePNode::encode(&gvn, val); return new (C, 4) StoreNNode(ctl, mem, adr, adr_type, val);
return new (C, 4) StoreNNode(ctl, mem, adr, adr_type, cp);
} else } else
#endif #endif
{ {
......
...@@ -67,12 +67,9 @@ Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) { ...@@ -67,12 +67,9 @@ Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) {
const Type* elemtype = arytype->elem(); const Type* elemtype = arytype->elem();
if (UseUniqueSubclasses && result2 != NULL) { if (UseUniqueSubclasses && result2 != NULL) {
const Type* el = elemtype; const Type* el = elemtype->make_ptr();
if (elemtype->isa_narrowoop()) { if (el && el->isa_instptr()) {
el = elemtype->is_narrowoop()->make_oopptr(); const TypeInstPtr* toop = el->is_instptr();
}
const TypeInstPtr* toop = el->isa_instptr();
if (toop) {
if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) { if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) {
// If we load from "AbstractClass[]" we must see "ConcreteSubClass". // If we load from "AbstractClass[]" we must see "ConcreteSubClass".
const Type* subklass = Type::get_const_type(toop->klass()); const Type* subklass = Type::get_const_type(toop->klass());
......
...@@ -743,8 +743,8 @@ Node *CmpPNode::Ideal( PhaseGVN *phase, bool can_reshape ) { ...@@ -743,8 +743,8 @@ Node *CmpPNode::Ideal( PhaseGVN *phase, bool can_reshape ) {
// Simplify an CmpN (compare 2 pointers) node, based on local information. // Simplify an CmpN (compare 2 pointers) node, based on local information.
// If both inputs are constants, compare them. // If both inputs are constants, compare them.
const Type *CmpNNode::sub( const Type *t1, const Type *t2 ) const { const Type *CmpNNode::sub( const Type *t1, const Type *t2 ) const {
const TypePtr *r0 = t1->is_narrowoop()->make_oopptr(); // Handy access const TypePtr *r0 = t1->make_ptr(); // Handy access
const TypePtr *r1 = t2->is_narrowoop()->make_oopptr(); const TypePtr *r1 = t2->make_ptr();
// Undefined inputs makes for an undefined result // Undefined inputs makes for an undefined result
if( TypePtr::above_centerline(r0->_ptr) || if( TypePtr::above_centerline(r0->_ptr) ||
......
...@@ -1424,9 +1424,9 @@ int SuperWord::memory_alignment(MemNode* s, int iv_adjust_in_bytes) { ...@@ -1424,9 +1424,9 @@ int SuperWord::memory_alignment(MemNode* s, int iv_adjust_in_bytes) {
//---------------------------container_type--------------------------- //---------------------------container_type---------------------------
// Smallest type containing range of values // Smallest type containing range of values
const Type* SuperWord::container_type(const Type* t) { const Type* SuperWord::container_type(const Type* t) {
if (t->isa_narrowoop()) t = t->is_narrowoop()->make_oopptr(); const Type* tp = t->make_ptr();
if (t->isa_aryptr()) { if (tp && tp->isa_aryptr()) {
t = t->is_aryptr()->elem(); t = tp->is_aryptr()->elem();
} }
if (t->basic_type() == T_INT) { if (t->basic_type() == T_INT) {
if (t->higher_equal(TypeInt::BOOL)) return TypeInt::BOOL; if (t->higher_equal(TypeInt::BOOL)) return TypeInt::BOOL;
......
...@@ -168,7 +168,20 @@ const Type* Type::get_typeflow_type(ciType* type) { ...@@ -168,7 +168,20 @@ const Type* Type::get_typeflow_type(ciType* type) {
const Type *Type::make( enum TYPES t ) { const Type *Type::make( enum TYPES t ) {
return (new Type(t))->hashcons(); return (new Type(t))->hashcons();
} }
/*
//------------------------------make_ptr---------------------------------------
// Returns this ptr type or the equivalent ptr type for this compressed pointer.
const TypePtr* Type::make_ptr() const {
return (_base == NarrowOop) ? is_narrowoop()->make_oopptr() : is_ptr();
}
//------------------------------make_narrowoop---------------------------------
// Returns this compressed pointer or the equivalent compressed version
// of this pointer type.
const TypeNarrowOop* Type::make_narrowoop() const {
return (_base == NarrowOop) ? is_narrowoop() : TypeNarrowOop::make(is_ptr());
}
*/
//------------------------------cmp-------------------------------------------- //------------------------------cmp--------------------------------------------
int Type::cmp( const Type *const t1, const Type *const t2 ) { int Type::cmp( const Type *const t1, const Type *const t2 ) {
if( t1->_base != t2->_base ) if( t1->_base != t2->_base )
...@@ -491,14 +504,8 @@ bool Type::is_nan() const { ...@@ -491,14 +504,8 @@ bool Type::is_nan() const {
// commutative and the lattice is symmetric. // commutative and the lattice is symmetric.
const Type *Type::meet( const Type *t ) const { const Type *Type::meet( const Type *t ) const {
if (isa_narrowoop() && t->isa_narrowoop()) { if (isa_narrowoop() && t->isa_narrowoop()) {
const Type* result = is_narrowoop()->make_oopptr()->meet(t->is_narrowoop()->make_oopptr()); const Type* result = make_ptr()->meet(t->make_ptr());
if (result->isa_oopptr()) { return result->make_narrowoop();
return result->isa_oopptr()->make_narrowoop();
} else if (result == TypePtr::NULL_PTR) {
return TypeNarrowOop::NULL_PTR;
} else {
return result;
}
} }
const Type *mt = xmeet(t); const Type *mt = xmeet(t);
...@@ -1764,7 +1771,7 @@ inline const TypeInt* normalize_array_size(const TypeInt* size) { ...@@ -1764,7 +1771,7 @@ inline const TypeInt* normalize_array_size(const TypeInt* size) {
//------------------------------make------------------------------------------- //------------------------------make-------------------------------------------
const TypeAry *TypeAry::make( const Type *elem, const TypeInt *size) { const TypeAry *TypeAry::make( const Type *elem, const TypeInt *size) {
if (UseCompressedOops && elem->isa_oopptr()) { if (UseCompressedOops && elem->isa_oopptr()) {
elem = elem->is_oopptr()->make_narrowoop(); elem = elem->make_narrowoop();
} }
size = normalize_array_size(size); size = normalize_array_size(size);
return (TypeAry*)(new TypeAry(elem,size))->hashcons(); return (TypeAry*)(new TypeAry(elem,size))->hashcons();
...@@ -1849,9 +1856,8 @@ bool TypeAry::ary_must_be_exact() const { ...@@ -1849,9 +1856,8 @@ bool TypeAry::ary_must_be_exact() const {
if (_elem == BOTTOM) return false; // general array not exact if (_elem == BOTTOM) return false; // general array not exact
if (_elem == TOP ) return false; // inverted general array not exact if (_elem == TOP ) return false; // inverted general array not exact
const TypeOopPtr* toop = NULL; const TypeOopPtr* toop = NULL;
if (UseCompressedOops) { if (UseCompressedOops && _elem->isa_narrowoop()) {
const TypeNarrowOop* noop = _elem->isa_narrowoop(); toop = _elem->make_ptr()->isa_oopptr();
if (noop) toop = noop->make_oopptr()->isa_oopptr();
} else { } else {
toop = _elem->isa_oopptr(); toop = _elem->isa_oopptr();
} }
...@@ -1861,16 +1867,18 @@ bool TypeAry::ary_must_be_exact() const { ...@@ -1861,16 +1867,18 @@ bool TypeAry::ary_must_be_exact() const {
if (!tklass->is_loaded()) return false; // unloaded class if (!tklass->is_loaded()) return false; // unloaded class
const TypeInstPtr* tinst; const TypeInstPtr* tinst;
if (_elem->isa_narrowoop()) if (_elem->isa_narrowoop())
tinst = _elem->is_narrowoop()->make_oopptr()->isa_instptr(); tinst = _elem->make_ptr()->isa_instptr();
else else
tinst = _elem->isa_instptr(); tinst = _elem->isa_instptr();
if (tinst) return tklass->as_instance_klass()->is_final(); if (tinst)
return tklass->as_instance_klass()->is_final();
const TypeAryPtr* tap; const TypeAryPtr* tap;
if (_elem->isa_narrowoop()) if (_elem->isa_narrowoop())
tap = _elem->is_narrowoop()->make_oopptr()->isa_aryptr(); tap = _elem->make_ptr()->isa_aryptr();
else else
tap = _elem->isa_aryptr(); tap = _elem->isa_aryptr();
if (tap) return tap->ary()->ary_must_be_exact(); if (tap)
return tap->ary()->ary_must_be_exact();
return false; return false;
} }
...@@ -2579,10 +2587,6 @@ const TypePtr *TypeOopPtr::add_offset( int offset ) const { ...@@ -2579,10 +2587,6 @@ const TypePtr *TypeOopPtr::add_offset( int offset ) const {
return make( _ptr, xadd_offset(offset) ); return make( _ptr, xadd_offset(offset) );
} }
const TypeNarrowOop* TypeOopPtr::make_narrowoop() const {
return TypeNarrowOop::make(this);
}
int TypeOopPtr::meet_instance(int iid) const { int TypeOopPtr::meet_instance(int iid) const {
if (iid == 0) { if (iid == 0) {
return (_instance_id < 0) ? _instance_id : UNKNOWN_INSTANCE; return (_instance_id < 0) ? _instance_id : UNKNOWN_INSTANCE;
...@@ -3494,7 +3498,7 @@ const Type *TypeNarrowOop::xmeet( const Type *t ) const { ...@@ -3494,7 +3498,7 @@ const Type *TypeNarrowOop::xmeet( const Type *t ) const {
return this; return this;
case NarrowOop: { case NarrowOop: {
const Type* result = _ooptype->xmeet(t->is_narrowoop()->make_oopptr()); const Type* result = _ooptype->xmeet(t->make_ptr());
if (result->isa_ptr()) { if (result->isa_ptr()) {
return TypeNarrowOop::make(result->is_ptr()); return TypeNarrowOop::make(result->is_ptr());
} }
...@@ -3604,7 +3608,7 @@ ciKlass* TypeAryPtr::klass() const { ...@@ -3604,7 +3608,7 @@ ciKlass* TypeAryPtr::klass() const {
const TypeAryPtr *tary; const TypeAryPtr *tary;
const Type* el = elem(); const Type* el = elem();
if (el->isa_narrowoop()) { if (el->isa_narrowoop()) {
el = el->is_narrowoop()->make_oopptr(); el = el->make_ptr();
} }
// Get element klass // Get element klass
......
...@@ -225,6 +225,12 @@ public: ...@@ -225,6 +225,12 @@ public:
virtual bool is_finite() const; // Has a finite value virtual bool is_finite() const; // Has a finite value
virtual bool is_nan() const; // Is not a number (NaN) virtual bool is_nan() const; // Is not a number (NaN)
// Returns this ptr type or the equivalent ptr type for this compressed pointer.
const TypePtr* make_ptr() const;
// Returns this compressed pointer or the equivalent compressed version
// of this pointer type.
const TypeNarrowOop* make_narrowoop() const;
// Special test for register pressure heuristic // Special test for register pressure heuristic
bool is_floatingpoint() const; // True if Float or Double base type bool is_floatingpoint() const; // True if Float or Double base type
...@@ -718,9 +724,6 @@ public: ...@@ -718,9 +724,6 @@ public:
virtual const TypePtr *add_offset( int offset ) const; virtual const TypePtr *add_offset( int offset ) const;
// returns the equivalent compressed version of this pointer type
virtual const TypeNarrowOop* make_narrowoop() const;
virtual const Type *xmeet( const Type *t ) const; virtual const Type *xmeet( const Type *t ) const;
virtual const Type *xdual() const; // Compute dual right now. virtual const Type *xdual() const; // Compute dual right now.
...@@ -911,7 +914,7 @@ public: ...@@ -911,7 +914,7 @@ public:
// between the normal and the compressed form. // between the normal and the compressed form.
class TypeNarrowOop : public Type { class TypeNarrowOop : public Type {
protected: protected:
const TypePtr* _ooptype; const TypePtr* _ooptype; // Could be TypePtr::NULL_PTR
TypeNarrowOop( const TypePtr* ooptype): Type(NarrowOop), TypeNarrowOop( const TypePtr* ooptype): Type(NarrowOop),
_ooptype(ooptype) { _ooptype(ooptype) {
...@@ -940,8 +943,8 @@ public: ...@@ -940,8 +943,8 @@ public:
return make(TypeOopPtr::make_from_constant(con)); return make(TypeOopPtr::make_from_constant(con));
} }
// returns the equivalent oopptr type for this compressed pointer // returns the equivalent ptr type for this compressed pointer
virtual const TypePtr *make_oopptr() const { const TypePtr *make_oopptr() const {
return _ooptype; return _ooptype;
} }
...@@ -1128,6 +1131,16 @@ inline const TypeKlassPtr *Type::is_klassptr() const { ...@@ -1128,6 +1131,16 @@ inline const TypeKlassPtr *Type::is_klassptr() const {
return (TypeKlassPtr*)this; return (TypeKlassPtr*)this;
} }
inline const TypePtr* Type::make_ptr() const {
return (_base == NarrowOop) ? is_narrowoop()->make_oopptr() :
(isa_ptr() ? is_ptr() : NULL);
}
inline const TypeNarrowOop* Type::make_narrowoop() const {
return (_base == NarrowOop) ? is_narrowoop() :
(isa_ptr() ? TypeNarrowOop::make(is_ptr()) : NULL);
}
inline bool Type::is_floatingpoint() const { inline bool Type::is_floatingpoint() const {
if( (_base == FloatCon) || (_base == FloatBot) || if( (_base == FloatCon) || (_base == FloatBot) ||
(_base == DoubleCon) || (_base == DoubleBot) ) (_base == DoubleCon) || (_base == DoubleBot) )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册