How to change Truffle Inlining Policies to accommodate a Metaobject Protocol
Stefan Marr
java at stefan-marr.de
Tue Jul 8 14:06:47 UTC 2014
Hi:
Over the past weeks, I extended TruffleSOM with the implementation of a metaobject protocol. [This concrete one is an ownership-based one, so it is not using metaclasses but metaobjects that relate to base objects.]
Encouraged by the great result I got with RTruffleSOM and meta tracing, I was expecting similarly good results on top of Truffle and Graal. However, so far no luck.
Most likely candidate is the inlining on the tree level.
When looking in IGV at the tree, I see OptimizedDirectCall nodes as leafs.
And, I see some of the meta operations being not split as they would need to be.
In order to address these things, I was experimenting with forcing inlining and splitting of operations related to the metaobject protocol.
One of the concrete stumbling blocks is that the tree explodes. Actually much more than what I would naively expect. Consequently, the recursive tree depth counting leads to stack overflows (-Xss100m as parameter to mx did not help).
Another issue, which I thought I can work around is the logic for recognizing recursion, which does not work in the presence of meta methods. Just imagine a meta handler that is called for every method invocation, it is recognized as recursive while it isn’t really recursive. So, I checked whether it is a meta method in the DefaultInliningPolicy.
Similarly, I check in OptimizedDirectCallNode.shouldSplit() whether it is a method that should always be inlined and indicate it to be split. Unfortunately, this does not yield the desired results.
Now I was wondering whether you already got experience in that direction.
My naive expectation would be that inlining all operations related to the metaobject protocol should be feasible and allow the partial evaluator to reduce _all_ of it to a guard and lower the operations performed on the meta level to normal direct operations.
Any hints how to get there would be highly appreciate.
By the way, a month ago I was already stumbling over an issue, I wasn’t able to sort out yet, where the combination of two meta-programming features did not yield the expected performance [1].
Thanks
Stefan
[1] http://markmail.org/thread/63myxnjfncqe6kri
--
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/
More information about the graal-dev
mailing list