Merge pull request #1178 from EXetoC/nostackframe
noStackFrame -> asmNoStackFrame
This commit is contained in:
commit
208a594ff1
3 changed files with 8 additions and 4 deletions
|
|
@ -2408,7 +2408,8 @@ Nimrod identifiers shall be enclosed in a special character which can be
|
||||||
specified in the statement's pragmas. The default special character is ``'`'``:
|
specified in the statement's pragmas. The default special character is ``'`'``:
|
||||||
|
|
||||||
.. code-block:: nimrod
|
.. code-block:: nimrod
|
||||||
proc addInt(a, b: int): int {.noStackFrame.} =
|
{.push stackTrace:off.}
|
||||||
|
proc addInt(a, b: int): int =
|
||||||
# a in eax, and b in edx
|
# a in eax, and b in edx
|
||||||
asm """
|
asm """
|
||||||
mov eax, `a`
|
mov eax, `a`
|
||||||
|
|
@ -2417,6 +2418,7 @@ specified in the statement's pragmas. The default special character is ``'`'``:
|
||||||
call `raiseOverflow`
|
call `raiseOverflow`
|
||||||
theEnd:
|
theEnd:
|
||||||
"""
|
"""
|
||||||
|
{.pop.}
|
||||||
|
|
||||||
If the GNU assembler is used, quotes and newlines are inserted automatically:
|
If the GNU assembler is used, quotes and newlines are inserted automatically:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -360,10 +360,12 @@ Example:
|
||||||
static int cvariable = 420;
|
static int cvariable = 420;
|
||||||
""".}
|
""".}
|
||||||
|
|
||||||
proc embedsC() {.noStackFrame.} =
|
{.push stackTrace:off.}
|
||||||
|
proc embedsC() =
|
||||||
var nimrodVar = 89
|
var nimrodVar = 89
|
||||||
# use backticks to access Nimrod symbols within an emit section:
|
# use backticks to access Nimrod symbols within an emit section:
|
||||||
{.emit: """fprintf(stdout, "%d\n", cvariable + (int)`nimrodVar`);""".}
|
{.emit: """fprintf(stdout, "%d\n", cvariable + (int)`nimrodVar`);""".}
|
||||||
|
{.pop.}
|
||||||
|
|
||||||
embedsC()
|
embedsC()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -800,8 +800,8 @@ elif not defined(useNimRtl):
|
||||||
|
|
||||||
proc startProcessAfterFork(data: ptr TStartProcessData) =
|
proc startProcessAfterFork(data: ptr TStartProcessData) =
|
||||||
# Warning: no GC here!
|
# Warning: no GC here!
|
||||||
# Or anythink that touches global structures - all called nimrod procs
|
# Or anything that touches global structures - all called nimrod procs
|
||||||
# must be marked with noStackFrame. Inspect C code after making changes.
|
# must be marked with stackTrace:off. Inspect C code after making changes.
|
||||||
if not data.optionPoParentStreams:
|
if not data.optionPoParentStreams:
|
||||||
discard close(data.pStdin[writeIdx])
|
discard close(data.pStdin[writeIdx])
|
||||||
if dup2(data.pStdin[readIdx], readIdx) < 0:
|
if dup2(data.pStdin[readIdx], readIdx) < 0:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue