diff --git a/benchmark/fib/fib.tra b/benchmark/fib/fib.tra index e93fc0dd..3ccbadc7 100644 --- a/benchmark/fib/fib.tra +++ b/benchmark/fib/fib.tra @@ -6,5 +6,5 @@ sub fib($n) { } } -say(fib(20)); +say(fib(39)); diff --git a/vm.inc b/vm.inc index 800c5c50..3e98b3ae 100644 --- a/vm.inc +++ b/vm.inc @@ -294,12 +294,19 @@ OP_RETURN { ops = fframe->orig_ops; // printf("RETURN :orig: %d, current: %d\n", fframe->top, stack.size()); + while (stack.size() > frame->top) { + stack.pop(); + } + frame_stack->pop_back(); stack.push(retval); break; } else { // printf("THIS IS NOT A FUNCTION FRAME\n"); + while (stack.size() > frame->top) { + stack.pop(); + } frame_stack->pop_back(); } } @@ -313,11 +320,9 @@ OP_ENTER { OP_LEAVE { SharedPtr frame = frame_stack->back(); - /* while (stack.size() > frame->top) { stack.pop(); } - */ frame_stack->pop_back(); }