summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2017-12-08 10:06:36 +0100
committerAraq <rumpf_a@web.de>2017-12-08 10:06:36 +0100
commit4be45f5913de93e403ed14b8665037092bb378b4 (patch)
tree5b6e8c1d8f67ecd24979455667e9fe855041aa1a /lib/system
parent9820c2c4561ee56f30c1578672dd1247be25cb11 (diff)
parente016c9253e7b02ad4781452067dad980c677f61e (diff)
downloadNim-4be45f5913de93e403ed14b8665037092bb378b4.tar.gz
Merge branch 'devel' of github.com:nim-lang/Nim into devel
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/sysstr.nim11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim
index 3f8e0eff0..56b8ade97 100644
--- a/lib/system/sysstr.nim
+++ b/lib/system/sysstr.nim
@@ -259,7 +259,7 @@ proc incrSeqV2(seq: PGenericSeq, elemSize: int): PGenericSeq {.compilerProc.} =
     result.reserved = r
 
 proc setLengthSeq(seq: PGenericSeq, elemSize, newLen: int): PGenericSeq {.
-    compilerRtl.} =
+    compilerRtl, inl.} =
   result = seq
   if result.space < newLen:
     let r = max(resize(result.space), newLen)
@@ -282,10 +282,11 @@ proc setLengthSeq(seq: PGenericSeq, elemSize, newLen: int): PGenericSeq {.
             doDecRef(gch.tempStack.d[i], LocalHeap, MaybeCyclic)
           gch.tempStack.len = len0
       else:
-        for i in newLen..result.len-1:
-          forAllChildrenAux(cast[pointer](cast[ByteAddress](result) +%
-                            GenericSeqSize +% (i*%elemSize)),
-                            extGetCellType(result).base, waZctDecRef)
+        if ntfNoRefs notin extGetCellType(result).base.flags:
+          for i in newLen..result.len-1:
+            forAllChildrenAux(cast[pointer](cast[ByteAddress](result) +%
+                              GenericSeqSize +% (i*%elemSize)),
+                              extGetCellType(result).base, waZctDecRef)
 
     # XXX: zeroing out the memory can still result in crashes if a wiped-out
     # cell is aliased by another pointer (ie proc parameter or a let variable).