diff options
-rwxr-xr-x | compiler/pragmas.nim | 11 | ||||
-rwxr-xr-x | compiler/wordrecg.nim | 5 | ||||
-rwxr-xr-x | doc/manual.txt | 19 | ||||
-rwxr-xr-x | lib/system/arithm.nim | 12 | ||||
-rwxr-xr-x | todo.txt | 1 | ||||
-rwxr-xr-x | web/news.txt | 1 |
6 files changed, 28 insertions, 21 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index ec97dd1d2..d5cbae4ab 100755 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -21,8 +21,9 @@ const const procPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc, wNodecl, wMagic, wNosideEffect, wSideEffect, wNoreturn, wDynLib, wHeader, - wCompilerProc, wPure, wProcVar, wDeprecated, wVarargs, wCompileTime, wMerge, - wBorrow, wExtern, wImportCompilerProc, wThread, wImportCpp, wImportObjC} + wCompilerProc, wProcVar, wDeprecated, wVarargs, wCompileTime, wMerge, + wBorrow, wExtern, wImportCompilerProc, wThread, wImportCpp, wImportObjC, + wNoStackFrame} converterPragmas* = procPragmas methodPragmas* = procPragmas macroPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc, wNodecl, @@ -38,8 +39,8 @@ const wCheckpoint, wPassL, wPassC, wDeadCodeElim, wDeprecated, wFloatChecks, wInfChecks, wNanChecks, wPragma, wEmit, wUnroll, wLinearScanEnd} lambdaPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc, wNodecl, - wNosideEffect, wSideEffect, wNoreturn, wDynLib, wHeader, wPure, - wDeprecated, wExtern, wThread, wImportcpp, wImportobjc} + wNosideEffect, wSideEffect, wNoreturn, wDynLib, wHeader, + wDeprecated, wExtern, wThread, wImportcpp, wImportobjc, wNoStackFrame} typePragmas* = {wImportc, wExportc, wDeprecated, wMagic, wAcyclic, wNodecl, wPure, wHeader, wCompilerProc, wFinal, wSize, wExtern, wShallow, wImportcpp, wImportobjc} @@ -448,7 +449,7 @@ proc pragma(c: PContext, sym: PSym, n: PNode, validPragmas: TSpecialWords) = of wNodecl: noVal(it) incl(sym.loc.Flags, lfNoDecl) - of wPure: + of wPure, wNoStackFrame: noVal(it) if sym != nil: incl(sym.flags, sfPure) of wVolatile: diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim index 97bdb5c55..6ba47fb94 100755 --- a/compiler/wordrecg.nim +++ b/compiler/wordrecg.nim @@ -55,7 +55,7 @@ type wFieldChecks, wCheckPoint, wSubsChar, wAcyclic, wShallow, wUnroll, wLinearScanEnd, - wWrite, wPutEnv, wPrependEnv, wAppendEnv, wThreadVar, wEmit + wWrite, wPutEnv, wPrependEnv, wAppendEnv, wThreadVar, wEmit, wNoStackFrame TSpecialWords* = set[TSpecialWord] @@ -99,7 +99,8 @@ const "passc", "passl", "borrow", "fieldchecks", "checkpoint", "subschar", "acyclic", "shallow", "unroll", "linearscanend", - "write", "putenv", "prependenv", "appendenv", "threadvar", "emit"] + "write", "putenv", "prependenv", "appendenv", "threadvar", "emit", + "nostackframe"] proc findStr*(a: openarray[string], s: string): int = for i in countup(low(a), high(a)): diff --git a/doc/manual.txt b/doc/manual.txt index 3037f37d3..f9a0b5dfc 100755 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -1853,7 +1853,7 @@ Nimrod identifiers shall be enclosed in a special character which can be specified in the statement's pragmas. The default special character is ``'`'``: .. code-block:: nimrod - proc addInt(a, b: int): int {.pure.} = + proc addInt(a, b: int): int {.noStackFrame.} = # a in eax, and b in edx asm """ mov eax, `a` @@ -2900,12 +2900,17 @@ structure: Pure pragma ----------- -The `pure`:idx: pragma serves two completely different purposes: -1. To mark a procedure that Nimrod should not generate any exit statements like - ``return result;`` in the generated code. This is useful for procs that only - consist of an assembler statement. -2. To mark an object type so that its type field should be omitted. This is - necessary for binary compatibility with other compiled languages. +An object type can be marked with the `pure`:idx: pragma so that its type +field which is used for runtime type identification is omitted. This is +necessary for binary compatibility with other compiled languages. + + +NoStackFrame pragma +------------------- +A proc can be marked with the `noStackFrame`:idx: pragma to tell the compiler +it should not generate a stack frame for the proc. There are also no exit +statements like ``return result;`` generated. This is useful for procs that +only consist of an assembler statement. error pragma diff --git a/lib/system/arithm.nim b/lib/system/arithm.nim index b93bb9844..723195553 100755 --- a/lib/system/arithm.nim +++ b/lib/system/arithm.nim @@ -111,7 +111,7 @@ const when asmVersion and not defined(gcc) and not defined(llvm_gcc): # assembler optimized versions for compilers that # have an intel syntax assembler: - proc addInt(a, b: int): int {.compilerProc, pure.} = + proc addInt(a, b: int): int {.compilerProc, noStackFrame.} = # a in eax, and b in edx asm """ mov eax, `a` @@ -121,7 +121,7 @@ when asmVersion and not defined(gcc) and not defined(llvm_gcc): theEnd: """ - proc subInt(a, b: int): int {.compilerProc, pure.} = + proc subInt(a, b: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` sub eax, `b` @@ -130,7 +130,7 @@ when asmVersion and not defined(gcc) and not defined(llvm_gcc): theEnd: """ - proc negInt(a: int): int {.compilerProc, pure.} = + proc negInt(a: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` neg eax @@ -139,7 +139,7 @@ when asmVersion and not defined(gcc) and not defined(llvm_gcc): theEnd: """ - proc divInt(a, b: int): int {.compilerProc, pure.} = + proc divInt(a, b: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` mov ecx, `b` @@ -150,7 +150,7 @@ when asmVersion and not defined(gcc) and not defined(llvm_gcc): theEnd: """ - proc modInt(a, b: int): int {.compilerProc, pure.} = + proc modInt(a, b: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` mov ecx, `b` @@ -162,7 +162,7 @@ when asmVersion and not defined(gcc) and not defined(llvm_gcc): mov eax, edx """ - proc mulInt(a, b: int): int {.compilerProc, pure.} = + proc mulInt(a, b: int): int {.compilerProc, noStackFrame.} = asm """ mov eax, `a` mov ecx, `b` diff --git a/todo.txt b/todo.txt index 99d9f5351..7efa74cae 100755 --- a/todo.txt +++ b/todo.txt @@ -7,7 +7,6 @@ Version 0.8.14 not have an inbox per default - add --deadlock_prevention:on|off switch? timeout for locks? - make threadvar efficient again on linux after testing -- ``pure`` --> ``noStackFrame``, ``noRtti`` version 0.9.0 diff --git a/web/news.txt b/web/news.txt index 6eff0e693..2dc3112a7 100755 --- a/web/news.txt +++ b/web/news.txt @@ -34,6 +34,7 @@ Changes affecting backwards compatibility - ``implies`` is no keyword anymore. - The ``is`` operator is now the ``of`` operator. - The ``is`` operator is now used to check type equivalence in generic code. +- The ``pure`` pragma for procs has been renamed to ``noStackFrame``. Language Additions |