This module implements the code generator for the VM.
The VM works on packed data (see vmdef): registers are 8 byte slots of the stack frame. Scalars held in registers are widened to 64 bits, aggregates occupy consecutive slots and use the memory layout.
Every expression that denotes a location (a local, a global, a field, an array element, a dereferenced pointer) is translated to a Loc. Values are loaded from and stored to locations with typed loads and stores.
The code that is fed to the code generator went through transf and, for the new runtime, through injectdestructors: assignments are bit copies, all non-trivial copies, moves and destructions are explicit calls to hooks.
Consts
debugEchoCode = false
- Source Edit
Procs
proc callShapeOf(c: PCtx; s: PSym): CallShape {....raises: [KeyError, OSError, Exception, ValueError, IOError, ERecoverableError], tags: [ReadEnvEffect, ReadIOEffect, ReadDirEffect, RootEffect, WriteIOEffect], forbids: [].}
- where the arguments and the result of a call of s are, relative to the call area; used for callbacks and templates. Source Edit
proc importcCond(c: PCtx; s: PSym): bool {. ...raises: [KeyError, OSError, Exception, ValueError], tags: [ReadEnvEffect, ReadIOEffect, ReadDirEffect, RootEffect], forbids: [].}
- Source Edit
proc importcCondVar(s: PSym): bool {.inline, ...raises: [KeyError, OSError, Exception, ValueError], tags: [ReadEnvEffect, ReadIOEffect, ReadDirEffect, RootEffect], forbids: [].}
- Source Edit