summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-09-03 19:22:30 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 18:20:16 +0900
commitfe1ad37bfb90588a88dcfb009874b140036cbdb1 (patch)
tree42ec71bf5c9b2f5cc9ea206a7e01dbe56db4d3ed
parent9e842b3a75ced03488411e0e2a993dce40bd1e01 (diff)
downloadmruby-fe1ad37bfb90588a88dcfb009874b140036cbdb1.tar.gz
mruby-fe1ad37bfb90588a88dcfb009874b140036cbdb1.zip
Use `goto` to avoid problems with `DIRECT_THREADED`.
You can now use `NEXT` within `switch` statement like 7c087eb.
-rw-r--r--src/vm.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/vm.c b/src/vm.c
index 7f79db32b..4e232c1fc 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -966,9 +966,9 @@ prepare_tagged_break(mrb_state *mrb, uint32_t tag, const struct RProc *proc, mrb
#define INIT_DISPATCH for (;;) { insn = BYTECODE_DECODER(*pc); CODE_FETCH_HOOK(mrb, irep, pc, regs); switch (insn) {
#define CASE(insn,ops) case insn: pc0=pc++; FETCH_ ## ops (); pc_save = pc;
-#define NEXT break
+#define NEXT goto L_END_DISPATCH
#define JUMP NEXT
-#define END_DISPATCH }}
+#define END_DISPATCH L_END_DISPATCH:;}}
#else
@@ -2324,7 +2324,7 @@ RETRY_TRY_BLOCK:
mrb_int div = mrb_num_div_int(mrb, x, y);
SET_INT_VALUE(mrb, regs[a], div);
}
- goto L_DIV_OUT;
+ NEXT;
#ifndef MRB_NO_FLOAT
case TYPES2(MRB_TT_INTEGER,MRB_TT_FLOAT):
x = (mrb_float)mrb_integer(regs[a]);
@@ -2349,7 +2349,6 @@ RETRY_TRY_BLOCK:
f = mrb_num_div_flo(mrb, x, y);
SET_FLOAT_VALUE(mrb, regs[a], f);
#endif
- L_DIV_OUT:
NEXT;
}