Mercurial > hg > graal-compiler
diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/CallNode.java @ 13811:641f22b1c6b8
Truffle: further fixes to the new CallNode.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 29 Jan 2014 20:49:09 +0100 |
parents | 3840d61e0e68 |
children | e86d32f4803f |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/CallNode.java Wed Jan 29 12:19:03 2014 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/CallNode.java Wed Jan 29 20:49:09 2014 +0100 @@ -85,6 +85,16 @@ public abstract boolean inline(); /** + * Returns the inlined root node if the call node was inlined. If the {@link CallNode} was not + * inlined <code>null</code> is returned. + * + * @return the inlined root node returned by {@link RootNode#inline()} + */ + public RootNode getInlinedRoot() { + return null; + } + + /** * Creates a new {@link CallNode} using a {@link CallTarget}. * * @param target the {@link CallTarget} to call @@ -116,7 +126,6 @@ ((InlinableCallNode) callNode).resetCallCount(); return; } - throw new UnsupportedOperationException(); } private static boolean isInlinable(CallTarget callTarget) { @@ -126,6 +135,11 @@ return false; } + @Override + public String toString() { + return getParent() != null ? getParent().toString() : super.toString(); + } + static final class DefaultCallNode extends CallNode { public DefaultCallNode(CallTarget target) { @@ -174,13 +188,14 @@ public boolean inline() { DefaultCallTarget defaultTarget = (DefaultCallTarget) getCallTarget(); RootNode originalRootNode = defaultTarget.getRootNode(); - boolean inlined = false; if (originalRootNode.isInlinable()) { RootNode inlinedRootNode = defaultTarget.getRootNode().inline(); + inlinedRootNode.setCallTarget(callTarget); + inlinedRootNode.setParentInlinedCall(this); replace(new InlinedCallNode(defaultTarget, inlinedRootNode)); - inlined = true; + return true; } - return inlined; + return false; } @Override @@ -225,6 +240,11 @@ } @Override + public RootNode getInlinedRoot() { + return inlinedRoot; + } + + @Override public boolean inline() { return false; }