Node specialization for a statically typed language?
Gerard Krol
gerard at gerardkrol.nl
Wed Jul 27 12:50:31 UTC 2016
Thanks Chris and Stefan, for your responses. Amazing to get two good
answers within a few minutes of sending a mail.
Regards,
Gerard
On Wed, Jul 27, 2016 at 2:34 PM, Chris Seaton <chris.seaton at oracle.com>
wrote:
> 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.
>
> Chris
>
> > On 27 Jul 2016, at 13:28, Gerard Krol <gerard at gerardkrol.nl> 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] https://github.com/gerard-/cover
>
>
More information about the graal-dev
mailing list