GC: incRef needs to add cycleroots
This commit is contained in:
parent
68135b3b50
commit
5e7dd69b00
2 changed files with 5 additions and 6 deletions
|
|
@ -18,9 +18,6 @@
|
||||||
# for soft real time applications (like games).
|
# for soft real time applications (like games).
|
||||||
{.push profiler:off.}
|
{.push profiler:off.}
|
||||||
|
|
||||||
# XXX there is still a slight chance of leaking cycles as we don't add cycle
|
|
||||||
# candidates in 'incRef'
|
|
||||||
|
|
||||||
const
|
const
|
||||||
CycleIncrease = 2 # is a multiplicative increase
|
CycleIncrease = 2 # is a multiplicative increase
|
||||||
InitialCycleThreshold = 4*1024*1024 # X MB because cycle checking is slow
|
InitialCycleThreshold = 4*1024*1024 # X MB because cycle checking is slow
|
||||||
|
|
@ -201,10 +198,11 @@ proc decRef(c: PCell) {.inline.} =
|
||||||
|
|
||||||
proc incRef(c: PCell) {.inline.} =
|
proc incRef(c: PCell) {.inline.} =
|
||||||
gcAssert(isAllocatedPtr(gch.region, c), "incRef: interiorPtr")
|
gcAssert(isAllocatedPtr(gch.region, c), "incRef: interiorPtr")
|
||||||
c.refcount = c.refCount +% rcIncrement and not colorMask
|
c.refcount = c.refCount +% rcIncrement
|
||||||
|
# and not colorMask
|
||||||
#writeCell("incRef", c)
|
#writeCell("incRef", c)
|
||||||
#if canBeCycleRoot(c):
|
if canBeCycleRoot(c):
|
||||||
# rtlAddCycleRoot(c)
|
rtlAddCycleRoot(c)
|
||||||
|
|
||||||
proc nimGCref(p: pointer) {.compilerProc, inline.} = incRef(usrToCell(p))
|
proc nimGCref(p: pointer) {.compilerProc, inline.} = incRef(usrToCell(p))
|
||||||
proc nimGCunref(p: pointer) {.compilerProc, inline.} = decRef(usrToCell(p))
|
proc nimGCunref(p: pointer) {.compilerProc, inline.} = decRef(usrToCell(p))
|
||||||
|
|
|
||||||
1
todo.txt
1
todo.txt
|
|
@ -1,6 +1,7 @@
|
||||||
version 0.9.2
|
version 0.9.2
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
- acyclic vs prunable; introduce GC hints
|
||||||
- implement constructors + full 'not nil' checking
|
- implement constructors + full 'not nil' checking
|
||||||
- ``restrict`` pragma + backend support
|
- ``restrict`` pragma + backend support
|
||||||
- fix: 'result' is not properly cleaned for NRVO
|
- fix: 'result' is not properly cleaned for NRVO
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue