Merge branch 'bytecode_cleanup' into mach

This commit is contained in:
2026-02-12 14:08:45 -06:00
18 changed files with 344 additions and 225 deletions

View File

@@ -469,7 +469,7 @@ typedef enum MachOpcode {
MACH_JMPNULL, /* if R(A)==null: pc += sBx */
/* Function calls — Lua-style consecutive registers (legacy .mach) */
MACH_CALL, /* Call R(A) with B args R(A+1)..R(A+B), C=0 discard, C=1 keep result in R(A) */
MACH_CALL, /* (removed — placeholder to preserve opcode numbering) */
MACH_RETURN, /* Return R(A) */
MACH_RETNIL, /* Return null */
@@ -488,7 +488,7 @@ typedef enum MachOpcode {
MACH_HASPROP, /* R(A) = R(C) in R(B) — has property check */
MACH_REGEXP, /* R(A) = regexp(K(B), K(C)) — regex literal */
MACH_CALLMETHOD, /* Method call: R(A)=obj, B=nargs in R(A+2)..R(A+1+B), C=cpool key */
MACH_CALLMETHOD, /* (removed — placeholder to preserve opcode numbering) */
MACH_EQ_TOL, /* R(A) = eq_tol(R(B), R(B+1), R(B+2)), C=3 */
MACH_NEQ_TOL, /* R(A) = ne_tol(R(B), R(B+1), R(B+2)), C=3 */
@@ -602,6 +602,7 @@ typedef enum MachOpcode {
MACH_IS_RECORD, /* R(A) = is_object(R(B)) */
MACH_IS_STONE, /* R(A) = is_stone(R(B)) */
MACH_LENGTH, /* R(A) = length(R(B)) — array/text/blob length */
MACH_IS_PROXY, /* R(A) = is_function(R(B)) && R(B).length == 2 */
MACH_OP_COUNT
} MachOpcode;
@@ -737,6 +738,7 @@ static const char *mach_opcode_names[MACH_OP_COUNT] = {
[MACH_IS_RECORD] = "is_record",
[MACH_IS_STONE] = "is_stone",
[MACH_LENGTH] = "length",
[MACH_IS_PROXY] = "is_proxy",
};
/* Compiled register-based code (off-heap, never GC'd).