[Truffle] IndirectCallNode vs. another inline cache?

Christian Humer christian.humer at gmail.com
Mon Jul 7 12:51:11 UTC 2014


Hi Stefan,

I was wondering how exactly IndirectCallNode is optimized and what the
> characteristics are compared to using another inline cache.
> Are the performance characteristics supposed to be similar?


No. IndirectCallNode does not implement an inline cache. The inline cache
for calls is guest language specific at the moment.
You can see how such a cache is implemented in the SLInvokeNode in the
simple language.
For DirectCallNodes inlining and splitting may be performed.
For IndirectCallNodes inlining and splitting is not performed. The only
reason why there is an IndirectCallNode at the moment is to support guest
language stack traces.
However we plan to add an implementation of a call inline cache to the
Truffle API.


Also, how are the interactions with tree inlining and splitting, etc?


There are quite a few interactions between them.

*) The inlining heuristic cost function is based on the frequency and node
count of a call. The frequency is more accurate if a split was performed.
Also the node count may change depending on the call-site. (if branches not
taken)
*) The heuristic is also based on the number of callers of a call. If a
CallTarget gets split it is going to get its own counter. (which affects
the inlining decision)
*) The inlining decision is decided per DirectCallNode. This means if a
CallTarget gets split per call-site the split CallTarget gets its own maybe
different inlining decision.
*) If for some reason (like a phase change) the splitting is performed
after the inlining decision was performed. Then the inlining decision gets
invalidated.

Please report to me if you see suspicious behavior.


The JavaDoc isn’t very explicit on that point. And I didn’t really see how
> OptimizedIndirectCallNode is used in the code.


As I already mentioned it is only used to provide guest language stack
traces.
For an example how to use the indirect call node see SLGenericDispatchNode.

Hope this helps.

- Christian Humer


On Sat, Jul 5, 2014 at 6:34 PM, Stefan Marr <java at stefan-marr.de> wrote:

> Hi:
>
> I was wondering how exactly IndirectCallNode is optimized and what the
> characteristics are compared to using another inline cache.
>
> Are the performance characteristics supposed to be similar?
> Also, how are the interactions with tree inlining and splitting, etc?
>
> The JavaDoc isn’t very explicit on that point. And I didn’t really see how
> OptimizedIndirectCallNode is used in the code.
>
> Thanks
> Stefan
>
> --
> Stefan Marr
> INRIA Lille - Nord Europe
> http://stefan-marr.de/research/
>
>
>
>


More information about the graal-dev mailing list