General Steps for Optimizing Truffle-based Languages?

Stefan Marr java at stefan-marr.de
Tue May 6 17:35:01 UTC 2014


Hi Chris:

On 06 May 2014, at 19:19, Chris Seaton <chris at chrisseaton.com> wrote:

> In the mean time, about warmup. Your while loops are a method on a block that calls itself (self restart), right?
They are specialized nodes, no method calls.

> Is that tail recursion then? I don’t see how you're not blowing the stack.
No, it’s very much the same as your WhileNode or ZipPy’s loops.
Even simpler, because there isn’t anything like break or continue supported.
https://github.com/SOM-st/TruffleSOM/blob/master/src/som/interpreter/nodes/specialized/WhileWithStaticBlocksNode.java#L83

And, the loops are fast in microbenchmarks. Would be surprised if they would have major issues.

> But my point was - however you are implementing loops, is Truffle seeing the loop count, or does only the body of the loop get optimised? In my while loop in Ruby (while loops are like in C in Ruby - not method calls) I report the number of iterations. If I didn't do that, warmup of whatever contains the loop would take a long time. Maybe this doesn’t apply to SOM as you have no primitive loop operation.

According to blame, that’s properly done since Christmas:
  https://github.com/SOM-st/TruffleSOM/blob/master/src/som/interpreter/nodes/specialized/WhileWithStaticBlocksNode.java#L101

Thanks for trying, but I fear, and hope, that’s nothing superficial.
Beside what I don’t understand, I think, I did my homework. That’s why I am running out of ideas again…

Also another classic, which was an issue until recently: activation of lambdas/blocks, but even there I am caching the call target properly. If I look at the Truffle graphs in the viewer, everything gets properly inlined and the terminal nodes are all trivial operations, no method calls. So, the ‘compilation unit’ should be complete and provide all the necessary information to the optimizer. I guess, something is confusing it. But since I can’t make sense of what I see in the graph viewer, I have no idea what’s going on.

Thanks
Stefan

-- 
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/





More information about the graal-dev mailing list