Node specialization for a statically typed language?

Chris Seaton chris.seaton at
Wed Jul 27 12:34:51 UTC 2016

Yes you can just use AddLong and AddDouble nodes directly. There’s no point to specialisation if you don’t need it. You’ll probably find you do want specialisation for other things - particularly C function pointer calls and C++ virtual calls. There’s an opportunity to beat native compiled C++ there because you can specialise for the concrete classes actually seen at a call site.


> On 27 Jul 2016, at 13:28, Gerard Krol <gerard at> wrote:
> Hi,
> With Cover[1] I'm implementing C/C++, which is statically typed. Currently
> I'm using a single Add node, like SimpleLanguage does, with specializations
> for long and double. Performance is fine, but I'm wondering if this is the
> optimal way. I find I need to add quite a lot of guards to steer Truffle
> towards the correct specialization. There is some info about specialization
> in the Truffle FAQ, but it seems to be geared towards dynamic languages.
> Can't I just emit AddLong and AddDouble nodes? I think it would make the
> code a lot clearer, and save me from debugging code that picks the wrong
> specialization. If the parameters to the node are not correct during parse
> time I can just add a cast node in between.
> Regards,
> Gerard
> [1]

More information about the graal-dev mailing list