Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java @ 13983:f46cab39a9a2
Truffle: Updated inlining API. Pushed inlining implementation to the Truffle runtime.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Thu, 20 Feb 2014 01:21:49 +0100 |
parents | d6b340b757a2 |
children | 989f58d6a0ca |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Wed Feb 19 00:39:44 2014 -0800 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Thu Feb 20 01:21:49 2014 +0100 @@ -185,7 +185,7 @@ if (!NodeUtil.replaceChild(this.parent, this, newNode)) { fixupTree(); } - reportReplace(); + reportReplace(this, newNode, reason); return newNode; } @@ -245,11 +245,11 @@ return false; } - private void reportReplace() { - RootNode rootNode = NodeUtil.findOutermostRootNode(this); - if (rootNode != null) { - if (rootNode.getCallTarget() instanceof ReplaceObserver) { - ((ReplaceObserver) rootNode.getCallTarget()).nodeReplaced(); + private void reportReplace(Node oldNode, Node newNode, String reason) { + Collection<CallTarget> targets = NodeUtil.findOutermostCallTargets(this); + for (CallTarget target : targets) { + if (target instanceof ReplaceObserver) { + ((ReplaceObserver) target).nodeReplaced(oldNode, newNode, reason); } } } @@ -395,7 +395,7 @@ * * @return the {@link RootNode} or {@code null} if there is none. */ - protected final RootNode getRootNode() { + public final RootNode getRootNode() { Node rootNode = this; while (rootNode.getParent() != null) { assert !(rootNode instanceof RootNode) : "root node must not have a parent";