Frame escapes and inline failed, reason recursion

Stefan Marr java at stefan-marr.de
Mon Jul 21 11:36:30 UTC 2014


Hi Stefan:

On 21 Jul 2014, at 13:19, Stefan Fehrenbach <stefan.fehrenbach at gmail.com> wrote:

> My question is about this message "inline failed", where it says
> "reason recursion". Is that a problem?

In my experience, that becomes only relevant after you fixed the escaping frames.

> I think I avoided my mistakes from last time. I broke cycles in the
> grammar by using function calls to form a proper AST. I tried to not
> refer to AST nodes directly, but make the trampoline (Parser and
> ParsingState) use CallTargets. I have non-final @Child annotated
> fields.

This sounds strange to me. Are you using Truffle to implement a fast parser?
Or are you implementing the interpretation of the parser’s result.
The usual thing is the later.
Another thing is that I haven’t seen a trampoline-based interpreter based on Truffle yet.
Instead, as far as I know, they are all fully recursive and rely on Graal to make that work efficiently.


> It just occurs to me, that my last frame escapes problem went away
> with an @ExplodeLoop annotation. Is the problem the loop in
> ParsingState.push [3]?
> How do I fix it? You use @ExplodeLoop to loop over children, right?
> The "results" are not part of the AST and they might not even be
> compilation final…

Every time I saw a new escaping frame issue it was because I introduced a loop that was not unrolled.
So, my guess would be that you got your root cause right there.

It is important that the loop bounds are going to be fixed at run time, so, I don’t know whether that is going to be the case here with your `results` set.
It also looks like you are not strictly implementing your interpretation as part of the AST.

Such loops should be in execute*() methods of Truffle nodes, and depend (in terms of number of iterations) solely on child nodes and known constant values, so that the loop unrolling triggered by @ExplodeLoop can do its magic.


Hope that helps a little
Stefan



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





More information about the graal-dev mailing list