diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-11-26 10:34:31 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-11-26 10:34:31 +0900 |
| commit | 7150c6753933f12a2ba63769fb7b3a44cfcddd3d (patch) | |
| tree | cddfd89197039d98cac827837e58bd3041d88a2a /include | |
| parent | 6dedd6a940194881c3b66124ff277c4cb14d08bd (diff) | |
| download | mruby-7150c6753933f12a2ba63769fb7b3a44cfcddd3d.tar.gz mruby-7150c6753933f12a2ba63769fb7b3a44cfcddd3d.zip | |
Make `OP_JMP*` operand address to be relative.
Jump target address is `operand (16bit)` + `address of next instruction`.
In addition, `ilen` was made `uint32_t` so that `iseq` length limitation
of 65536 is removed. Only jump target address should be within signed
16bit (-32768 .. 32767).
Diffstat (limited to 'include')
| -rw-r--r-- | include/mruby/irep.h | 3 | ||||
| -rw-r--r-- | include/mruby/ops.h | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/mruby/irep.h b/include/mruby/irep.h index 173f69037..04ab54ee2 100644 --- a/include/mruby/irep.h +++ b/include/mruby/irep.h @@ -73,7 +73,8 @@ typedef struct mrb_irep { /* debug info */ struct mrb_irep_debug_info* debug_info; - uint16_t ilen, plen, slen; + uint32_t ilen; + uint16_t plen, slen; uint8_t rlen; uint32_t refcnt; } mrb_irep; diff --git a/include/mruby/ops.h b/include/mruby/ops.h index 02f227634..b006ae94f 100644 --- a/include/mruby/ops.h +++ b/include/mruby/ops.h @@ -49,10 +49,10 @@ OPCODE(GETMCNST, BB) /* R(a) = R(a)::Syms(b) */ OPCODE(SETMCNST, BB) /* R(a+1)::Syms(b) = R(a) */ OPCODE(GETUPVAR, BBB) /* R(a) = uvget(b,c) */ OPCODE(SETUPVAR, BBB) /* uvset(b,c,R(a)) */ -OPCODE(JMP, S) /* pc=a */ -OPCODE(JMPIF, BS) /* if R(a) pc=b */ -OPCODE(JMPNOT, BS) /* if !R(a) pc=b */ -OPCODE(JMPNIL, BS) /* if R(a)==nil pc=b */ +OPCODE(JMP, S) /* pc+=a */ +OPCODE(JMPIF, BS) /* if R(a) pc+=b */ +OPCODE(JMPNOT, BS) /* if !R(a) pc+=b */ +OPCODE(JMPNIL, BS) /* if R(a)==nil pc+=b */ OPCODE(JMPUW, S) /* unwind_and_jump_to(a) */ OPCODE(EXCEPT, B) /* R(a) = exc */ OPCODE(RESCUE, BB) /* R(b) = R(a).isa?(R(b)) */ |
