lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Lightning] Are tail calls possible in GNU lightning?


From: Marc Nieper-Wißkirchen
Subject: Re: [Lightning] Are tail calls possible in GNU lightning?
Date: Sat, 10 Jan 2015 15:11:48 +0100


  Your specific example would be better done using
jit_frame and jit_tramp. These calls are not in a
released lightning version, but were added for
GNU Smalltalk. Examples:

http://git.savannah.gnu.org/cgit/lightning.git/tree/check/tramp.tst
http://git.savannah.gnu.org/cgit/lightning.git/tree/check/ctramp.c

Basically, "jit_frame(int size)" creates a stack frame
saving all callee save registers, and allocates at
least "size" bytes, that have as a good value, 8*
maximum number of arguments used in a C call.

After that, trampolines, but work as tail call in the
way you need it,  created with "jit_tramp(int size)"
are like a normal function body, just that while it
needs calling jit_prolog and jit_epilog, it does not
generate any code, so, it is very "light" and allow
jumping from code generated by one jit_context_t
to another.

That's exactly what I need! Thanks for pointing out your new work. In fact, the generated code is very light.
 

I suggest you test it. Lightning 2.0.6 should be
released shortly, and will have the feature described
above.

I checked out the git version and it worked instantly. I am also looking forward for the next proper release.
 
Thanks again for your great piece of software!

Best,

Marc

reply via email to

[Prev in Thread] Current Thread [Next in Thread]