Improve TCO

Instead of checking for self-recursion check that the thing we're
calling is a function and not a closure, therefore the new frame will
have the same env as the current frame.
This commit is contained in:
Nicolas Williams committed 2014-06-23 19:59:00 -05:00
1 parent 4b7c701fdd
commit beb0d081bb
1 file changed
+1 -1
+1 -1
View File
@@ -657,7 +657,7 @@ jv jq_next(jq_state *jq) {
uint16_t* retaddr;
struct frame* new_frame;
struct closure cl = make_closure(jq, pc);
if (nclosures == 0 && *(pc + 2) == RET && frame_current(jq)->bc == cl.bc) {
if (nclosures == 0 && *(pc + 2) == RET && *pc == 1) {
// TCO
retaddr = frame_current(jq)->retaddr;
stack_ptr retdata = frame_current(jq)->retdata;