Re: frames and tail calls

  • From: Mike Pall <mike-1404@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 9 Apr 2014 23:52:03 +0200

Ronan Collobert wrote:
> if blahblah then
>   — do something
> else
>    return dosomethingelse(…)
> end
> 
> A "luajit -jv” tells me that I got a "NYI: bytecode 71…”, at the line of the 
> tail call.

Assuming you're using 2.1, the 71 is a BC_VARG it complains about,
not the BC_CALLT.

$ cat >bcname.lua <<'END'
local x = tonumber(arg[1])
print(string.sub(require("jit.vmdef").bcnames, x*6+1, x*6+6))
END

$ luajit-2.1 bcname.lua 71
VARG

So, before you ask: Vararg uses can be compiled only when ...
1) their definition is on the same trace, or
2) when the number of results is fixed, or
3) in special constructs, such as y = select(x, ...).

--Mike

Other related posts: