Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java @ 16151:76895499bc88
Add facility to create JSON dump of AST creation/rewriting
author | Christian Wirth <christian.wirth@oracle.com> |
---|---|
date | Fri, 20 Jun 2014 15:13:16 +0200 |
parents | 915ebb306fcc |
children | 76081918079d |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Wed Jun 18 14:12:06 2014 +0200 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Fri Jun 20 15:13:16 2014 +0200 @@ -31,6 +31,7 @@ import com.oracle.truffle.api.*; import com.oracle.truffle.api.source.*; +import com.oracle.truffle.api.utilities.*; /** * Abstract base class for all Truffle nodes. @@ -58,12 +59,15 @@ } protected Node() { - CompilerAsserts.neverPartOfCompilation(); + this(null); } protected Node(SourceSection sourceSection) { CompilerAsserts.neverPartOfCompilation(); this.sourceSection = sourceSection; + if (TruffleOptions.TraceASTJSON) { + JSONHelper.dumpNewNode(this); + } } /** @@ -169,6 +173,9 @@ } boolean isInserted = newChild.parent == null; newChild.parent = this; + if (TruffleOptions.TraceASTJSON) { + JSONHelper.dumpNewChild(this, newChild); + } newChild.adoptHelper(); if (isInserted) { newChild.onAdopt(); @@ -273,6 +280,9 @@ this.parent.adoptUnadoptedHelper(newNode); } reportReplace(this, newNode, reason); + if (TruffleOptions.TraceASTJSON) { + JSONHelper.dumpReplaceChild(this, newNode, reason); + } onReplace(newNode, reason); }