summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-11-04 14:01:04 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-11-04 14:01:04 +0900
commitd13df1536d5513be64732aef41827d5d0329ee58 (patch)
tree8c4bbf7fd1d18a5429129d9babbee28438d9227d /include
parentf8156ae17511e7255b5984075a025533d3771cd0 (diff)
downloadmruby-d13df1536d5513be64732aef41827d5d0329ee58.tar.gz
mruby-d13df1536d5513be64732aef41827d5d0329ee58.zip
Add a new instruction `OP_LOADI32`.
That loads 32 bit integer bypassing pool access.
Diffstat (limited to 'include')
-rw-r--r--include/mruby/opcode.h1
-rw-r--r--include/mruby/ops.h16
2 files changed, 10 insertions, 7 deletions
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 */