fix threading tests

This commit is contained in:
Zahary Karadjov 2012-04-15 02:52:09 +03:00
commit 20d56875de
2 changed files with 10 additions and 4 deletions

View file

@ -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

View file

@ -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)