GC v2 compiles again
This commit is contained in:
parent
6dd0887009
commit
9b609b26ca
1 changed files with 8 additions and 0 deletions
|
|
@ -97,6 +97,8 @@ type
|
|||
additionalRoots: CellSeq # dummy roots for GC_ref/unref
|
||||
spaceIter: ObjectSpaceIter
|
||||
dumpHeapFile: File # File that is used for GC_dumpHeap
|
||||
when hasThreadSupport:
|
||||
toDispose: SharedList[pointer]
|
||||
|
||||
var
|
||||
gch {.rtlThreadVar.}: GcHeap
|
||||
|
|
@ -119,6 +121,8 @@ proc initGC() =
|
|||
init(gch.decStack)
|
||||
init(gch.additionalRoots)
|
||||
init(gch.greyStack)
|
||||
when hasThreadSupport:
|
||||
gch.toDispose = initSharedList[pointer]()
|
||||
|
||||
# Which color to use for new objects is tricky: When we're marking,
|
||||
# they have to be *white* so that everything is marked that is only
|
||||
|
|
@ -800,6 +804,10 @@ proc nimGCvisit(d: pointer, op: int) {.compilerRtl.} =
|
|||
proc collectZCT(gch: var GcHeap): bool {.benign.}
|
||||
|
||||
proc collectCycles(gch: var GcHeap): bool =
|
||||
when hasThreadSupport:
|
||||
for c in gch.toDispose:
|
||||
nimGCunref(c)
|
||||
|
||||
# ensure the ZCT 'color' is not used:
|
||||
while gch.zct.len > 0: discard collectZCT(gch)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue