summary refs log tree commit diff stats
path: root/lib/system/gc2.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-09-22 11:12:14 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-09-22 11:12:14 +0200
commit07531b41b9a3f1441c66ee157138915b34789ec1 (patch)
tree2146596e09b4e620aac3f30e1d6d348b374d27cf /lib/system/gc2.nim
parentdcfafb32890e1b6eddd081683d6a52cca4881213 (diff)
downloadNim-07531b41b9a3f1441c66ee157138915b34789ec1.tar.gz
make gc:v2 compile again
Diffstat (limited to 'lib/system/gc2.nim')
-rw-r--r--lib/system/gc2.nim20
1 files changed, 6 insertions, 14 deletions
diff --git a/lib/system/gc2.nim b/lib/system/gc2.nim
index 083c06fe3..68da65727 100644
--- a/lib/system/gc2.nim
+++ b/lib/system/gc2.nim
@@ -69,7 +69,7 @@ type
     maxStackCells: int       # max stack cells in ``decStack``
     cycleTableSize: int      # max entries in cycle table
     maxPause: int64          # max measured GC pause in nanoseconds
-  
+
   GcStack {.final, pure.} = object
     when nimCoroutines:
       prev: ptr GcStack
@@ -220,17 +220,6 @@ else:
     x <% rcIncrement
   template `++`(x: expr): stmt = inc(x, rcIncrement)
 
-proc prepareDealloc(cell: PCell) =
-  if cell.typ.finalizer != nil:
-    # the finalizer could invoke something that
-    # allocates memory; this could trigger a garbage
-    # collection. Since we are already collecting we
-    # prevend recursive entering here by a lock.
-    # XXX: we should set the cell's children to nil!
-    inc(gch.recGcLock)
-    (cast[Finalizer](cell.typ.finalizer))(cellToUsr(cell))
-    dec(gch.recGcLock)
-
 proc rtlAddCycleRoot(c: PCell) {.rtl, inl.} =
   # we MUST access gch as a global here, because this crosses DLL boundaries!
   discard
@@ -249,6 +238,9 @@ proc incRef(c: PCell) {.inline.} =
   gcAssert(isAllocatedPtr(gch.region, c), "incRef: interiorPtr")
   c.refcount = c.refcount +% rcIncrement
 
+proc nimGCunrefRC1(p: pointer) {.compilerProc, inline.} =
+  decRef(usrToCell(p))
+
 proc nimGCref(p: pointer) {.compilerProc.} =
   let cell = usrToCell(p)
   incRef(cell)
@@ -665,6 +657,8 @@ proc GC_dumpHeap() =
 
 # ---------------- cycle collector -------------------------------------------
 
+include gc_common
+
 proc freeCyclicCell(gch: var GcHeap, c: PCell) =
   gcAssert(isAllocatedPtr(gch.region, c), "freeCyclicCell: freed pointer?")
 
@@ -859,8 +853,6 @@ proc gcMark(gch: var GcHeap, p: pointer) {.inline.} =
       add(gch.decStack, objStart)
   sysAssert(allocInv(gch.region), "gcMark end")
 
-include gc_common
-
 proc markStackAndRegisters(gch: var GcHeap) {.noinline, cdecl.} =
   forEachStackSlot(gch, gcMark)