no stack tracing for the system module; fixes stack bottom detection
This commit is contained in:
parent
d46380e718
commit
4b0e391bb8
1 changed files with 13 additions and 5 deletions
|
|
@ -1122,6 +1122,9 @@ proc newPostInitProc(m: BModule): BProc =
|
||||||
# little hack so that unique temporaries are generated:
|
# little hack so that unique temporaries are generated:
|
||||||
result.labels = 200_000
|
result.labels = 200_000
|
||||||
|
|
||||||
|
proc initProcOptions(m: BModule): TOptions =
|
||||||
|
if sfSystemModule in m.module.flags: gOptions-{optStackTrace} else: gOptions
|
||||||
|
|
||||||
proc rawNewModule(module: PSym, filename: string): BModule =
|
proc rawNewModule(module: PSym, filename: string): BModule =
|
||||||
new(result)
|
new(result)
|
||||||
InitLinkedList(result.headerFiles)
|
InitLinkedList(result.headerFiles)
|
||||||
|
|
@ -1134,7 +1137,7 @@ proc rawNewModule(module: PSym, filename: string): BModule =
|
||||||
result.module = module
|
result.module = module
|
||||||
result.typeInfoMarker = initIntSet()
|
result.typeInfoMarker = initIntSet()
|
||||||
result.initProc = newProc(nil, result)
|
result.initProc = newProc(nil, result)
|
||||||
result.initProc.options = gOptions
|
result.initProc.options = initProcOptions(result)
|
||||||
result.preInitProc = newPreInitProc(result)
|
result.preInitProc = newPreInitProc(result)
|
||||||
result.postInitProc = newPostInitProc(result)
|
result.postInitProc = newPostInitProc(result)
|
||||||
initNodeTable(result.dataCache)
|
initNodeTable(result.dataCache)
|
||||||
|
|
@ -1142,7 +1145,12 @@ proc rawNewModule(module: PSym, filename: string): BModule =
|
||||||
result.forwardedProcs = @[]
|
result.forwardedProcs = @[]
|
||||||
result.typeNodesName = getTempName()
|
result.typeNodesName = getTempName()
|
||||||
result.nimTypesName = getTempName()
|
result.nimTypesName = getTempName()
|
||||||
result.PreventStackTrace = sfSystemModule in module.flags
|
# no line tracing for the init sections of the system module so that we
|
||||||
|
# don't generate a TFrame which can confuse the stack botton initialization:
|
||||||
|
if sfSystemModule in module.flags:
|
||||||
|
result.PreventStackTrace = true
|
||||||
|
excl(result.preInitProc.options, optStackTrace)
|
||||||
|
excl(result.postInitProc.options, optStackTrace)
|
||||||
|
|
||||||
proc nullify[T](arr: var T) =
|
proc nullify[T](arr: var T) =
|
||||||
for i in low(arr)..high(arr):
|
for i in low(arr)..high(arr):
|
||||||
|
|
@ -1155,7 +1163,7 @@ proc resetModule*(m: var BModule) =
|
||||||
m.declaredProtos = initIntSet()
|
m.declaredProtos = initIntSet()
|
||||||
initIdTable(m.forwTypeCache)
|
initIdTable(m.forwTypeCache)
|
||||||
m.initProc = newProc(nil, m)
|
m.initProc = newProc(nil, m)
|
||||||
m.initProc.options = gOptions
|
m.initProc.options = initProcOptions(m)
|
||||||
m.preInitProc = newPreInitProc(m)
|
m.preInitProc = newPreInitProc(m)
|
||||||
m.postInitProc = newPostInitProc(m)
|
m.postInitProc = newPostInitProc(m)
|
||||||
initNodeTable(m.dataCache)
|
initNodeTable(m.dataCache)
|
||||||
|
|
@ -1245,7 +1253,7 @@ proc myProcess(b: PPassContext, n: PNode): PNode =
|
||||||
result = n
|
result = n
|
||||||
if b == nil or passes.skipCodegen(n): return
|
if b == nil or passes.skipCodegen(n): return
|
||||||
var m = BModule(b)
|
var m = BModule(b)
|
||||||
m.initProc.options = gOptions
|
m.initProc.options = initProcOptions(m)
|
||||||
genStmts(m.initProc, n)
|
genStmts(m.initProc, n)
|
||||||
|
|
||||||
proc finishModule(m: BModule) =
|
proc finishModule(m: BModule) =
|
||||||
|
|
@ -1332,7 +1340,7 @@ proc myClose(b: PPassContext, n: PNode): PNode =
|
||||||
if b == nil or passes.skipCodegen(n): return
|
if b == nil or passes.skipCodegen(n): return
|
||||||
var m = BModule(b)
|
var m = BModule(b)
|
||||||
if n != nil:
|
if n != nil:
|
||||||
m.initProc.options = gOptions
|
m.initProc.options = initProcOptions(m)
|
||||||
genStmts(m.initProc, n)
|
genStmts(m.initProc, n)
|
||||||
# cached modules need to registered too:
|
# cached modules need to registered too:
|
||||||
registerModuleToMain(m.module)
|
registerModuleToMain(m.module)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue