diff options
author | Zahary Karadjov <zahary@gmail.com> | 2012-04-15 02:52:09 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2012-04-15 02:52:09 +0300 |
commit | 20d56875de743d23988a2b0d6a17709e899881c9 (patch) | |
tree | 2568a62a301637a0632cec68fc2a1b7ec5cc662b | |
parent | 567b5b07ea4d7400b4e24822f6d4d6328e9bd2ec (diff) | |
download | Nim-20d56875de743d23988a2b0d6a17709e899881c9.tar.gz |
fix threading tests
-rwxr-xr-x | compiler/ccgthreadvars.nim | 5 | ||||
-rw-r--r-- | 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) |