Mercurial > hg > truffle
diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java @ 10862:8c570011b86f
Truffle: when a node is replaced, notify optimized call target and delay compilation.
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Tue, 23 Jul 2013 19:05:08 +0200 |
parents | e87d56a51047 |
children | 494b818b527c |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Tue Jul 23 18:23:52 2013 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Tue Jul 23 19:05:08 2013 +0200 @@ -211,6 +211,12 @@ * @param reason the reason the replace supplied */ protected void onReplace(Node newNode, String reason) { + RootNode rootNode = NodeUtil.findParent(this, RootNode.class); + if (rootNode != null) { + if (rootNode.getCallTarget() instanceof ReplaceObserver) { + ((ReplaceObserver) rootNode.getCallTarget()).nodeReplaced(); + } + } if (TruffleOptions.TraceRewrites) { Class<? extends Node> from = getClass(); Class<? extends Node> to = newNode.getClass();