mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
vm: add OP_RETSELF instruction for returning self
Fuse LOADSELF + RETURN sequence into single RETSELF instruction. Saves 2 bytes per occurrence (3 bytes -> 1 byte). Found 25 occurrences in mrblib, saving 50 bytes total. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,7 @@ OPCODE(KEYEND, Z) /* raise unless kdict.empty? */
|
||||
OPCODE(KARG, BB) /* R[a] = kdict[Syms[b]]; kdict.delete(Syms[b]) */
|
||||
OPCODE(RETURN, B) /* return R[a] (normal) */
|
||||
OPCODE(RETURN_BLK, B) /* return R[a] (in-block return) */
|
||||
OPCODE(RETSELF, Z) /* return self */
|
||||
OPCODE(BREAK, B) /* break R[a] */
|
||||
OPCODE(BLKPUSH, BS) /* R[a] = block (16=m5:r1:m5:d1:lv4) */
|
||||
OPCODE(ADD, B) /* R[a] = R[a]+R[a+1] */
|
||||
|
||||
Reference in New Issue
Block a user