Skip to content

Commit

Permalink
Move MVM_panic to 'default:' to help debug when op is not existed.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuomingliang committed Sep 6, 2013
1 parent 5dc8527 commit d7c705b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define GET_N32(pc, idx) *((MVMnum32 *)(pc + idx))
#define GET_N64(pc, idx) *((MVMnum64 *)(pc + idx))

#define NEXT_OP (cur_op += 2, *(MVMuint16 *)(cur_op - 2))
#define NEXT_OP (op = *(MVMuint16 *)(cur_op), cur_op += 2, op)

#if MVM_CGOTO
#define DISPATCH(op)
Expand Down Expand Up @@ -65,6 +65,8 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex

/* Enter runloop. */
runloop: {
MVMuint16 op;

#if MVM_TRACING
if (tracing_enabled) {
char *trace_line = MVM_exception_backtrace_line(tc, tc->cur_frame, 0);
Expand Down Expand Up @@ -3331,10 +3333,13 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
cur_op += 2;
goto NEXT;
}
#if !MVM_CGOTO
default:
MVM_panic(MVM_exitcode_invalidopcode, "Invalid opcode executed (corrupt bytecode stream?) opcode %u", *(cur_op-2));
#endif
}
}

MVM_panic(MVM_exitcode_invalidopcode, "Invalid opcode executed (corrupt bytecode stream?) opcode %u", *(cur_op-2));
return_label:
/* Need to clear these pointer pointers since they may be rooted
* by some GC procedure. */
Expand Down

0 comments on commit d7c705b

Please sign in to comment.