summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-08-25 09:49:20 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-08-25 09:49:20 +0900
commitd79dbd92f9104712c6cf41ab3c029dec318a757d (patch)
tree9312f33cbc3facb0ce381d62fc97803501f3997f
parent49d1b168221221b7e810f001d88e16ebc94378fd (diff)
downloadmruby-d79dbd92f9104712c6cf41ab3c029dec318a757d.tar.gz
mruby-d79dbd92f9104712c6cf41ab3c029dec318a757d.zip
fixup! New bytecode implementation of mruby VM.
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c100
-rw-r--r--src/vm.c10
2 files changed, 0 insertions, 110 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index bf5cc14b0..075945b3b 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -445,108 +445,8 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep)
break;
default:
goto normal;
-=======
-struct mrb_insn_data {
- uint8_t insn;
- uint16_t a;
- uint16_t b;
- uint8_t c;
-};
-
-struct mrb_insn_data
-mrb_decode_insn(codegen_scope *s, mrb_code *pc)
-{
- struct mrb_insn_data data = { 0 };
- mrb_code insn = READ_B();
- uint16_t a = 0;
- uint16_t b = 0;
- uint8_t c = 0;
-
- switch (insn) {
-#define FETCH_Z() /* empty */
-#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x (); break;
-#include "mruby/ops.h"
-#undef OPCODE
- }
- switch (insn) {
- case OP_EXT1:
- insn = READ_B();
- switch (insn) {
-#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _1 (); break;
-#include "mruby/ops.h"
-#undef OPCODE
- }
- break;
- case OP_EXT2:
- insn = READ_B();
- switch (insn) {
-#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _2 (); break;
-#include "mruby/ops.h"
-#undef OPCODE
- }
- break;
- case OP_EXT3:
- insn = READ_B();
- switch (insn) {
-#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _3 (); break;
-#include "mruby/ops.h"
-#undef OPCODE
- }
- break;
- default:
- break;
- }
- data.insn = insn;
- data.a = a;
- data.b = b;
- data.c = c;
- return data;
-}
-
-struct mrb_insn_data
-mrb_last_insn(codegen_scope *s)
-{
- if (s->pc == s->lastpc) {
- struct mrb_insn_data data;
-
- data.insn = OP_NOP;
- return data;
- }
- return mrb_decode_insn(s, &s->iseq[s->lastpc]);
-}
-
-static mrb_bool
-no_peephole(codegen_scope *s)
-{
- return no_optimize(s) || s->lastlabel == s->pc || s->pc == 0 || s->pc == s->lastpc;
-}
-
-static uint16_t
-genjmp(codegen_scope *s, mrb_code i, uint16_t pc)
-{
- uint16_t pos;
-
- s->lastpc = s->pc;
- gen_B(s, i);
- pos = s->pc;
- gen_S(s, pc);
- return pos;
-}
-
-static uint16_t
-genjmp2(codegen_scope *s, mrb_code i, uint16_t a, int pc, int val)
-{
- uint16_t pos;
-
- if (!no_peephole(s) && !val) {
- struct mrb_insn_data data = mrb_last_insn(s);
-
- if (data.insn == OP_MOVE && data.a == a) {
- s->pc = s->lastpc;
- a = data.b;
}
}
- return genop(s, i);
}
static void
diff --git a/src/vm.c b/src/vm.c
index b47469ebf..d0ea6b3bd 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -1069,16 +1069,6 @@ RETRY_TRY_BLOCK:
NEXT;
}
- CASE(OP_LOADI, BB) {
- SET_INT_VALUE(regs[a], b);
- NEXT;
- }
-
- CASE(OP_LOADINEG, BB) {
- SET_INT_VALUE(regs[a], -b);
- NEXT;
- }
-
CASE(OP_LOADI__1,B) goto L_LOADI;
CASE(OP_LOADI_0,B) goto L_LOADI;
CASE(OP_LOADI_1,B) goto L_LOADI;