diff options
author | Araq <rumpf_a@web.de> | 2013-12-20 00:02:04 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-12-20 00:02:04 +0100 |
commit | 4b0e391bb83ade40a049288d33bfff7aba2b0124 (patch) | |
tree | 307b36f5ce8ed71128bc6fe2d939eb06cc8d8d69 | |
parent | d46380e718a57476d2fb467ad8221a7857dcd486 (diff) | |
download | Nim-4b0e391bb83ade40a049288d33bfff7aba2b0124.tar.gz |
no stack tracing for the system module; fixes stack bottom detection
-rw-r--r-- | compiler/cgen.nim | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index c143a5d6a..6ccef5fde 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -1122,6 +1122,9 @@ proc newPostInitProc(m: BModule): BProc = # little hack so that unique temporaries are generated: 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 = new(result) InitLinkedList(result.headerFiles) @@ -1134,7 +1137,7 @@ proc rawNewModule(module: PSym, filename: string): BModule = result.module = module result.typeInfoMarker = initIntSet() result.initProc = newProc(nil, result) - result.initProc.options = gOptions + result.initProc.options = initProcOptions(result) result.preInitProc = newPreInitProc(result) result.postInitProc = newPostInitProc(result) initNodeTable(result.dataCache) @@ -1142,7 +1145,12 @@ proc rawNewModule(module: PSym, filename: string): BModule = result.forwardedProcs = @[] result.typeNodesName = 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) = for i in low(arr)..high(arr): @@ -1155,7 +1163,7 @@ proc resetModule*(m: var BModule) = m.declaredProtos = initIntSet() initIdTable(m.forwTypeCache) m.initProc = newProc(nil, m) - m.initProc.options = gOptions + m.initProc.options = initProcOptions(m) m.preInitProc = newPreInitProc(m) m.postInitProc = newPostInitProc(m) initNodeTable(m.dataCache) @@ -1245,7 +1253,7 @@ proc myProcess(b: PPassContext, n: PNode): PNode = result = n if b == nil or passes.skipCodegen(n): return var m = BModule(b) - m.initProc.options = gOptions + m.initProc.options = initProcOptions(m) genStmts(m.initProc, n) proc finishModule(m: BModule) = @@ -1332,7 +1340,7 @@ proc myClose(b: PPassContext, n: PNode): PNode = if b == nil or passes.skipCodegen(n): return var m = BModule(b) if n != nil: - m.initProc.options = gOptions + m.initProc.options = initProcOptions(m) genStmts(m.initProc, n) # cached modules need to registered too: registerModuleToMain(m.module) |