KOS_OP_PUSH_NS
Style: EXTRA. Schema: CONST (cpool index of NamespaceSpec), CONST (cpool index of names tuple or None), NOARG, NOARG. Instruction
argis the extra-row index. Binding count islen(names)when names is a tuple, or0when names isNone.Constant pool: NSPEC and NAMES are loaded from the pool; they are not placed on the stack by preceding
CONSTopcodes.Stack: If
opa == 0, no stack operands for bindings. Ifopa > 0, stack is[..., val_0, ..., val_{opa-1}]with TOS = last value; names come from the extra row. The VM bindsnames[i]toval[i], then dropsopastack slots.Pushes: KOS_DYN_NS (static extent KOS_EXT_NS; owns its operand segment; the prior namespace returns on POP_NS when the enclosing node is revealed).
Invariants: Extent kind KOS_EXT_NS.
Example: Push namespace with no bound values (names = None). Operand row holds NSPEC and None; stack carries only the chain side effect until body runs.
index |
opcode |
arg |
arg view |
comment |
|---|---|---|---|---|
0 |
PUSH_NS |
0 |
extra row 0 (e.g. c# nspec, c# None) |
push NS region; chain: […, KosDynNs] |
1 |
… |
… |
… |
body |
2 |
POP_NS |
0 |
0 |
pop NS; restore previous namespace |