compiler/vm

    Dark Mode
Search:
Group by:
  Source   Edit

This file implements the new evaluation engine for Nim code. An instruction is 1-3 int32s in memory, it is a register based VM.

Consts

evalPass = (myOpen, myProcess, myClose, false)
  Source   Edit

Procs

proc evalConstExpr(module: PSym; idgen: IdGenerator; g: ModuleGraph; e: PNode): PNode {....raises: [
    Exception, ValueError, KeyError, OSError, IOError, ERecoverableError,
    JsonParsingError], tags: [RootEffect, ReadDirEffect, WriteIOEffect,
                              ReadIOEffect, ReadEnvEffect, TimeEffect,
                              ExecIOEffect].}
  Source   Edit
proc evalExpr(c: PCtx; n: PNode): PNode {....raises: [Exception, ValueError,
    KeyError, OSError, IOError, ERecoverableError, JsonParsingError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect,
    TimeEffect, ExecIOEffect].}
  Source   Edit
proc evalMacroCall(module: PSym; idgen: IdGenerator; g: ModuleGraph;
                   templInstCounter: ref int; n, nOrig: PNode; sym: PSym): PNode {....raises: [
    Exception, ValueError, KeyError, OSError, IOError, ERecoverableError,
    JsonParsingError], tags: [RootEffect, ReadDirEffect, WriteIOEffect,
                              ReadIOEffect, ReadEnvEffect, TimeEffect,
                              ExecIOEffect].}
  Source   Edit
proc evalStaticExpr(module: PSym; idgen: IdGenerator; g: ModuleGraph; e: PNode;
                    prc: PSym): PNode {....raises: [Exception, ValueError,
    KeyError, OSError, IOError, ERecoverableError, JsonParsingError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect,
    TimeEffect, ExecIOEffect].}
  Source   Edit
proc evalStaticStmt(module: PSym; idgen: IdGenerator; g: ModuleGraph; e: PNode;
                    prc: PSym) {....raises: [Exception, ValueError, KeyError,
    OSError, IOError, ERecoverableError, JsonParsingError], tags: [RootEffect,
    ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect,
    ExecIOEffect].}
  Source   Edit
proc evalStmt(c: PCtx; n: PNode) {....raises: [Exception, ValueError, KeyError,
    OSError, IOError, ERecoverableError, JsonParsingError], tags: [RootEffect,
    ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect,
    ExecIOEffect].}
  Source   Edit
proc execProc(c: PCtx; sym: PSym; args: openArray[PNode]): PNode {....raises: [
    Exception, ValueError, KeyError, OSError, IOError, ERecoverableError,
    JsonParsingError], tags: [RootEffect, ReadDirEffect, WriteIOEffect,
                              ReadIOEffect, ReadEnvEffect, TimeEffect,
                              ExecIOEffect].}
  Source   Edit
proc getBool(a: VmArgs; i: Natural): bool {....raises: [], tags: [].}
  Source   Edit
proc getFloat(a: VmArgs; i: Natural): BiggestFloat {....raises: [], tags: [].}
  Source   Edit
proc getGlobalValue(c: PCtx; s: PSym): PNode {....raises: [Exception, ValueError,
    KeyError, OSError, IOError, ERecoverableError], tags: [RootEffect,
    ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
  Source   Edit
proc getInt(a: VmArgs; i: Natural): BiggestInt {....raises: [], tags: [].}
  Source   Edit
proc getNode(a: VmArgs; i: Natural): PNode {....raises: [], tags: [].}
  Source   Edit
proc getNodeAddr(a: VmArgs; i: Natural): PNode {....raises: [], tags: [].}
  Source   Edit
proc getString(a: VmArgs; i: Natural): string {....raises: [], tags: [].}
  Source   Edit
proc getVar(a: VmArgs; i: Natural): PNode {....raises: [], tags: [].}
  Source   Edit
proc numArgs(a: VmArgs): int {....raises: [], tags: [].}
  Source   Edit
proc registerAdditionalOps(c: PCtx) {....raises: [], tags: [].}
  Source   Edit
proc setGlobalValue(c: PCtx; s: PSym; val: PNode) {....raises: [Exception,
    ValueError, KeyError, OSError, IOError, ERecoverableError], tags: [
    RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
Does not do type checking so ensure the val matches the s.typ   Source   Edit
proc setResult(a: VmArgs; n: PNode) {....raises: [], tags: [].}
  Source   Edit
proc setResult(a: VmArgs; v: AbsoluteDir) {....raises: [], tags: [].}
  Source   Edit
proc setResult(a: VmArgs; v: BiggestFloat) {....raises: [], tags: [].}
  Source   Edit
proc setResult(a: VmArgs; v: BiggestInt) {....raises: [], tags: [].}
  Source   Edit
proc setResult(a: VmArgs; v: bool) {....raises: [], tags: [].}
  Source   Edit
proc setResult(a: VmArgs; v: seq[string]) {....raises: [], tags: [].}
  Source   Edit
proc setResult(a: VmArgs; v: string) {....raises: [], tags: [].}
  Source   Edit
proc setupCompileTimeVar(module: PSym; idgen: IdGenerator; g: ModuleGraph;
                         n: PNode) {....raises: [Exception, ValueError, KeyError,
    OSError, IOError, ERecoverableError, JsonParsingError], tags: [RootEffect,
    ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect,
    ExecIOEffect].}
  Source   Edit
proc setupGlobalCtx(module: PSym; graph: ModuleGraph; idgen: IdGenerator) {.
    ...raises: [], tags: [].}
  Source   Edit

Iterators

iterator genericParamsInMacroCall(macroSym: PSym; call: PNode): (PSym, PNode) {.
    ...raises: [], tags: [].}
  Source   Edit