From c4d2cb9ea62108f08b7c5e4fee082c2802489642 Mon Sep 17 00:00:00 2001 From: Araq Date: Tue, 22 Jan 2019 15:28:41 +0100 Subject: [PATCH] excpt.nim: code cleanup, don't produce nimFrame in -d:release mode --- lib/system/excpt.nim | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index 2f41ad1e3c..cc0c1f54bd 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -446,27 +446,21 @@ when not defined(gcDestructors): ## a ``seq``. This is not yet available for the JS backend. shallowCopy(result, e.trace) -when defined(nimRequiresNimFrame): - const nimCallDepthLimit {.intdefine.} = 2000 +const nimCallDepthLimit {.intdefine.} = 2000 - proc callDepthLimitReached() {.noinline.} = - writeStackTrace() - showErrorMessage("Error: call depth limit reached in a debug build (" & - $nimCallDepthLimit & " function calls). You can change it with " & - "-d:nimCallDepthLimit= but really try to avoid deep " & - "recursions instead.\n") - quitOrDebug() +proc callDepthLimitReached() {.noinline.} = + writeStackTrace() + showErrorMessage("Error: call depth limit reached in a debug build (" & + $nimCallDepthLimit & " function calls). You can change it with " & + "-d:nimCallDepthLimit= but really try to avoid deep " & + "recursions instead.\n") + quitOrDebug() - proc nimFrame(s: PFrame) {.compilerRtl, inl, exportc: "nimFrame".} = - s.calldepth = if framePtr == nil: 0 else: framePtr.calldepth+1 - s.prev = framePtr - framePtr = s - if s.calldepth == nimCallDepthLimit: callDepthLimitReached() -else: - proc pushFrame(s: PFrame) {.compilerRtl, inl, exportc: "nimFrame".} = - # XXX only for backwards compatibility - s.prev = framePtr - framePtr = s +proc nimFrame(s: PFrame) {.compilerRtl, inl.} = + s.calldepth = if framePtr == nil: 0 else: framePtr.calldepth+1 + s.prev = framePtr + framePtr = s + if s.calldepth == nimCallDepthLimit: callDepthLimitReached() when defined(endb): var