Skip to content

Commit

Permalink
store bp in local variable
Browse files Browse the repository at this point in the history
  • Loading branch information
p7g committed Jul 28, 2024
1 parent c56a798 commit e794602
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ int cb_eval(struct cb_vm_state *state, size_t pc, struct cb_frame *frame)
cb_instruction *code = state->bytecode->code;
struct cb_value *stack_pointer;
state->frame = frame;
size_t bp = frame->bp;

check_stack(state, frame);
stack_pointer = state->stack_top;
Expand Down Expand Up @@ -275,7 +276,7 @@ int cb_eval(struct cb_vm_state *state, size_t pc, struct cb_frame *frame)
})
#define READ_SIZE_T() (NEXT())
#define TOP() (stack_pointer[-1])
#define LOCAL_IDX(N) (frame->bp + 1 + (N))
#define LOCAL_IDX(N) (bp + 1 + (N))
#define LOCAL(N) (state->stack[LOCAL_IDX(N)])
#define REPLACE(N, VAL) (state->stack[(N)] = (VAL))
#define GLOBALS() (frame->module->global_scope)
Expand Down

0 comments on commit e794602

Please sign in to comment.