From 20d56875de743d23988a2b0d6a17709e899881c9 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Sun, 15 Apr 2012 02:52:09 +0300 Subject: fix threading tests --- compiler/ccgthreadvars.nim | 5 +++-- compiler/cgendata.nim | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/ccgthreadvars.nim b/compiler/ccgthreadvars.nim index 94c34d13c..38c5c0f5e 100755 --- a/compiler/ccgthreadvars.nim +++ b/compiler/ccgthreadvars.nim @@ -19,8 +19,9 @@ proc AccessThreadLocalVar(p: BProc, s: PSym) = if emulatedThreadVars() and not p.ThreadVarAccessed: p.ThreadVarAccessed = true p.module.usesThreadVars = true - appf(p.s(cpsLocals), "NimThreadVars* NimTV;$n") - appcg(p, cpsInit, "NimTV=(NimThreadVars*)#GetThreadLocalVars();$n") + appf(p.procSec(cpsLocals), "NimThreadVars* NimTV;$n") + app(p.procSec(cpsInit), + ropecg(p.module, "NimTV=(NimThreadVars*)#GetThreadLocalVars();$n")) var nimtv: PRope # nimrod thread vars; the struct body diff --git a/compiler/cgendata.nim b/compiler/cgendata.nim index 43aaf7068..f1463bbdc 100644 --- a/compiler/cgendata.nim +++ b/compiler/cgendata.nim @@ -116,8 +116,13 @@ var gForwardedProcsCounter*: int = 0 gNimDat*: BModule # generated global data -proc s*(prc: BProc, s: TCProcSection): var PRope {.inline.} = - result = prc.blocks[prc.blocks.len - 1].sections[s] +proc s*(p: BProc, s: TCProcSection): var PRope {.inline.} = + # section in the current block + result = p.blocks[p.blocks.len - 1].sections[s] + +proc procSec*(p: BProc, s: TCProcSection): var PRope {.inline.} = + # top level proc sections + result = p.blocks[0].sections[s] proc newProc*(prc: PSym, module: BModule): BProc = new(result) -- cgit 1.4.1-2-gfad0