Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
This commit is contained in:
commit
f70b35b3b7
2 changed files with 17 additions and 10 deletions
|
|
@ -949,12 +949,23 @@ proc genFilenames(m: BModule): PRope =
|
||||||
|
|
||||||
proc genMainProc(m: BModule) =
|
proc genMainProc(m: BModule) =
|
||||||
const
|
const
|
||||||
|
# The use of a volatile function pointer to call Pre/NimMainInner
|
||||||
|
# prevents inlining of the NimMainInner function and dependent
|
||||||
|
# functions, which might otherwise merge their stack frames.
|
||||||
PreMainBody =
|
PreMainBody =
|
||||||
"\tsystemDatInit();$N" &
|
"void PreMainInner() {$N" &
|
||||||
"\tsystemInit();$N" &
|
"\tsystemInit();$N" &
|
||||||
"$1" &
|
"$1" &
|
||||||
"$2" &
|
"$2" &
|
||||||
"$3"
|
"$3" &
|
||||||
|
"}$N$N" &
|
||||||
|
"void PreMain() {$N" &
|
||||||
|
"\tvoid (*volatile inner)();$N" &
|
||||||
|
"\tsystemDatInit();$N" &
|
||||||
|
"\tinner = PreMainInner;$N" &
|
||||||
|
"$4" &
|
||||||
|
"\t(*inner)();$N" &
|
||||||
|
"}$N$N"
|
||||||
|
|
||||||
MainProcs =
|
MainProcs =
|
||||||
"\tNimMain();$N"
|
"\tNimMain();$N"
|
||||||
|
|
@ -962,9 +973,6 @@ proc genMainProc(m: BModule) =
|
||||||
MainProcsWithResult =
|
MainProcsWithResult =
|
||||||
MainProcs & "\treturn nim_program_result;$N"
|
MainProcs & "\treturn nim_program_result;$N"
|
||||||
|
|
||||||
# The use of a volatile function pointer to call NimMainInner
|
|
||||||
# prevents inlining of the NimMainInner function and dependent
|
|
||||||
# functions, which might otherwise merge their stack frames.
|
|
||||||
NimMainBody =
|
NimMainBody =
|
||||||
"N_CDECL(void, NimMainInner)(void) {$N" &
|
"N_CDECL(void, NimMainInner)(void) {$N" &
|
||||||
"$1" &
|
"$1" &
|
||||||
|
|
@ -1047,8 +1055,8 @@ proc genMainProc(m: BModule) =
|
||||||
platform.targetOS == osStandalone: "".toRope
|
platform.targetOS == osStandalone: "".toRope
|
||||||
else: ropecg(m, "\t#initStackBottomWith((void *)&inner);$N")
|
else: ropecg(m, "\t#initStackBottomWith((void *)&inner);$N")
|
||||||
inc(m.labels)
|
inc(m.labels)
|
||||||
appcg(m, m.s[cfsProcs], "void PreMain() {$N" & PreMainBody & "}$N$N", [
|
appcg(m, m.s[cfsProcs], PreMainBody, [
|
||||||
mainDatInit, gBreakpoints, otherModsInit])
|
mainDatInit, gBreakpoints, otherModsInit, initStackBottomCall])
|
||||||
|
|
||||||
appcg(m, m.s[cfsProcs], nimMain, [mainModInit, initStackBottomCall, toRope(m.labels)])
|
appcg(m, m.s[cfsProcs], nimMain, [mainModInit, initStackBottomCall, toRope(m.labels)])
|
||||||
if optNoMain notin gGlobalOptions:
|
if optNoMain notin gGlobalOptions:
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ export TPort, TSocketFlags
|
||||||
## **Note:** This module is still largely experimental.
|
## **Note:** This module is still largely experimental.
|
||||||
|
|
||||||
|
|
||||||
# TODO: Discarded void PFutures need to be checked for exception.
|
|
||||||
# TODO: ``except`` statement (without `try`) does not work.
|
# TODO: ``except`` statement (without `try`) does not work.
|
||||||
# TODO: Multiple exception names in a ``except`` don't work.
|
# TODO: Multiple exception names in a ``except`` don't work.
|
||||||
# TODO: The effect system (raises: []) has trouble with my try transformation.
|
# TODO: The effect system (raises: []) has trouble with my try transformation.
|
||||||
|
|
@ -1003,7 +1002,7 @@ proc processBody(node, retFutureSym: PNimrodNode,
|
||||||
of nnkIdent:
|
of nnkIdent:
|
||||||
# await x
|
# await x
|
||||||
result = newNimNode(nnkYieldStmt, node).add(node[1]) # -> yield x
|
result = newNimNode(nnkYieldStmt, node).add(node[1]) # -> yield x
|
||||||
of nnkCall:
|
of nnkCall, nnkCommand:
|
||||||
# await foo(p, x)
|
# await foo(p, x)
|
||||||
var futureValue: PNimrodNode
|
var futureValue: PNimrodNode
|
||||||
result.createVar("future" & $node[1][0].toStrLit, node[1], futureValue,
|
result.createVar("future" & $node[1][0].toStrLit, node[1], futureValue,
|
||||||
|
|
@ -1020,7 +1019,7 @@ proc processBody(node, retFutureSym: PNimrodNode,
|
||||||
of nnkVarSection, nnkLetSection:
|
of nnkVarSection, nnkLetSection:
|
||||||
case node[0][2].kind
|
case node[0][2].kind
|
||||||
of nnkCommand:
|
of nnkCommand:
|
||||||
if node[0][2][0].ident == !"await":
|
if node[0][2][0].kind == nnkIdent and node[0][2][0].ident == !"await":
|
||||||
# var x = await y
|
# var x = await y
|
||||||
var newVarSection = node # TODO: Should this use copyNimNode?
|
var newVarSection = node # TODO: Should this use copyNimNode?
|
||||||
result.createVar("future" & $node[0][0].ident, node[0][2][1],
|
result.createVar("future" & $node[0][0].ident, node[0][2][1],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue