JIT: enable implicit tail calls from inlined code (#9405)
authorAndy Ayers <andya@microsoft.com>
Fri, 10 Feb 2017 18:30:00 +0000 (10:30 -0800)
committerGitHub <noreply@github.com>
Fri, 10 Feb 2017 18:30:00 +0000 (10:30 -0800)
commit1a8cb674664cf2eefdc124a0b2c91687814c7901
treebe655e89aedc4f7c9ffe57730ce9affec31ca23f
parent16ecaf1bddfae2285c1f035f56fe86a7452e208e
JIT: enable implicit tail calls from inlined code (#9405)

Inlines of calls from implicit tail call sites should allow recognition
of inlinee implicit tail call sites.

The jit recognizes implicit tail call sites during importation,
but the inlinee compiler instance did not have compTailCallOpt set
and so never recognized these instances. Fix this and update the logic
to detect the transitively implicit tail calls.

Now that these sites are recognized, morph needs a fix to tunnel through
repeated casts for tail calls, since each level of inlining might add a
cast. All these casts should be identical.

Note under R2R tail calls are not yet recognized (see ZapInfo::canTailCall).

Enable only under FEATURE_TAILCALL_OPT_SHARED_RETURN since the
inline tail call sites are not likely to be in BBJ_RETURN blocks.

Closes #9349.
src/jit/compiler.cpp
src/jit/importer.cpp
src/jit/morph.cpp