Add bytecode slot metadata and compile-time mutability

This commit is contained in:
sergeych committed 2026-01-26 01:09:02 +03:00
1 parent b4598bff98
commit 059e366787
11 files changed
+577 -138

No files matched your search

+12
View File
@@ -10,6 +10,7 @@ interpreter and fall back to the existing AST execution when needed.
### Frame metadata
- localCount: number of local slots for this function (fixed at compile time).
- argCount: number of arguments passed at call time.
- scopeSlotNames: optional debug names for scope slots (locals/params), aligned to slot mapping.
- argBase = localCount.
### Slot layout
@@ -25,6 +26,10 @@ slots[localCount .. localCount+argCount-1] arguments
- param i => slot localCount + i
- variadic extra => slot localCount + declaredParamCount + k
### Debug metadata (optional)
- scopeSlotNames: array sized scopeSlotCount, each entry nullable.
- Intended for disassembly/debug tooling; VM semantics do not depend on it.
## 2) Slot ID Width
Per frame, select:
@@ -113,6 +118,13 @@ Note: Any opcode can be compiled to FALLBACK if not implemented in a VM pass.
- DIV_REAL S, S -> S
- NEG_REAL S -> S
### Arithmetic: OBJ
- ADD_OBJ S, S -> S
- SUB_OBJ S, S -> S
- MUL_OBJ S, S -> S
- DIV_OBJ S, S -> S
- MOD_OBJ S, S -> S
### Bitwise: INT
- AND_INT S, S -> S
- OR_INT S, S -> S