Node specialization for a statically typed language?

Gerard Krol gerard at gerardkrol.nl
Wed Jul 27 12:28:14 UTC 2016


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] https://github.com/gerard-/cover


More information about the graal-dev mailing list