From b7e8406f6cf7f8f83fe9594d06c0861e4068241b Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 3 Nov 2020 14:58:44 +0900 Subject: Add new instructions to handle symbols/literals >255; fix #5109 New instructions: * OP_LOADL16 * OP_LOADSYM16 * OP_STRING16 Size of pools, symbols are `int16_t` but offset representation in the bytecode was 8 bits. Size of child `irep` array is `int16_t`, too but this change does not address it. --- include/mruby/ops.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/mruby/ops.h b/include/mruby/ops.h index 75936a791..43b8de638 100644 --- a/include/mruby/ops.h +++ b/include/mruby/ops.h @@ -14,6 +14,7 @@ operation code operands semantics OPCODE(NOP, Z) /* no operation */ OPCODE(MOVE, BB) /* R(a) = R(b) */ OPCODE(LOADL, BB) /* R(a) = Pool(b) */ +OPCODE(LOADL16, BS) /* R(a) = Pool(b) */ OPCODE(LOADI, BB) /* R(a) = mrb_int(b) */ OPCODE(LOADINEG, BB) /* R(a) = mrb_int(-b) */ OPCODE(LOADI__1, B) /* R(a) = mrb_int(-1) */ @@ -27,6 +28,7 @@ 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(LOADSYM, BB) /* R(a) = Syms(b) */ +OPCODE(LOADSYM16, BS) /* R(a) = Syms(b) */ OPCODE(LOADNIL, B) /* R(a) = nil */ OPCODE(LOADSELF, B) /* R(a) = self */ OPCODE(LOADT, B) /* R(a) = true */ @@ -89,6 +91,7 @@ OPCODE(ASET, BBB) /* R(a)[c] = R(b) */ OPCODE(APOST, BBB) /* *R(a),R(a+1)..R(a+c) = R(a)[b..] */ OPCODE(INTERN, B) /* R(a) = intern(R(a)) */ OPCODE(STRING, BB) /* R(a) = str_dup(Lit(b)) */ +OPCODE(STRING16, BS) /* R(a) = str_dup(Lit(b)) */ OPCODE(STRCAT, B) /* str_cat(R(a),R(a+1)) */ OPCODE(HASH, BB) /* R(a) = hash_new(R(a),R(a+1)..R(a+b*2-1)) */ OPCODE(HASHADD, BB) /* R(a) = hash_push(R(a),R(a+1)..R(a+b*2)) */ -- cgit v1.2.3