FW: Difference @NodeChild and Node. at Child annotations

Christian Humer christian.humer at gmail.com
Tue Mar 31 14:35:38 UTC 2015


Missed to add graal-dev in cc.

Hi Renze,

The @Child annotation is part of the Truffle API. It marks a field to contain a child node. This annotation is useful for the language agnostic mechanism to traverse the AST and to replace Nodes in the AST.

On top of the Truffle API there is Truffle DSL[1]. Truffle DSL is an embedded domain specific language built on top of the Truffle API to simplify the development of certain patterns of Truffle interpreters. Internally it generates Java source code that uses the Truffle API. Nodes declared solely with the Truffle API and nodes declared using the Truffle DSL are mixed in most of the guest language implementations. The @NodeChild annotation is part of Truffle DSL and represents a child node declaration there. As opposed to the @Child annotation it is used on Java classes instead of Java fields and provides some additional meta-data for the DSL. Internally the DSL generates Java fields annotated with the @Child annotation. 

Most of the reasons why this separation was necessary recently disappeared. So it's possible that we will see these two concepts converge in the future.

I hope this answers your question. 

- Christian Humer

[1] http://lafo.ssw.uni-linz.ac.at/papers/2014_GPCE_TruffleDSL.pdf


-----Original Message-----
From: graal-dev [mailto:graal-dev-bounces at openjdk.java.net] On Behalf Of Renze Torensma
Sent: Dienstag, 31. März 2015 12:29
To: graal-dev at openjdk.java.net
Subject: Difference @NodeChild and Node. at Child annotations

Hi,

I was wondering what’s the difference between the @NodeChild annotation used for example in the SLBinaryNode and the @Child annotation used for example in the SLRootNode?

Renze




More information about the graal-dev mailing list