Mercurial > hg > truffle
changeset 11944:506d4520435d
Do not emit code for constants in virtual state.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 09 Oct 2013 17:26:29 +0200 |
parents | 0fa39f034839 |
children | 1fee8d3e99f6 |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java |
diffstat | 1 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Tue Oct 08 23:14:53 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java Wed Oct 09 17:26:29 2013 +0200 @@ -26,10 +26,10 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; -import com.oracle.graal.graph.iterators.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; +import com.oracle.graal.nodes.virtual.*; /** * The {@code ConstantNode} represents a constant such as an integer value, long, float, object @@ -57,15 +57,24 @@ @Override public void generate(LIRGeneratorTool gen) { - if (gen.canInlineConstant(value) || onlyUsedInFrameState()) { + if (gen.canInlineConstant(value) || onlyUsedInVirtualState()) { gen.setResult(this, value); } else { gen.setResult(this, gen.emitMove(value)); } } - private boolean onlyUsedInFrameState() { - return usages().filter(NodePredicates.isNotA(FrameState.class)).isEmpty(); + private boolean onlyUsedInVirtualState() { + for (Node n : this.usages()) { + if (n instanceof FrameState) { + // Only frame state usages. + } else if (n instanceof VirtualState) { + // Only virtual usage. + } else { + return false; + } + } + return true; } public static ConstantNode forConstant(Constant constant, MetaAccessProvider runtime, Graph graph) {