diff options
author | Araq <rumpf_a@web.de> | 2019-05-08 12:45:19 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-05-08 12:47:09 +0200 |
commit | ac670a49c049736546f0a8ed4fd821521ef49347 (patch) | |
tree | 0c425823daa35583600d2e6b6ee8c0f131e85517 | |
parent | 3d9269195fe678a92079dff1c5d364da4d3d3db3 (diff) | |
download | Nim-ac670a49c049736546f0a8ed4fd821521ef49347.tar.gz |
no 'defers' in my backend
-rw-r--r-- | compiler/ccgstmts.nim | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 81b87fd4a..2a98e812f 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -83,18 +83,6 @@ proc genVarTuple(p: BProc, n: PNode) = # check with the boolean if the initializing code for the tuple should be ran lineCg(p, cpsStmts, "if ($1)$n", [hcrCond]) startBlock(p) - defer: - if forHcr: - # end the block where the tuple gets initialized - endBlock(p) - if forHcr or isGlobalInBlock: - # insert the registration of the globals for the different parts of the tuple at the - # start of the current scope (after they have been iterated) and init a boolean to - # check if any of them is newly introduced and the initializing code has to be ran - lineCg(p, cpsLocals, "NIM_BOOL $1 = NIM_FALSE;$n", [hcrCond]) - for curr in hcrGlobals: - lineCg(p, cpsLocals, "$1 |= hcrRegisterGlobal($4, \"$2\", sizeof($3), $5, (void**)&$2);$N", - [hcrCond, curr.loc.r, rdLoc(curr.loc), getModuleDllPath(p.module, n.sons[0].sym), curr.tp]) genLineDir(p, n) initLocExpr(p, n.sons[L-1], tup) @@ -123,6 +111,19 @@ proc genVarTuple(p: BProc, n: PNode) = if forHcr or isGlobalInBlock: hcrGlobals.add((loc: v.loc, tp: if traverseProc == nil: ~"NULL" else: traverseProc)) + if forHcr: + # end the block where the tuple gets initialized + endBlock(p) + if forHcr or isGlobalInBlock: + # insert the registration of the globals for the different parts of the tuple at the + # start of the current scope (after they have been iterated) and init a boolean to + # check if any of them is newly introduced and the initializing code has to be ran + lineCg(p, cpsLocals, "NIM_BOOL $1 = NIM_FALSE;$n", [hcrCond]) + for curr in hcrGlobals: + lineCg(p, cpsLocals, "$1 |= hcrRegisterGlobal($4, \"$2\", sizeof($3), $5, (void**)&$2);$N", + [hcrCond, curr.loc.r, rdLoc(curr.loc), getModuleDllPath(p.module, n.sons[0].sym), curr.tp]) + + proc loadInto(p: BProc, le, ri: PNode, a: var TLoc) {.inline.} = if ri.kind in nkCallKinds and (ri.sons[0].kind != nkSym or ri.sons[0].sym.magic == mNone): @@ -362,13 +363,11 @@ proc genSingleVar(p: BProc, a: PNode) = lineCg(targetProc, cpsStmts, "if (hcrRegisterGlobal($3, \"$1\", sizeof($2), $4, (void**)&$1))$N", [v.loc.r, rdLoc(v.loc), getModuleDllPath(p.module, v), traverseProc]) startBlock(targetProc) - defer: - if forHcr: - endBlock(targetProc) - if a.sons[2].kind != nkEmpty: genLineDir(targetProc, a) loadInto(targetProc, a.sons[0], a.sons[2], v.loc) + if forHcr: + endBlock(targetProc) proc genClosureVar(p: BProc, a: PNode) = var immediateAsgn = a.sons[2].kind != nkEmpty |