diff --git a/compiler/vm.nim b/compiler/vm.nim index 7edbb3fd20..b682b4e253 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -1364,9 +1364,11 @@ var globalCtx: PCtx proc setupGlobalCtx(module: PSym) = - if globalCtx.isNil: globalCtx = newCtx(module) - else: refresh(globalCtx, module) - registerAdditionalOps(globalCtx) + if globalCtx.isNil: + globalCtx = newCtx(module) + registerAdditionalOps(globalCtx) + else: + refresh(globalCtx, module) proc myOpen(module: PSym): PPassContext = #var c = newEvalContext(module, emRepl) diff --git a/compiler/vmdef.nim b/compiler/vmdef.nim index 3d49cb130d..90b9f2517a 100644 --- a/compiler/vmdef.nim +++ b/compiler/vmdef.nim @@ -213,6 +213,7 @@ proc newCtx*(module: PSym): PCtx = proc refresh*(c: PCtx, module: PSym) = c.module = module c.prc = PProc(blocks: @[]) + c.loopIterations = MaxLoopIterations proc registerCallback*(c: PCtx; name: string; callback: VmCallback) = c.callbacks.add((name, callback))