IC: next steps (#16729)

* IC: dead code elimination pass
* preparations for a different codegen strategy
* added documentation to the newly written code
* IC: backend code
* IC: backend adjustments
* optimized the compiler a bit
* IC: yet another massive refactoring
* fixes regressions
* cleanups
This commit is contained in:
Andreas Rumpf 2021-01-23 08:06:15 +01:00 • committed by GitHub
commit 8241e55023
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 729 additions and 323 deletions

View file

@ -382,6 +382,8 @@ proc semUnown(c: PContext; n: PNode): PNode =
let b = unownedType(c, t[^1])
if b != t[^1]:
result = copyType(t, nextTypeId c.idgen, t.owner)
copyTypeProps(c.graph, c.idgen.module, result, t)
result[^1] = b
result.flags.excl tfHasOwned
else:
@ -541,7 +543,8 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
# check if we converted this finalizer into a destructor already:
let t = whereToBindTypeHook(c, fin.typ[1].skipTypes(abstractInst+{tyRef}))
if t != nil and t.attachedOps[attachedDestructor] != nil and t.attachedOps[attachedDestructor].owner == fin:
if t != nil and getAttachedOp(c.graph, t, attachedDestructor) != nil and
getAttachedOp(c.graph, t, attachedDestructor).owner == fin:
discard "already turned this one into a finalizer"
else:
bindTypeHook(c, turnFinalizerIntoDestructor(c, fin, n.info), n, attachedDestructor)
@ -549,8 +552,9 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
of mDestroy:
result = n
let t = n[1].typ.skipTypes(abstractVar)
if t.destructor != nil:
result[0] = newSymNode(t.destructor)
let op = getAttachedOp(c.graph, t, attachedDestructor)
if op != nil:
result[0] = newSymNode(op)
of mUnown:
result = semUnown(c, n)
of mExists, mForall: