# HG changeset patch # User Doug Simon # Date 1373648992 -7200 # Node ID 2a4ad6ab345eb59c4b6296246caf1ad3d8704c74 # Parent 70cb17338a70c69a2d63a5eaf773312d408d2cd7 disabled new lowering of checkcast until performance regression is fixed diff -r 70cb17338a70 -r 2a4ad6ab345e graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Fri Jul 12 18:09:39 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Fri Jul 12 19:09:52 2013 +0200 @@ -66,6 +66,10 @@ return forStoreCheck; } + // TODO (ds) remove once performance regression in compiler.sunflow (and other benchmarks) + // caused by new lowering is fixed + private static final boolean useNewLowering = Boolean.getBoolean("graal.checkcast.useNewLowering"); + /** * Lowers a {@link CheckCastNode} to a {@link GuardingPiNode}. That is: * @@ -94,20 +98,24 @@ */ @Override public void lower(LoweringTool tool, LoweringType loweringType) { - InstanceOfNode typeTest = graph().add(new InstanceOfNode(type, object, profile)); - Stamp stamp = StampFactory.declared(type).join(object.stamp()); - ValueNode condition; - if (stamp == null) { - // This is a check cast that will always fail - condition = LogicConstantNode.contradiction(graph()); - stamp = StampFactory.declared(type); - } else if (object.stamp().nonNull()) { - condition = typeTest; + if (useNewLowering) { + InstanceOfNode typeTest = graph().add(new InstanceOfNode(type, object, profile)); + Stamp stamp = StampFactory.declared(type).join(object.stamp()); + ValueNode condition; + if (stamp == null) { + // This is a check cast that will always fail + condition = LogicConstantNode.contradiction(graph()); + stamp = StampFactory.declared(type); + } else if (object.stamp().nonNull()) { + condition = typeTest; + } else { + condition = graph().unique(new LogicDisjunctionNode(graph().unique(new IsNullNode(object)), typeTest)); + } + GuardingPiNode checkedObject = graph().add(new GuardingPiNode(object, condition, false, forStoreCheck ? ArrayStoreException : ClassCastException, InvalidateReprofile, stamp)); + graph().replaceFixedWithFixed(this, checkedObject); } else { - condition = graph().unique(new LogicDisjunctionNode(graph().unique(new IsNullNode(object)), typeTest)); + tool.getRuntime().lower(this, tool); } - GuardingPiNode checkedObject = graph().add(new GuardingPiNode(object, condition, false, forStoreCheck ? ArrayStoreException : ClassCastException, InvalidateReprofile, stamp)); - graph().replaceFixedWithFixed(this, checkedObject); } @Override