Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java @ 16912:f8998c828bed
Truffle: replaces are now reported to all ReplaceObservers in the node hierarchy.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Sat, 23 Aug 2014 19:31:29 +0200 |
parents | 17f7331dcc4f |
children | e1da729b3e4e |
comparison
equal
deleted
inserted
replaced
16911:ee4fde70df19 | 16912:f8998c828bed |
---|---|
297 } | 297 } |
298 return false; | 298 return false; |
299 } | 299 } |
300 | 300 |
301 private void reportReplace(Node oldNode, Node newNode, CharSequence reason) { | 301 private void reportReplace(Node oldNode, Node newNode, CharSequence reason) { |
302 RootNode rootNode = getRootNode(); | 302 Node node = this; |
303 if (rootNode != null) { | 303 while (node != null) { |
304 CallTarget target = rootNode.getCallTarget(); | 304 if (node instanceof ReplaceObserver) { |
305 if (target instanceof ReplaceObserver) { | 305 ((ReplaceObserver) node).nodeReplaced(oldNode, newNode, reason); |
306 ((ReplaceObserver) target).nodeReplaced(oldNode, newNode, reason); | 306 } else if (node instanceof RootNode) { |
307 } | 307 CallTarget target = ((RootNode) node).getCallTarget(); |
308 if (target instanceof ReplaceObserver) { | |
309 ((ReplaceObserver) target).nodeReplaced(oldNode, newNode, reason); | |
310 } | |
311 } | |
312 node = node.getParent(); | |
308 } | 313 } |
309 if (TruffleOptions.TraceRewrites) { | 314 if (TruffleOptions.TraceRewrites) { |
310 NodeUtil.traceRewrite(this, newNode, reason); | 315 NodeUtil.traceRewrite(this, newNode, reason); |
311 } | 316 } |
312 if (TruffleOptions.TraceASTJSON) { | 317 if (TruffleOptions.TraceASTJSON) { |