@Override public TriState implies(boolean thisNegated, LogicNode other) { if (other instanceof InstanceOfNode) { InstanceOfNode instanceOfNode = (InstanceOfNode) other; if (instanceOfNode.getValue() == getValue()) { if (thisNegated) { // !X => Y if (this.getCheckedStamp().meet(instanceOfNode.getCheckedStamp()).equals(this.getCheckedStamp())) { return TriState.get(false); } } else { // X => Y if (instanceOfNode.getCheckedStamp().meet(this.getCheckedStamp()).equals(instanceOfNode.getCheckedStamp())) { return TriState.get(true); } } } } return super.implies(thisNegated, other); } }
@Override public void virtualize(VirtualizerTool tool) { ValueNode alias = tool.getAlias(getValue()); TriState fold = tryFold(alias.stamp(NodeView.DEFAULT)); if (fold != TriState.UNKNOWN) { tool.replaceWithValue(LogicConstantNode.forBoolean(fold.isTrue(), graph())); } }
@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); }
args.add("object", node.getValue()); args.add("trueValue", replacer.trueValue); args.add("falseValue", replacer.falseValue); args.add("object", node.getValue()); args.add("trueValue", replacer.trueValue); args.add("falseValue", replacer.falseValue); args.add("object", node.getValue()); args.add("trueValue", replacer.trueValue); args.add("falseValue", replacer.falseValue); args.add("object", node.getValue()); args.add("trueValue", replacer.trueValue); args.add("falseValue", replacer.falseValue);
ObjectStamp newStamp = (ObjectStamp) strengthen(node.getCheckedStamp()); if (newStamp != null) { node.replaceAndDelete(graph.addOrUniqueWithInputs(InstanceOfNode.createHelper(newStamp, node.getValue(), node.profile(), node.getAnchor())));
ValueNode object = instanceOf.getValue(); TypeReference typeReference = instanceOf.type(); AnalysisType type = (AnalysisType) instanceOf.type().getType();
if (b instanceof IsNullNode) { IsNullNode isNullNode = (IsNullNode) b; if (isNullNode.getValue() == instanceOfA.getValue()) { debug.log("Can swap instanceof and isnull if"); return true; 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())) {
if (n instanceof InstanceOfNode) { InstanceOfNode instanceOf = (InstanceOfNode) n; markFieldsUsedInComparison(instanceOf.getValue()); } else if (n instanceof ObjectEqualsNode) { ObjectEqualsNode compareNode = (ObjectEqualsNode) n;
if (replacer.instanceOf instanceof InstanceOfNode) { InstanceOfNode instanceOf = (InstanceOfNode) replacer.instanceOf; ValueNode object = instanceOf.getValue(); Assumptions assumptions = instanceOf.graph().getAssumptions();
} else { 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);