excpt.nim: code cleanup, don't produce nimFrame in -d:release mode

This commit is contained in:
Araq 2019-01-22 15:28:41 +01:00 • committed by Andreas Rumpf
commit c4d2cb9ea6

View file

@ -446,27 +446,21 @@ when not defined(gcDestructors):
## a ``seq``. This is not yet available for the JS backend. ## a ``seq``. This is not yet available for the JS backend.
shallowCopy(result, e.trace) shallowCopy(result, e.trace)
when defined(nimRequiresNimFrame): const nimCallDepthLimit {.intdefine.} = 2000
const nimCallDepthLimit {.intdefine.} = 2000
proc callDepthLimitReached() {.noinline.} = proc callDepthLimitReached() {.noinline.} =
writeStackTrace() writeStackTrace()
showErrorMessage("Error: call depth limit reached in a debug build (" & showErrorMessage("Error: call depth limit reached in a debug build (" &
$nimCallDepthLimit & " function calls). You can change it with " & $nimCallDepthLimit & " function calls). You can change it with " &
"-d:nimCallDepthLimit=<int> but really try to avoid deep " & "-d:nimCallDepthLimit=<int> but really try to avoid deep " &
"recursions instead.\n") "recursions instead.\n")
quitOrDebug() quitOrDebug()
proc nimFrame(s: PFrame) {.compilerRtl, inl, exportc: "nimFrame".} = proc nimFrame(s: PFrame) {.compilerRtl, inl.} =
s.calldepth = if framePtr == nil: 0 else: framePtr.calldepth+1 s.calldepth = if framePtr == nil: 0 else: framePtr.calldepth+1
s.prev = framePtr s.prev = framePtr
framePtr = s framePtr = s
if s.calldepth == nimCallDepthLimit: callDepthLimitReached() if s.calldepth == nimCallDepthLimit: callDepthLimitReached()
else:
proc pushFrame(s: PFrame) {.compilerRtl, inl, exportc: "nimFrame".} =
# XXX only for backwards compatibility
s.prev = framePtr
framePtr = s
when defined(endb): when defined(endb):
var var