protected InstanceOfNode(NodeClass<? extends InstanceOfNode> c, ObjectStamp checkedStamp, ValueNode object, JavaTypeProfile profile, AnchoringNode anchor) { super(c, object); this.checkedStamp = checkedStamp; this.profile = profile; this.anchor = anchor; assert (profile == null) || (anchor != null) : "profiles must be anchored"; assert checkedStamp != null; assert type() != null; }
if (instanceOfA.getValue() == instanceOfB.getValue() && !instanceOfA.type().getType().isInterface() && !instanceOfB.type().getType().isInterface() && !instanceOfA.type().getType().isAssignableFrom(instanceOfB.type().getType()) && !instanceOfB.type().getType().isAssignableFrom(instanceOfA.type().getType())) { debug.log("Can swap instanceof for types %s and %s", instanceOfA.type(), instanceOfB.type()); return true;
@Override public void lower(FloatingNode node, LoweringTool tool) { InstanceOfNode instanceOfNode = (InstanceOfNode) node; if (tool.getLoweringStage() == LoweringTool.StandardLoweringStage.HIGH_TIER) { if (instanceOfNode.allowsNull()) { StructuredGraph graph = instanceOfNode.graph(); ValueNode object = instanceOfNode.getValue(); LogicNode newTypeCheck = graph.addOrUniqueWithInputs(InstanceOfNode.create(instanceOfNode.type(), object, instanceOfNode.profile(), instanceOfNode.getAnchor())); LogicNode newNode = LogicNode.or(graph.unique(IsNullNode.create(object)), newTypeCheck, GraalDirectives.UNLIKELY_PROBABILITY); instanceOfNode.replaceAndDelete(newNode); } return; } VMError.guarantee(!instanceOfNode.allowsNull(), "must be lowered before"); super.lower(node, tool); }
if (n instanceof InstanceOfNode) { InstanceOfNode node = (InstanceOfNode) n; AnalysisType type = (AnalysisType) node.type().getType(); type.registerAsInTypeCheck();
TypeCheckHints hintInfo = new TypeCheckHints(instanceOf.type(), profile, assumptions, TypeCheckMinProfileHitProbability.getValue(localOptions), TypeCheckMaxHints.getValue(localOptions)); final HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) instanceOf.type().getType(); ConstantNode hub = ConstantNode.forConstant(KlassPointerStamp.klassNonNull(), type.klass(), providers.getMetaAccess(), instanceOf.graph());
@Override protected Arguments makeArguments(InstanceOfUsageReplacer replacer, LoweringTool tool) { InstanceOfNode node = (InstanceOfNode) replacer.instanceOf; TypeReference typeReference = node.type(); SharedType type = (SharedType) typeReference.getType(); int fromTypeID = type.getInstanceOfFromTypeID();
if (instanceOfNode.allowsNull()) { ValueNode object = instanceOfNode.getValue(); LogicNode newTypeCheck = graph.addOrUniqueWithInputs(InstanceOfNode.create(instanceOfNode.type(), object, instanceOfNode.profile(), instanceOfNode.getAnchor())); LogicNode newNode = LogicNode.or(graph.unique(IsNullNode.create(object)), newTypeCheck, GraalDirectives.UNLIKELY_PROBABILITY); instanceOfNode.replaceAndDelete(newNode);
TypeReference typeRef = inst.type(); value.setStamp(new ObjectStamp(typeRef.getType(), typeRef.isExact(), !inst.allowsNull(), false)); } else {