< prev index next >

src/hotspot/share/opto/subnode.cpp

Print this page

1144   const TypeKlassPtr* t2 = phase->type(in(2))->isa_klassptr();
1145   if (t2 == nullptr || !t2->klass_is_exact())
1146     return nullptr;
1147   // Get the constant klass we are comparing to.
1148   ciKlass* superklass = t2->exact_klass();
1149 
1150   // Now check for LoadKlass on left.
1151   Node* ldk1 = in(1);
1152   if (ldk1->is_DecodeNKlass()) {
1153     ldk1 = ldk1->in(1);
1154     if (ldk1->Opcode() != Op_LoadNKlass )
1155       return nullptr;
1156   } else if (ldk1->Opcode() != Op_LoadKlass )
1157     return nullptr;
1158   // Take apart the address of the LoadKlass:
1159   Node* adr1 = ldk1->in(MemNode::Address);
1160   intptr_t con2 = 0;
1161   Node* ldk2 = AddPNode::Ideal_base_and_offset(adr1, phase, con2);
1162   if (ldk2 == nullptr)
1163     return nullptr;
1164   if (con2 == oopDesc::klass_offset_in_bytes()) {
1165     // We are inspecting an object's concrete class.
1166     // Short-circuit the check if the query is abstract.
1167     if (superklass->is_interface() ||
1168         superklass->is_abstract()) {
1169       // Make it come out always false:
1170       this->set_req(2, phase->makecon(TypePtr::NULL_PTR));
1171       return this;
1172     }
1173   }
1174 
1175   // Check for a LoadKlass from primary supertype array.
1176   // Any nested loadklass from loadklass+con must be from the p.s. array.
1177   if (ldk2->is_DecodeNKlass()) {
1178     // Keep ldk2 as DecodeN since it could be used in CmpP below.
1179     if (ldk2->in(1)->Opcode() != Op_LoadNKlass )
1180       return nullptr;
1181   } else if (ldk2->Opcode() != Op_LoadKlass)
1182     return nullptr;
1183 
1184   // Verify that we understand the situation

1144   const TypeKlassPtr* t2 = phase->type(in(2))->isa_klassptr();
1145   if (t2 == nullptr || !t2->klass_is_exact())
1146     return nullptr;
1147   // Get the constant klass we are comparing to.
1148   ciKlass* superklass = t2->exact_klass();
1149 
1150   // Now check for LoadKlass on left.
1151   Node* ldk1 = in(1);
1152   if (ldk1->is_DecodeNKlass()) {
1153     ldk1 = ldk1->in(1);
1154     if (ldk1->Opcode() != Op_LoadNKlass )
1155       return nullptr;
1156   } else if (ldk1->Opcode() != Op_LoadKlass )
1157     return nullptr;
1158   // Take apart the address of the LoadKlass:
1159   Node* adr1 = ldk1->in(MemNode::Address);
1160   intptr_t con2 = 0;
1161   Node* ldk2 = AddPNode::Ideal_base_and_offset(adr1, phase, con2);
1162   if (ldk2 == nullptr)
1163     return nullptr;
1164   if (con2 == Type::klass_offset()) {
1165     // We are inspecting an object's concrete class.
1166     // Short-circuit the check if the query is abstract.
1167     if (superklass->is_interface() ||
1168         superklass->is_abstract()) {
1169       // Make it come out always false:
1170       this->set_req(2, phase->makecon(TypePtr::NULL_PTR));
1171       return this;
1172     }
1173   }
1174 
1175   // Check for a LoadKlass from primary supertype array.
1176   // Any nested loadklass from loadklass+con must be from the p.s. array.
1177   if (ldk2->is_DecodeNKlass()) {
1178     // Keep ldk2 as DecodeN since it could be used in CmpP below.
1179     if (ldk2->in(1)->Opcode() != Op_LoadNKlass )
1180       return nullptr;
1181   } else if (ldk2->Opcode() != Op_LoadKlass)
1182     return nullptr;
1183 
1184   // Verify that we understand the situation
< prev index next >