Mercurial > hg > truffle
diff graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/controlflow/SLBlockNode.java @ 13836:64c77f0577bb
More documentation and improvements of Simple Language
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Thu, 30 Jan 2014 17:53:27 -0800 |
parents | b16ec83edc73 |
children | afd6fa5e8229 |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/controlflow/SLBlockNode.java Thu Jan 30 17:52:24 2014 -0800 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/nodes/controlflow/SLBlockNode.java Thu Jan 30 17:53:27 2014 -0800 @@ -26,15 +26,32 @@ import com.oracle.truffle.api.nodes.*; import com.oracle.truffle.sl.nodes.*; +/** + * A statement node that just executes a list of other statements. + */ @NodeInfo(shortName = "block") public class SLBlockNode extends SLStatementNode { + /** + * The array of child nodes. The annotation {@link com.oracle.truffle.api.nodes.Node.Children + * Children} informs Truffle that the field contains multiple children. It is a Truffle + * requirement that the field is {@code final} and an array of nodes. + */ @Children private final SLStatementNode[] bodyNodes; public SLBlockNode(SLStatementNode[] bodyNodes) { + /* + * It is a Truffle requirement to call adoptChildren(), which performs all the necessary + * steps to add the new children to the node tree. + */ this.bodyNodes = adoptChildren(bodyNodes); } + /** + * Execute all child statements. The annotation {@link ExplodeLoop} triggers full unrolling of + * the loop during compilation. This allows the {@link SLStatementNode#executeVoid} method of + * all children to be inlined. + */ @Override @ExplodeLoop public void executeVoid(VirtualFrame frame) {