summary refs log tree commit diff stats
path: root/lib/system/orc.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system/orc.nim')
-rw-r--r--lib/system/orc.nim13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/system/orc.nim b/lib/system/orc.nim
index 83b983ee1..a56a0c057 100644
--- a/lib/system/orc.nim
+++ b/lib/system/orc.nim
@@ -485,6 +485,19 @@ proc nimDecRefIsLastCyclicDyn(p: pointer): bool {.compilerRtl, inl.} =
     #if cell.color == colPurple:
     rememberCycle(result, cell, cast[ptr PNimTypeV2](p)[])
 
+proc nimDecRefIsLastDyn(p: pointer): bool {.compilerRtl, inl.} =
+  if p != nil:
+    var cell = head(p)
+    if (cell.rc and not rcMask) == 0:
+      result = true
+      #cprintf("[DESTROY] %p\n", p)
+    else:
+      dec cell.rc, rcIncrement
+    #if cell.color == colPurple:
+    if result:
+      if cell.rootIdx > 0:
+        unregisterCycle(cell)
+
 proc nimDecRefIsLastCyclicStatic(p: pointer; desc: PNimTypeV2): bool {.compilerRtl, inl.} =
   if p != nil:
     var cell = head(p)
a@web.de> 2017-03-29 10:14:03 +0200 committer Andreas Rumpf <rumpf_a@web.de> 2017-03-29 10:14:03 +0200 attempt to make travis OSX tests green and mandatory' href='/ahoang/Nim/commit/.travis.yml?h=devel&id=3ffde39cf416579144d37021f24c99e49efc0aee'>3ffde39cf ^
434bdbe3e ^
3ffde39cf ^
1c6c87f47 ^
363b1c0a4 ^
8f6a275f4 ^

fbe7bf3c8 ^
243e66596 ^


e9fc86597 ^
96c571dd9 ^
a01fd5e93 ^

c525dfabc ^

31a41594c ^
c1c3c4c5d ^
633dcca71 ^
5b9465acf ^

299b04491 ^
c1c76a20e ^
931496770 ^

e8f7d605f ^
ee08c6eec ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48