< prev index next >

src/hotspot/share/opto/subnode.cpp

Print this page

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

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