diff options
author | Bung <crc32@qq.com> | 2023-08-04 01:56:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-03 19:56:05 +0200 |
commit | 6b913b4741df8c80b2d930643f6dc01300fc1e1e (patch) | |
tree | 82865cc50f3f1c0793ae70150d02cf37483f3b0f /compiler | |
parent | b40da812f7aa590ed16df54a492684c228320549 (diff) | |
download | Nim-6b913b4741df8c80b2d930643f6dc01300fc1e1e.tar.gz |
Revert "fix #22173 `sink` paramers not moved into closure (refc) (#22… (#22376)
Revert "fix #22173 `sink` paramers not moved into closure (refc) (#22359)" This reverts commit b40da812f7aa590ed16df54a492684c228320549.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgexprs.nim | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 8874f54ae..712b874d9 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -342,15 +342,12 @@ proc genAssignment(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) = if (dest.storage == OnStack and p.config.selectedGC != gcGo) or not usesWriteBarrier(p.config): linefmt(p, cpsStmts, "$1 = #copyString($2);$n", [dest.rdLoc, src.rdLoc]) elif dest.storage == OnHeap: - if dest.lode.typ.kind == tySink: - genRefAssign(p, dest, src) - else: - # we use a temporary to care for the dreaded self assignment: - var tmp: TLoc - getTemp(p, ty, tmp) - linefmt(p, cpsStmts, "$3 = $1; $1 = #copyStringRC1($2);$n", - [dest.rdLoc, src.rdLoc, tmp.rdLoc]) - linefmt(p, cpsStmts, "if ($1) #nimGCunrefNoCycle($1);$n", [tmp.rdLoc]) + # we use a temporary to care for the dreaded self assignment: + var tmp: TLoc + getTemp(p, ty, tmp) + linefmt(p, cpsStmts, "$3 = $1; $1 = #copyStringRC1($2);$n", + [dest.rdLoc, src.rdLoc, tmp.rdLoc]) + linefmt(p, cpsStmts, "if ($1) #nimGCunrefNoCycle($1);$n", [tmp.rdLoc]) else: linefmt(p, cpsStmts, "#unsureAsgnRef((void**) $1, #copyString($2));$n", [addrLoc(p.config, dest), rdLoc(src)]) |