diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-03-19 22:58:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 22:58:16 +0100 |
commit | 35fb38629f2f56d15afea15ba8597f18e2794229 (patch) | |
tree | 4391789c10dcfa7afce5de1744dcde51da33fc68 /compiler/liftdestructors.nim | |
parent | 705e283fef845a7dd78a2f0e241b1ad0f05490d3 (diff) | |
download | Nim-35fb38629f2f56d15afea15ba8597f18e2794229.tar.gz |
cycle breaker (#13593)
* cycle breaking as an alternative to cycle detection
Diffstat (limited to 'compiler/liftdestructors.nim')
-rw-r--r-- | compiler/liftdestructors.nim | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/liftdestructors.nim b/compiler/liftdestructors.nim index 377ba149a..9a91ec2e9 100644 --- a/compiler/liftdestructors.nim +++ b/compiler/liftdestructors.nim @@ -484,10 +484,10 @@ proc atomicRefOp(c: var TLiftCtx; t: PType; body, x, y: PNode) = if isFinal(elemType): let typInfo = genBuiltin(c.g, mGetTypeInfo, "getTypeInfo", newNodeIT(nkType, x.info, elemType)) typInfo.typ = getSysType(c.g, c.info, tyPointer) - body.add callCodegenProc(c.g, "nimTraceRef", c.info, x, typInfo, y) + body.add callCodegenProc(c.g, "nimTraceRef", c.info, genAddrOf(x), typInfo, y) else: # If the ref is polymorphic we have to account for this - body.add callCodegenProc(c.g, "nimTraceRefDyn", c.info, x, y) + body.add callCodegenProc(c.g, "nimTraceRefDyn", c.info, genAddrOf(x), y) of attachedDispose: # this is crucial! dispose is like =destroy but we don't follow refs # as that is dealt within the cycle collector. @@ -530,7 +530,7 @@ proc atomicClosureOp(c: var TLiftCtx; t: PType; body, x, y: PNode) = body.add genIf(c, cond, actions) of attachedDeepCopy: assert(false, "cannot happen") of attachedTrace: - body.add callCodegenProc(c.g, "nimTraceRefDyn", c.info, xenv, y) + body.add callCodegenProc(c.g, "nimTraceRefDyn", c.info, genAddrOf(xenv), y) of attachedDispose: # this is crucial! dispose is like =destroy but we don't follow refs # as that is dealt within the cycle collector. @@ -778,7 +778,6 @@ proc produceSym(g: ModuleGraph; c: PContext; typ: PType; kind: TTypeAttachedOp; # register this operation already: typ.attachedOps[kind] = result - if kind == attachedSink and typ.attachedOps[attachedDestructor] != nil and sfOverriden in typ.attachedOps[attachedDestructor].flags: ## compiler can use a combination of `=destroy` and memCopy for sink op |