gc: destructors is beginning to work (#10483)
* kochdocs.nim: code cleanup * docgen: nicer indentation * parser.nim: code cleanup * fixes #10458 * make tests green again * make =destroy mixins * gc:destructors: produced C code is almost working * --gc:destructors simple program compiles (but leaks memory) * gc:destructors make examples compile in C++ mode * destructors: string implementation bugfixes * strs.nim: minor code cleanup * destructors: builtin seqs are beginning to work * remove debugging helpers
This commit is contained in:
parent
15422a3e5a
commit
dee8e6e98a
19 changed files with 162 additions and 101 deletions
|
|
@ -460,7 +460,7 @@ proc binaryStmtAddr(p: BProc, e: PNode, d: var TLoc, frmt: string) =
|
|||
if d.k != locNone: internalError(p.config, e.info, "binaryStmtAddr")
|
||||
initLocExpr(p, e.sons[1], a)
|
||||
initLocExpr(p, e.sons[2], b)
|
||||
lineCg(p, cpsStmts, frmt, addrLoc(p.config, a), rdLoc(b))
|
||||
lineCg(p, cpsStmts, frmt, byRefLoc(p, a), rdLoc(b))
|
||||
|
||||
proc unaryStmt(p: BProc, e: PNode, d: var TLoc, frmt: string) =
|
||||
var a: TLoc
|
||||
|
|
@ -1028,7 +1028,7 @@ proc gcUsage(conf: ConfigRef; n: PNode) =
|
|||
|
||||
proc strLoc(p: BProc; d: TLoc): Rope =
|
||||
if p.config.selectedGc == gcDestructors:
|
||||
result = addrLoc(p.config, d)
|
||||
result = byRefLoc(p, d)
|
||||
else:
|
||||
result = rdLoc(d)
|
||||
|
||||
|
|
@ -1110,7 +1110,7 @@ proc genStrAppend(p: BProc, e: PNode, d: var TLoc) =
|
|||
strLoc(p, dest), rdLoc(a)))
|
||||
if p.config.selectedGC == gcDestructors:
|
||||
linefmt(p, cpsStmts, "#prepareAdd($1, $2$3);$n",
|
||||
addrLoc(p.config, dest), lens, rope(L))
|
||||
byRefLoc(p, dest), lens, rope(L))
|
||||
else:
|
||||
initLoc(call, locCall, e, OnHeap)
|
||||
call.r = ropecg(p.module, "#resizeString($1, $2$3)", [rdLoc(dest), lens, rope(L)])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue