fixes #9420
This commit is contained in:
parent
d66eb04ce9
commit
d91d1865b8
2 changed files with 7 additions and 6 deletions
|
|
@ -50,7 +50,7 @@ proc loadConfigsAndRunMainCommand*(self: NimProg, cache: IdentCache; conf: Confi
|
||||||
|
|
||||||
when false:
|
when false:
|
||||||
# These defines/options should not be enabled while processing nimscript
|
# These defines/options should not be enabled while processing nimscript
|
||||||
# bug #4446, #9420, #8991
|
# bug #9420
|
||||||
undefSymbol(conf.symbols, "profiler")
|
undefSymbol(conf.symbols, "profiler")
|
||||||
undefSymbol(conf.symbols, "memProfiler")
|
undefSymbol(conf.symbols, "memProfiler")
|
||||||
undefSymbol(conf.symbols, "nodejs")
|
undefSymbol(conf.symbols, "nodejs")
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,13 @@ proc captureStackTrace(f: PFrame, st: var StackTrace) =
|
||||||
b = b.prev
|
b = b.prev
|
||||||
|
|
||||||
var
|
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
|
## set this variable to provide a procedure that implements a profiler in
|
||||||
## user space. See the `nimprof` module for a reference implementation.
|
## user space. See the `nimprof` module for a reference implementation.
|
||||||
|
|
||||||
when defined(memProfiler):
|
when defined(memProfiler):
|
||||||
type
|
type
|
||||||
MemProfilerHook* = proc (st: StackTrace, requestedSize: int) {.nimcall, benign.}
|
MemProfilerHook* = proc (st: StackTrace, requestedSize: int) {.nimcall, locks: 0, gcsafe.}
|
||||||
|
|
||||||
var
|
var
|
||||||
profilerHook*: MemProfilerHook
|
profilerHook*: MemProfilerHook
|
||||||
|
|
@ -87,6 +87,7 @@ else:
|
||||||
proc callProfilerHook(hook: ProfilerHook) {.noinline.} =
|
proc callProfilerHook(hook: ProfilerHook) {.noinline.} =
|
||||||
# 'noinline' so that 'nimProfile' does not perform the stack allocation
|
# 'noinline' so that 'nimProfile' does not perform the stack allocation
|
||||||
# in the common case.
|
# in the common case.
|
||||||
|
when not defined(nimdoc):
|
||||||
var st: StackTrace
|
var st: StackTrace
|
||||||
captureStackTrace(framePtr, st)
|
captureStackTrace(framePtr, st)
|
||||||
hook(st)
|
hook(st)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue