diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-12-17 17:37:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-17 17:37:50 +0100 |
commit | 83a736a34a1ebd4bc4d769429880ccb871403ba4 (patch) | |
tree | 1a45de64686622fe9932daafb5345fdd066cab48 /compiler/injectdestructors.nim | |
parent | 5848f0042c2d6a6dd39d9b8db747f36200c9f543 (diff) | |
download | Nim-83a736a34a1ebd4bc4d769429880ccb871403ba4.tar.gz |
ARC: cycle detector (#12823)
* first implementation of the =trace and =dispose hooks for the cycle collector * a cycle collector for ARC: progress * manual: the .acyclic pragma is a thing once again * gcbench: adaptations for --gc:arc * enable valgrind tests for the strutils tests * testament: better valgrind support * ARC refactoring: growable jumpstacks * ARC cycle detector: non-recursive algorithm * moved and renamed core/ files back to system/ * refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish
Diffstat (limited to 'compiler/injectdestructors.nim')
-rw-r--r-- | compiler/injectdestructors.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index 18fb0f5c8..0acf7fac2 100644 --- a/compiler/injectdestructors.nim +++ b/compiler/injectdestructors.nim @@ -218,7 +218,7 @@ proc genCopyNoCheck(c: Con; dest, ri: PNode): PNode = proc genCopy(c: var Con; dest, ri: PNode): PNode = let t = dest.typ - if tfHasOwned in t.flags: + if tfHasOwned in t.flags and ri.kind != nkNilLit: # try to improve the error message here: if c.otherRead == nil: discard isLastRead(ri, c) checkForErrorPragma(c, t, ri, "=") @@ -409,7 +409,7 @@ proc isCursor(n: PNode): bool = result = false proc cycleCheck(n: PNode; c: var Con) = - if c.graph.config.selectedGC != gcDestructors: return + if c.graph.config.selectedGC != gcArc: return var value = n[1] if value.kind == nkClosure: value = value[1] @@ -512,7 +512,7 @@ proc p(n: PNode; c: var Con; mode: ProcessMode): PNode = result[i] = p(n[i], c, normal) if n[0].kind == nkSym and n[0].sym.magic in {mNew, mNewFinalize}: result[0] = copyTree(n[0]) - if c.graph.config.selectedGC in {gcHooks, gcDestructors}: + if c.graph.config.selectedGC in {gcHooks, gcArc, gcOrc}: let destroyOld = genDestroy(c, result[1]) result = newTree(nkStmtList, destroyOld, result) else: |