KOS_OP_FAST_STORE_CONST
Style: EXTRA (FASTVAR, CONST, NOARG, NOARG). Arg = extra-table index (post-compile).
Stack:
[...] → [...](no stack effect). STORE: store the constant value into the given fast slot viaKosNamespace_FastStore. Same semantics as FAST_STORE, but the value is from the constant pool (extra rowa1), not TOS.Peephole: Not fused directly from
CONST+FAST_STOREincompresstoday; typically appears whenVAR_STORE_CONSTis lowered byconvert_fastfor a local or closure name.Invariants: Slot must already be bound; slot index in range; frame namespace must support fast locals (
KosNamespace_SupportsFast).Compiler form: Pre-compile arg = 4-tuple
(slot, value, None, None)(slot may be integer afterconvert_fast); post-compile arg = extra index.Implementation:
koskari/lib/opcode/FAST_STORE_CONST.cCovered by:
tests/compile/test_convert_fast.py,tests/lib/opcode/test_store_const.py
Example: Store constant 100 in slot 0 without pushing 100.
index |
opcode |
arg |
arg view |
comment |
|---|---|---|---|---|
0 |
FAST_STORE_CONST |
0 |
0 → (0, 100, …) |
STORE 100 in slot 0; stack unchanged |
1 |
FAST |
0 |
0 (a) |
stack: […, 100] |
2 |
RETURN |
1 |
1 |