summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system')
-rwxr-xr-xlib/system/gc.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/system/gc.nim b/lib/system/gc.nim
index eb4811bf5..950b60c27 100755
--- a/lib/system/gc.nim
+++ b/lib/system/gc.nim
@@ -642,7 +642,11 @@ proc unmarkStackAndRegisters(gch: var TGcHeap) =
   var d = gch.decStack.d
   for i in 0..gch.decStack.len-1:
     assert isAllocatedPtr(allocator, d[i])
-    decRef(d[i]) # OPT: cannot create a cycle!
+    # decRef(d[i]) inlined: cannot create a cycle
+    var c = d[i]
+    if atomicDec(c.refcount, rcIncrement) <% rcIncrement:
+      rtlAddZCT(c)
+    assert c.typ != nil
   gch.decStack.len = 0
 
 proc collectCT(gch: var TGcHeap) =