mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
vm: add OP_GETIDX0 for fast array[0] access
Fuses MOVE+LOADI_0+GETIDX pattern into single instruction. Saves 4 bytes per arr[0] access (7 bytes -> 3 bytes). Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -48,6 +48,7 @@ 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(GETIDX, B) /* R[a] = R[a][R[a+1]] */
|
||||
OPCODE(GETIDX0, BB) /* R[a] = R[b][0]; a+1 for method call */
|
||||
OPCODE(SETIDX, B) /* R[a][R[a+1]] = R[a+2] */
|
||||
OPCODE(JMP, S) /* pc+=a */
|
||||
OPCODE(JMPIF, BS) /* if R[a] pc+=b */
|
||||
|
||||
Reference in New Issue
Block a user