first steps to thread local heaps
This commit is contained in:
parent
d0bfc3665f
commit
3260702a60
21 changed files with 1072 additions and 633 deletions
|
|
@ -431,9 +431,18 @@ proc assignLocalVar(p: BProc, s: PSym) =
|
|||
|
||||
proc declareThreadVar(m: BModule, s: PSym) =
|
||||
if optThreads in gGlobalOptions:
|
||||
app(m.s[cfsVars], "NIM_THREADVAR ")
|
||||
app(m.s[cfsVars], getTypeDesc(m, s.loc.t))
|
||||
|
||||
if platform.OS[targetOS].props.contains(ospLacksThreadVars):
|
||||
# we gather all thread locals var into a struct and put that into
|
||||
# nim__dat.c; we need to allocate storage for that somehow, can't use
|
||||
# the thread local storage allocator for it :-(
|
||||
# XXX we need to adapt expr() too, every reference to a thread local var
|
||||
# generates quite some code ...
|
||||
InternalError("no workaround for lack of thread local vars implemented")
|
||||
else:
|
||||
app(m.s[cfsVars], "NIM_THREADVAR ")
|
||||
app(m.s[cfsVars], getTypeDesc(m, s.loc.t))
|
||||
else:
|
||||
app(m.s[cfsVars], getTypeDesc(m, s.loc.t))
|
||||
|
||||
proc assignGlobalVar(p: BProc, s: PSym) =
|
||||
if s.loc.k == locNone:
|
||||
|
|
@ -640,8 +649,8 @@ proc genProcAux(m: BModule, prc: PSym) =
|
|||
assignParam(p, param)
|
||||
genStmts(p, prc.ast.sons[codePos]) # modifies p.locals, p.init, etc.
|
||||
if sfPure in prc.flags:
|
||||
generatedProc = ropeff("$1 {$n$2$3$4}$n", "define $1 {$n$2$3$4}$n", [header,
|
||||
p.s[cpsLocals], p.s[cpsInit], p.s[cpsStmts]])
|
||||
generatedProc = ropeff("$1 {$n$2$3$4}$n", "define $1 {$n$2$3$4}$n",
|
||||
[header, p.s[cpsLocals], p.s[cpsInit], p.s[cpsStmts]])
|
||||
else:
|
||||
generatedProc = ropeff("$1 {$n", "define $1 {$n", [header])
|
||||
if optStackTrace in prc.options:
|
||||
|
|
@ -756,7 +765,8 @@ proc getFileHeader(cfilenoext: string): PRope =
|
|||
"; (c) 2011 Andreas Rumpf$n", [toRope(versionAsString)])
|
||||
else:
|
||||
result = ropeff("/* Generated by Nimrod Compiler v$1 */$n" &
|
||||
"/* (c) 2011 Andreas Rumpf */$n" & "/* Compiled for: $2, $3, $4 */$n" &
|
||||
"/* (c) 2011 Andreas Rumpf */$n" &
|
||||
"/* Compiled for: $2, $3, $4 */$n" &
|
||||
"/* Command for C compiler:$n $5 */$n",
|
||||
"; Generated by Nimrod Compiler v$1$n" &
|
||||
"; (c) 2011 Andreas Rumpf$n" & "; Compiled for: $2, $3, $4$n" &
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue