summary refs log tree commit diff stats
path: root/lib/system/gc.nim
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2022-09-20 20:59:50 +0800
committerGitHub <noreply@github.com>2022-09-20 14:59:50 +0200
commit4a1bda667c74361c121460ca7d80cfcbf003d8d7 (patch)
treec6ccfddb12c6bb57d05031079a2966dc8c0e8e0e /lib/system/gc.nim
parent3dc302662e2665a0c1467a290c689f40d8a2e263 (diff)
downloadNim-4a1bda667c74361c121460ca7d80cfcbf003d8d7.tar.gz
turn nimIncrSeqV3 into deadcode (#20388)
Diffstat (limited to 'lib/system/gc.nim')
-rw-r--r--lib/system/gc.nim31
1 files changed, 2 insertions, 29 deletions
diff --git a/lib/system/gc.nim b/lib/system/gc.nim
index e50e80f11..4ab76c05e 100644
--- a/lib/system/gc.nim
+++ b/lib/system/gc.nim
@@ -561,35 +561,8 @@ proc growObj(old: pointer, newsize: int, gch: var GcHeap): pointer =
   gcTrace(res, csAllocated)
   track("growObj old", ol, 0)
   track("growObj new", res, newsize)
-  when defined(nimIncrSeqV3):
-    # since we steal the old seq's contents, we set the old length to 0.
-    cast[PGenericSeq](old).len = 0
-  elif reallyDealloc:
-    sysAssert(allocInv(gch.region), "growObj before dealloc")
-    if ol.refcount shr rcShift <=% 1:
-      # free immediately to save space:
-      if (ol.refcount and ZctFlag) != 0:
-        var j = gch.zct.len-1
-        var d = gch.zct.d
-        while j >= 0:
-          if d[j] == ol:
-            d[j] = res
-            break
-          dec(j)
-      beforeDealloc(gch, ol, "growObj stack trash")
-      decTypeSize(ol, ol.typ)
-      rawDealloc(gch.region, ol)
-    else:
-      # we split the old refcount in 2 parts. XXX This is still not entirely
-      # correct if the pointer that receives growObj's result is on the stack.
-      # A better fix would be to emit the location specific write barrier for
-      # 'growObj', but this is lots of more work and who knows what new problems
-      # this would create.
-      res.refcount = rcIncrement
-      decRef(ol)
-  else:
-    sysAssert(ol.typ != nil, "growObj: 5")
-    zeroMem(ol, sizeof(Cell))
+  # since we steal the old seq's contents, we set the old length to 0.
+  cast[PGenericSeq](old).len = 0
   when useCellIds:
     inc gch.idGenerator
     res.id = gch.idGenerator * 1000_000 + gch.gcThreadId