From 6a9baf3fd7842027a30ee4856d40841610dccc13 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 15 Oct 2013 08:06:54 +0200 Subject: compiler bootstraps with new VM --- compiler/vmdef.nim | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'compiler/vmdef.nim') 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: -- cgit 1.4.1-2-gfad0