summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-09-24 01:22:48 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-09-24 01:22:48 +0200
commite5cb1a2dd547827ee750abbb21039d1cf0a30988 (patch)
treee2b8215df2e9ca01697d75977342ac7949c8ba14 /lib
parentbe2e7290fb6e21569237a1230669985d3c317c78 (diff)
downloadNim-e5cb1a2dd547827ee750abbb21039d1cf0a30988.tar.gz
newSeqOfCap: skip initialization step for non-GC-ed data
Diffstat (limited to 'lib')
-rw-r--r--lib/system/mmdisp.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/system/mmdisp.nim b/lib/system/mmdisp.nim
index d2160fdac..824934966 100644
--- a/lib/system/mmdisp.nim
+++ b/lib/system/mmdisp.nim
@@ -564,7 +564,11 @@ else:
 
 when not declared(nimNewSeqOfCap):
   proc nimNewSeqOfCap(typ: PNimType, cap: int): pointer {.compilerproc.} =
-    result = newObj(typ, addInt(mulInt(cap, typ.base.size), GenericSeqSize))
+    let s = addInt(mulInt(cap, typ.base.size), GenericSeqSize)
+    when declared(newObjNoInit):
+      result = if ntfNoRefs in typ.base.flags: newObjNoInit(typ, s) else: newObj(typ, s)
+    else:
+      result = newObj(typ, s)
     cast[PGenericSeq](result).len = 0
     cast[PGenericSeq](result).reserved = cap