# vm

Theme:

- Index

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.

# Imports

semmacrosanity, msgs, vmdef, vmgen, nimsets, types, parser, vmdeps, idents, trees, renderer, options, transf, gorgeimpl, lineinfos, btrees, macrocacheimpl, modulegraphs, sighashes, int128, vmprofiler, ast, semfold, evaltempl, magicsys, pathutils, vmconv, vmmarshal

# Procs

    proc evalConstExpr(module: PSym; idgen: IdGenerator; g: ModuleGraph; e: PNode): PNode {....raises: [
        Exception, ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect,
        TimeEffect, ExecIOEffect], forbids: [].}

  Source Edit

    proc evalExpr(c: PCtx; n: PNode): PNode {....raises: [Exception, ValueError,
        OSError, KeyError, IOError, ERecoverableError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect,
        ExecIOEffect], forbids: [].}

  Source Edit

    proc evalMacroCall(module: PSym; idgen: IdGenerator; g: ModuleGraph;
                       templInstCounter: ref int; n, nOrig: PNode; sym: PSym): PNode {....raises: [
        Exception, ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect,
        TimeEffect, ExecIOEffect], forbids: [].}

  Source Edit

    proc evalStaticExpr(module: PSym; idgen: IdGenerator; g: ModuleGraph; e: PNode;
                        prc: PSym): PNode {....raises: [Exception, ValueError, OSError,
        KeyError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect,
        WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect, ExecIOEffect],
                                            forbids: [].}

  Source Edit

    proc evalStaticStmt(module: PSym; idgen: IdGenerator; g: ModuleGraph; e: PNode;
                        prc: PSym) {....raises: [Exception, ValueError, OSError,
        KeyError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect,
        WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect, ExecIOEffect],
                                     forbids: [].}

  Source Edit

    proc evalStmt(c: PCtx; n: PNode) {....raises: [Exception, ValueError, OSError,
        KeyError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect,
        WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect, ExecIOEffect],
                                       forbids: [].}

  Source Edit

    proc execProc(c: PCtx; sym: PSym; args: openArray[PNode]): PNode {....raises: [
        Exception, ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect,
        TimeEffect, ExecIOEffect], forbids: [].}

  Source Edit

    proc getBool(a: VmArgs; i: Natural): bool {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc getFloat(a: VmArgs; i: Natural): BiggestFloat {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc getGlobalValue(c: PCtx; s: PSym): PNode {....raises: [Exception, ValueError,
        OSError, KeyError, IOError, ERecoverableError], tags: [RootEffect,
        ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect], forbids: [].}

  Source Edit

    proc getInt(a: VmArgs; i: Natural): BiggestInt {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc getNode(a: VmArgs; i: Natural): PNode {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc getNodeAddr(a: VmArgs; i: Natural): PNode {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc getString(a: VmArgs; i: Natural): string {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc getVar(a: VmArgs; i: Natural): PNode {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc interpreterCode(c: PPassContext; n: PNode): PNode {....raises: [Exception,
        ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect,
        TimeEffect, ExecIOEffect], forbids: [].}

  Source Edit

    proc numArgs(a: VmArgs): int {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc registerAdditionalOps(c: PCtx) {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc setGlobalValue(c: PCtx; s: PSym; val: PNode) {....raises: [Exception,
        ValueError, OSError, KeyError, IOError, ERecoverableError], tags: [
        RootEffect, ReadDirEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect],
        forbids: [].}

  Does not do type checking so ensure the `val` matches the `s.typ` Source Edit

    proc setResult(a: VmArgs; n: PNode) {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc setResult(a: VmArgs; v: (BiggestInt, BiggestInt)) {....raises: [], tags: [],
        forbids: [].}

  Source Edit

    proc setResult(a: VmArgs; v: AbsoluteDir) {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc setResult(a: VmArgs; v: BiggestFloat) {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc setResult(a: VmArgs; v: BiggestInt) {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc setResult(a: VmArgs; v: bool) {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc setResult(a: VmArgs; v: seq[string]) {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc setResult(a: VmArgs; v: string) {....raises: [], tags: [], forbids: [].}

  Source Edit

    proc setupCompileTimeVar(module: PSym; idgen: IdGenerator; g: ModuleGraph;
                             n: PNode) {....raises: [Exception, ValueError, OSError,
        KeyError, IOError, ERecoverableError], tags: [RootEffect, ReadDirEffect,
        WriteIOEffect, ReadIOEffect, ReadEnvEffect, TimeEffect, ExecIOEffect],
                                         forbids: [].}

  Source Edit

    proc setupEvalGen(graph: ModuleGraph; module: PSym; idgen: IdGenerator): PPassContext {.
        ...raises: [], tags: [], forbids: [].}

  Source Edit

    proc setupGlobalCtx(module: PSym; graph: ModuleGraph; idgen: IdGenerator) {.
        ...raises: [], tags: [], forbids: [].}

  Source Edit

# Iterators

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

  Source Edit