idea: MethodHandle#invokeTailCall
Charles Oliver Nutter
headius at headius.com
Sat May 11 02:00:51 PDT 2013
On Fri, May 10, 2013 at 7:16 PM, Per Bothner <per at bothner.com> wrote:
> Fail hard is probably the wrong thing to do - except when debugging.
> I think what you want is the default to not fail if it can't pop
> the stack frame, but that there be a VM option to throw an Error
> or even do a VM abort in those case. You'd run the test suite
> in this mode.
>
> That assumes that there is well-specified a minimal set of
> circumstances in which the inlining is done correctly,
> so a compiler or programmer can count on that, and that this
> set is sufficient for low-overhead tail-call elimination.
>
Making such guarantees would have to be explicit in the JVM spec, and then
we're sorta back to requiring a hard tail call guarantee (a hard inlining
guarantee to ensure tail calling happens is just a horse of a different
color).
There is actually a way to force inlining with the newer invokedynamic
impl: a @ForceInline (I forget the actual name) annotation that the
LambdaForm stuff uses internally. Now, if that were exposed as a standard
JVM feature, we could make such a hard guarantee...and then we're back to
having to tag calls or callees with annotations, which was something you
wanted to avoid (why, exactly?).
> I'll be happy when I can run Kawa with --full-tailcalls
> as the default with at most a minor performance degradation.
> If we don't get there, I'll be satisfied if at least it is
> faster (and simpler!) than the current trampoline-based
> implementation.
There's still a tail call patch in the MLVM repo, rotting on the vine. :-)
- Charlie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20130511/68a3b7ac/attachment.html
More information about the mlvm-dev
mailing list