From fabbb7ea3e489720d1eaae0508fd2576d92e17e7 Mon Sep 17 00:00:00 2001 From: Jason Beetham Date: Mon, 26 Oct 2020 04:06:18 -0600 Subject: [PATCH] Fixed iteration limit hit from execproc (#15723) [backport:1.2] [backport:1.4] When calling procs from Nim in Nimscript you could hit the VM iteration limit even though the code is functioning properly. This resolves that by making the iteration limit reset eachtime you call a proc. (cherry picked from commit a87617956f9a521eac3663df6a6a9862bc7ae87e) --- compiler/vm.nim | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/vm.nim b/compiler/vm.nim index 37d5a609eb..667410f4ec 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -2086,6 +2086,7 @@ proc execute(c: PCtx, start: int): PNode = result = rawExecute(c, start, tos).regToNode proc execProc*(c: PCtx; sym: PSym; args: openArray[PNode]): PNode = + c.loopIterations = c.config.maxLoopIterationsVM if sym.kind in routineKinds: if sym.typ.len-1 != args.len: localError(c.config, sym.info,