nir/nirvm

Source   Edit  

NIR is a little too high level to interpret it efficiently. Thus we compute addresses for SymIds, labels and offsets for object fields in a preprocessing step.

We also split the instruction stream into separate (code, debug) seqs while we're at it.

Types

Bytecode = object
  interactive*: bool
Source   Edit  
Universe = object
all units: For interpretation we need that Source   Edit  

Procs

proc execCode(bc: var Bytecode; t: Tree; n: NodePos) {.
    ...raises: [KeyError, Exception, IOError], tags: [RootEffect, WriteIOEffect],
    forbids: [].}
Source   Edit  
proc immediateVal(ins: Instr): int {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc initBytecode(m: ref NirModule): Bytecode {....raises: [], tags: [],
    forbids: [].}
Source   Edit  
proc len(bc: Bytecode): int {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc litId(ins: Instr): LitId {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc toString(t: Bytecode; pos: CodePos; r: var string; nesting = 0) {.
    ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc typeId(ins: Instr): TypeId {.inline, ...raises: [], tags: [], forbids: [].}
Source   Edit  

Iterators

iterator triples(bc: Bytecode; n: CodePos): (uint32, int, CodePos) {....raises: [],
    tags: [], forbids: [].}
Source   Edit