Mercurial > hg > graal-compiler
changeset 10729:2a4ad6ab345e
disabled new lowering of checkcast until performance regression is fixed
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 12 Jul 2013 19:09:52 +0200 |
parents | 70cb17338a70 |
children | f1904749e4fe 88992c295d47 |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java |
diffstat | 1 files changed, 20 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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