|
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.
I suggest you test it. Lightning 2.0.6 should be
released shortly, and will have the feature described
above.
[Prev in Thread] | Current Thread | [Next in Thread] |