GC improvements; distinguish between thread local and globals in the marking step

This commit is contained in:
Araq 2018-01-14 17:34:27 +01:00
commit f71f9f83c2
8 changed files with 129 additions and 128 deletions

View file

@ -179,24 +179,38 @@ proc main() =
write(stdout, "done!\n")
var
father: TBNode
s: string
s = ""
s = ""
writeLine(stdout, repr(caseTree()))
father.t.data = @["ha", "lets", "stress", "it"]
father.t.data = @["ha", "lets", "stress", "it"]
var t = buildTree()
write(stdout, repr(t[]))
buildBTree(father)
write(stdout, repr(father))
father {.threadvar.}: TBNode
s {.threadvar.}: string
write(stdout, "starting main...\n")
main()
fatherAsGlobal: TBNode
GC_fullCollect()
# the M&S GC fails with this call and it's unclear why. Definitely something
# we need to fix!
GC_fullCollect()
writeLine(stdout, GC_getStatistics())
write(stdout, "finished\n")
proc start =
s = ""
s = ""
writeLine(stdout, repr(caseTree()))
father.t.data = @["ha", "lets", "stress", "it"]
father.t.data = @["ha", "lets", "stress", "it"]
var t = buildTree()
write(stdout, repr(t[]))
buildBTree(father)
write(stdout, repr(father))
write(stdout, "starting main...\n")
main()
GC_fullCollect()
# the M&S GC fails with this call and it's unclear why. Definitely something
# we need to fix!
#GC_fullCollect()
writeLine(stdout, GC_getStatistics())
write(stdout, "finished\n")
#fatherAsGlobal.t.data = @["ha", "lets", "stress", "it"]
#var tg = buildTree()
#buildBTree(fatherAsGlobal)
var thr: array[8, Thread[void]]
for i in low(thr)..high(thr):
createThread(thr[i], start)
joinThreads(thr)
start()

1
tests/gc/gctest.nim.cfg Normal file
View file

@ -0,0 +1 @@
--threads:on