frames and tail calls

  • From: Ronan Collobert <ronan@xxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 9 Apr 2014 16:03:46 +0200

Hi,

In some quite large piece of code, I am doing some (possibly nested) tail calls 
of the form:

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.

This did not surprise me too much, considering http://wiki.luajit.org/NYI:

   "Tailcall. Some tailcalls to frames lower than the starting frame of the 
trace are not compiled.”

However, in an attempt to optimize this, I could not reproduce this NYI on a 
simpler (even nested) toy test case.

- Is there someone who knows by any chance which tailcalls will not get 
compiled? (I am not sure to what the “some” refers in the above explanation).
- In the end, I am not even sure what a “frame” means. I am certainly not an 
expert in trace compilers. Can someone explain this to me in few words (or 
where can I find documentation for this)?

Thanks for your help,
Ronan.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Other related posts: