From cf2882c2e754f49c46ce2ca12c3ca07e4cabc459 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Wed, 12 Nov 2025 00:32:15 +0100 Subject: Fix prev_op Assigning prev_op inside nwp_execute defeated the purpose because this function is meant to start the state machine for the given instruction. In other words, inspecting prev_op would in fact return the current opcode, instead of the previous opcode. --- src/interp/routines/execute.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/interp/routines/execute.c') diff --git a/src/interp/routines/execute.c b/src/interp/routines/execute.c index 49711ae..fe1e8d7 100644 --- a/src/interp/routines/execute.c +++ b/src/interp/routines/execute.c @@ -17,12 +17,13 @@ static enum nw_state execute(struct nw_interp *const i) { struct nw_i_sm_b *const b = &i->sm.bytecode; + const unsigned char op = b->op; #ifdef NW_LOG - nwp_log("opcode: %s, pc=%#lx\n", nwp_op_tostr(b->op), b->pc); + nwp_log("opcode: %s, pc=%#lx\n", nwp_op_tostr(op), b->pc); #endif + i->fr.op = op; b->f(i); - i->fr.prev_op = b->op; return NW_AGAIN; } -- cgit v1.2.3