summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-12-16 20:11:04 +0100
committerAraq <rumpf_a@web.de>2018-12-16 20:11:04 +0100
commitd91d1865b88409ba7fc307505eff69c156d74d52 (patch)
tree2bb044c29d6bf037f934a7e6766a3c19f03da359
parentd66eb04ce9f5da6149744a07ca3b9adbfe9705a6 (diff)
downloadNim-d91d1865b88409ba7fc307505eff69c156d74d52.tar.gz
fixes #9420
-rw-r--r--compiler/cmdlinehelper.nim2
-rw-r--r--lib/system/profiler.nim11
2 files changed, 7 insertions, 6 deletions
diff --git a/compiler/cmdlinehelper.nim b/compiler/cmdlinehelper.nim
index bf7100e34..a15d622a0 100644
--- a/compiler/cmdlinehelper.nim
+++ b/compiler/cmdlinehelper.nim
@@ -50,7 +50,7 @@ proc loadConfigsAndRunMainCommand*(self: NimProg, cache: IdentCache; conf: Confi
 
   when false:
     # These defines/options should not be enabled while processing nimscript
-    # bug #4446, #9420, #8991
+    # bug #9420
     undefSymbol(conf.symbols, "profiler")
     undefSymbol(conf.symbols, "memProfiler")
     undefSymbol(conf.symbols, "nodejs")
diff --git a/lib/system/profiler.nim b/lib/system/profiler.nim
index ffd6fd0c5..57b8af42d 100644
--- a/lib/system/profiler.nim
+++ b/lib/system/profiler.nim
@@ -57,13 +57,13 @@ proc captureStackTrace(f: PFrame, st: var StackTrace) =
     b = b.prev
 
 var
-  profilingRequestedHook*: proc (): bool {.nimcall, benign.}
+  profilingRequestedHook*: proc (): bool {.nimcall, locks: 0, gcsafe.}
     ## set this variable to provide a procedure that implements a profiler in
     ## user space. See the `nimprof` module for a reference implementation.
 
 when defined(memProfiler):
   type
-    MemProfilerHook* = proc (st: StackTrace, requestedSize: int) {.nimcall, benign.}
+    MemProfilerHook* = proc (st: StackTrace, requestedSize: int) {.nimcall, locks: 0, gcsafe.}
 
   var
     profilerHook*: MemProfilerHook
@@ -87,9 +87,10 @@ else:
   proc callProfilerHook(hook: ProfilerHook) {.noinline.} =
     # 'noinline' so that 'nimProfile' does not perform the stack allocation
     # in the common case.
-    var st: StackTrace
-    captureStackTrace(framePtr, st)
-    hook(st)
+    when not defined(nimdoc):
+      var st: StackTrace
+      captureStackTrace(framePtr, st)
+      hook(st)
 
   proc nimProfile() =
     ## This is invoked by the compiler in every loop and on every proc entry!