1161 const TypeKlassPtr* t2 = phase->type(in(2))->isa_klassptr();
1162 if (t2 == nullptr || !t2->klass_is_exact())
1163 return nullptr;
1164 // Get the constant klass we are comparing to.
1165 ciKlass* superklass = t2->exact_klass();
1166
1167 // Now check for LoadKlass on left.
1168 Node* ldk1 = in(1);
1169 if (ldk1->is_DecodeNKlass()) {
1170 ldk1 = ldk1->in(1);
1171 if (ldk1->Opcode() != Op_LoadNKlass )
1172 return nullptr;
1173 } else if (ldk1->Opcode() != Op_LoadKlass )
1174 return nullptr;
1175 // Take apart the address of the LoadKlass:
1176 Node* adr1 = ldk1->in(MemNode::Address);
1177 intptr_t con2 = 0;
1178 Node* ldk2 = AddPNode::Ideal_base_and_offset(adr1, phase, con2);
1179 if (ldk2 == nullptr)
1180 return nullptr;
1181 if (con2 == oopDesc::klass_offset_in_bytes()) {
1182 // We are inspecting an object's concrete class.
1183 // Short-circuit the check if the query is abstract.
1184 if (superklass->is_interface() ||
1185 superklass->is_abstract()) {
1186 // Make it come out always false:
1187 this->set_req(2, phase->makecon(TypePtr::NULL_PTR));
1188 return this;
1189 }
1190 }
1191
1192 // Check for a LoadKlass from primary supertype array.
1193 // Any nested loadklass from loadklass+con must be from the p.s. array.
1194 if (ldk2->is_DecodeNKlass()) {
1195 // Keep ldk2 as DecodeN since it could be used in CmpP below.
1196 if (ldk2->in(1)->Opcode() != Op_LoadNKlass )
1197 return nullptr;
1198 } else if (ldk2->Opcode() != Op_LoadKlass)
1199 return nullptr;
1200
1201 // Verify that we understand the situation
|
1161 const TypeKlassPtr* t2 = phase->type(in(2))->isa_klassptr();
1162 if (t2 == nullptr || !t2->klass_is_exact())
1163 return nullptr;
1164 // Get the constant klass we are comparing to.
1165 ciKlass* superklass = t2->exact_klass();
1166
1167 // Now check for LoadKlass on left.
1168 Node* ldk1 = in(1);
1169 if (ldk1->is_DecodeNKlass()) {
1170 ldk1 = ldk1->in(1);
1171 if (ldk1->Opcode() != Op_LoadNKlass )
1172 return nullptr;
1173 } else if (ldk1->Opcode() != Op_LoadKlass )
1174 return nullptr;
1175 // Take apart the address of the LoadKlass:
1176 Node* adr1 = ldk1->in(MemNode::Address);
1177 intptr_t con2 = 0;
1178 Node* ldk2 = AddPNode::Ideal_base_and_offset(adr1, phase, con2);
1179 if (ldk2 == nullptr)
1180 return nullptr;
1181 if (con2 == Type::klass_offset()) {
1182 // We are inspecting an object's concrete class.
1183 // Short-circuit the check if the query is abstract.
1184 if (superklass->is_interface() ||
1185 superklass->is_abstract()) {
1186 // Make it come out always false:
1187 this->set_req(2, phase->makecon(TypePtr::NULL_PTR));
1188 return this;
1189 }
1190 }
1191
1192 // Check for a LoadKlass from primary supertype array.
1193 // Any nested loadklass from loadklass+con must be from the p.s. array.
1194 if (ldk2->is_DecodeNKlass()) {
1195 // Keep ldk2 as DecodeN since it could be used in CmpP below.
1196 if (ldk2->in(1)->Opcode() != Op_LoadNKlass )
1197 return nullptr;
1198 } else if (ldk2->Opcode() != Op_LoadKlass)
1199 return nullptr;
1200
1201 // Verify that we understand the situation
|