Skip to content

Commit

Permalink
Revert "fix #22173 sink paramers not moved into closure (refc) (#22… (
Browse files Browse the repository at this point in the history
#22376)

Revert "fix #22173 `sink` paramers not moved into closure (refc) (#22359)"

This reverts commit b40da81.
  • Loading branch information
bung87 committed Aug 3, 2023
1 parent b40da81 commit 6b913b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
15 changes: 6 additions & 9 deletions compiler/ccgexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)])
Expand Down
20 changes: 0 additions & 20 deletions tests/gc/t22173.nim

This file was deleted.

0 comments on commit 6b913b4

Please sign in to comment.