mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-29 19:57:58 +00:00
* fixes #15076 * heapqueue: optimized for ARC * added another test case [backport:1.4] * code cleanup
This commit is contained in:
@@ -37,7 +37,7 @@ type
|
||||
g: ControlFlowGraph
|
||||
graph: ModuleGraph
|
||||
otherRead: PNode
|
||||
inLoop, inSpawn: int
|
||||
inLoop, inSpawn, inLoopCond: int
|
||||
uninit: IntSet # set of uninit'ed vars
|
||||
uninitComputed: bool
|
||||
idgen: IdGenerator
|
||||
@@ -296,8 +296,8 @@ proc isNoInit(dest: PNode): bool {.inline.} =
|
||||
result = dest.kind == nkSym and sfNoInit in dest.sym.flags
|
||||
|
||||
proc genSink(c: var Con; dest, ri: PNode, isDecl = false): PNode =
|
||||
if isUnpackedTuple(dest) or isDecl or
|
||||
(isAnalysableFieldAccess(dest, c.owner) and isFirstWrite(dest, c)) or
|
||||
if (c.inLoopCond == 0 and (isUnpackedTuple(dest) or isDecl or
|
||||
(isAnalysableFieldAccess(dest, c.owner) and isFirstWrite(dest, c)))) or
|
||||
isNoInit(dest):
|
||||
# optimize sink call into a bitwise memcopy
|
||||
result = newTree(nkFastAsgn, dest, ri)
|
||||
@@ -629,8 +629,10 @@ template handleNestedTempl(n, processCall: untyped, willProduceStmt = false) =
|
||||
|
||||
of nkWhileStmt:
|
||||
inc c.inLoop
|
||||
inc c.inLoopCond
|
||||
result = copyNode(n)
|
||||
result.add p(n[0], c, s, normal)
|
||||
dec c.inLoopCond
|
||||
var bodyScope = nestedScope(s)
|
||||
let bodyResult = p(n[1], c, bodyScope, normal)
|
||||
result.add processScope(c, bodyScope, bodyResult)
|
||||
|
||||
Reference in New Issue
Block a user