CallTarget and DirectCallNode in Truffle Languages

Benoit Daloze eregontp at
Thu Jan 19 12:34:04 UTC 2017


DirectCallNode#cloneCallTarget() allows to clone/split a CallTarget so that
its AST can specialize for a given call site.
In Ruby, we force this mechanism for blocks so that the block is
specialized to how a method calls the block.
It can also happens automatically if Truffle decides so when using a


On Thu, Jan 19, 2017 at 12:08 PM, Juan Fumero <juan.fumero at> wrote:

> Hi guys,
>    I am working with JRuby and R Truffle implementations. I have a few
> questions concerning the callTarget and the directCallNode, most
> probably I do not fully understand concepts here.
> In R, I directly execute the function as follow:
> function.getTarget().call(args);
> Running with Graal, the callTarget will be an optimizedCallTarget.
> Till here, everything ok,
> In JRuby the callTarget is not directly executed and instead, a
> directCallNode is used.
>, args);
> The directCallNode encapsulates the callTarget. However, it is not the
> "original" callTarget I see in the signature in CallBlockNode#callBlock
> (cachedCallTarget).
> This provokes I see a different object optimizedCallTarget when I
> compile ( and I was expecting the same in my implementation).
> The difference is that, directCallNode.getCallTarget() is different to
> directCallNode.getCurrentCallTarget().
> 1. Why two different strategies for calling a function (R vs JRuby) ?
> 2. Should not be the same callTarget anyway?
> Thanks a lot
> Regards
> Juan
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.

More information about the graal-dev mailing list