mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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).
This commit is contained in:
@@ -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;
|
||||
|
||||
+4
-4
@@ -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)) */
|
||||
|
||||
Reference in New Issue
Block a user