From e5ada35d9d1de27b44e0c8344b7ce1f9c149a421 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Tue, 15 Oct 2013 19:15:51 +0900 Subject: [PATCH] directly change pic->sp via PUSH/POP macros --- src/vm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/vm.c b/src/vm.c index 4195d4a0..bd90d252 100644 --- a/src/vm.c +++ b/src/vm.c @@ -198,18 +198,16 @@ pic_codegen(pic_state *pic, pic_value obj, struct pic_env *env) #define JUMP break #define VM_LOOP_END } } -#define PUSH(v) (*++sp = (v)) -#define POP() (*sp--) +#define PUSH(v) do { pic_value v__ = (v); *++pic->sp = v__; } while (0) +#define POP() (*pic->sp--) pic_value pic_run(pic_state *pic, struct pic_proc *proc, pic_value args) { struct pic_code *pc; - pic_value *sp; int ai = pic_gc_arena_preserve(pic); pc = proc->u.irep->code; - sp = pic->sp; VM_LOOP { CASE(OP_PUSHNIL) {