diff options
author | Araq <rumpf_a@web.de> | 2013-10-15 08:06:54 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-10-15 08:06:54 +0200 |
commit | 6a9baf3fd7842027a30ee4856d40841610dccc13 (patch) | |
tree | 66489b9bbf27673beabc0b2219bf0036b315b289 /compiler/vmdef.nim | |
parent | 5659a1662e755baac1de555e33f2e8c13e30f2e2 (diff) | |
download | Nim-6a9baf3fd7842027a30ee4856d40841610dccc13.tar.gz |
compiler bootstraps with new VM
Diffstat (limited to 'compiler/vmdef.nim')
-rw-r--r-- | compiler/vmdef.nim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim index d4b3d891d..bc6824d3b 100644 --- a/compiler/vmdef.nim +++ b/compiler/vmdef.nim @@ -165,12 +165,30 @@ type PEvalContext* = PCtx + TEvalMode* = enum ## reason for evaluation + emRepl, ## evaluate because in REPL mode + emConst, ## evaluate for 'const' according to spec + emOptimize, ## evaluate for optimization purposes (same as + ## emConst?) + emStatic ## evaluate for enforced compile time eval + ## ('static' context) + + TSandboxFlag* = enum ## what the evaluation engine should allow + allowCast, ## allow unsafe language feature: 'cast' + allowFFI, ## allow the FFI + allowInfiniteLoops ## allow endless loops + TSandboxFlags* = set[TSandboxFlag] + proc newCtx*(module: PSym): PCtx = PCtx(code: @[], debug: @[], globals: newNode(nkStmtList), constants: newNode(nkStmtList), types: @[], prc: PProc(blocks: @[]), module: module) +proc refresh*(c: PCtx, module: PSym) = + c.module = module + c.prc = PProc(blocks: @[]) + const firstABxInstr* = opcTJmp largeInstrs* = { # instructions which use 2 int32s instead of 1: |