diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-11-03 14:58:44 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-11-03 14:58:44 +0900 |
| commit | b7e8406f6cf7f8f83fe9594d06c0861e4068241b (patch) | |
| tree | bfed217bbb86a7d04aabe7e8ca88a99323fd6bfa /include | |
| parent | 0be5b266b668a6219b440c80bfcff692e02d2097 (diff) | |
| download | mruby-b7e8406f6cf7f8f83fe9594d06c0861e4068241b.tar.gz mruby-b7e8406f6cf7f8f83fe9594d06c0861e4068241b.zip | |
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.
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby/ops.h | 3 |
1 files changed, 3 insertions, 0 deletions
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)) */ |
