Skip to content

Commit

Permalink
clean up stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
tokuhirom committed Feb 16, 2012
1 parent 6bd706d commit a798020
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion benchmark/fib/fib.tra
Expand Up @@ -6,5 +6,5 @@ sub fib($n) {
}
}

say(fib(20));
say(fib(39));

9 changes: 7 additions & 2 deletions vm.inc
Expand Up @@ -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();
}
}
Expand All @@ -313,11 +320,9 @@ OP_ENTER {

OP_LEAVE {
SharedPtr<LexicalVarsFrame> frame = frame_stack->back();
/*
while (stack.size() > frame->top) {
stack.pop();
}
*/
frame_stack->pop_back();
}

Expand Down

0 comments on commit a798020

Please sign in to comment.