From d13df1536d5513be64732aef41827d5d0329ee58 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 4 Nov 2020 14:01:04 +0900 Subject: Add a new instruction `OP_LOADI32`. That loads 32 bit integer bypassing pool access. --- include/mruby/opcode.h | 1 + include/mruby/ops.h | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/mruby/opcode.h b/include/mruby/opcode.h index a6c636cf8..987c5ad8f 100644 --- a/include/mruby/opcode.h +++ b/include/mruby/opcode.h @@ -36,6 +36,7 @@ enum mrb_insn { #define FETCH_BB() do {a=READ_B(); b=READ_B();} while (0) #define FETCH_BBB() do {a=READ_B(); b=READ_B(); c=READ_B();} while (0) #define FETCH_BS() do {a=READ_B(); b=READ_S();} while (0) +#define FETCH_BSS() do {a=READ_B(); b=READ_S(); c=READ_S();} while (0) #define FETCH_S() do {a=READ_S();} while (0) #define FETCH_W() do {a=READ_W();} while (0) diff --git a/include/mruby/ops.h b/include/mruby/ops.h index 43b8de638..87f48d2a9 100644 --- a/include/mruby/ops.h +++ b/include/mruby/ops.h @@ -1,11 +1,12 @@ /* operand types: - + Z: no operand (Z,Z,Z,Z) - + B: 8bit (B,S,B,B) - + BB: 8+8bit (BB,SB,BS,SS) - + BBB: 8+8+8bit (BBB,SBB,BSB,SSB) - + BS: 8+16bit (BS,SS,BS,BS) - + S: 16bit (S,S,S,S) - + W: 24bit (W,W,W,W) + + Z: no operand + + B: 8bit + + BB: 8+8bit + + BBB: 8+8+8bit + + BS: 8+16bit + + BSS: 8+16+16bit + + S: 16bit + + W: 24bit */ /*----------------------------------------------------------------------- @@ -27,6 +28,7 @@ OPCODE(LOADI_5, B) /* R(a) = mrb_int(5) */ OPCODE(LOADI_6, B) /* R(a) = mrb_int(6) */ OPCODE(LOADI_7, B) /* R(a) = mrb_int(7) */ OPCODE(LOADI16, BS) /* R(a) = mrb_int(b) */ +OPCODE(LOADI32, BSS) /* R(a) = mrb_int((b<<16)+c) */ OPCODE(LOADSYM, BB) /* R(a) = Syms(b) */ OPCODE(LOADSYM16, BS) /* R(a) = Syms(b) */ OPCODE(LOADNIL, B) /* R(a) = nil */ -- cgit v1.2.3