summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-07-12 16:05:46 +0200
committerAraq <rumpf_a@web.de>2019-07-12 21:53:45 +0200
commit03ded27021f2fedce92ba5208cb03b8dbeb7b3db (patch)
tree849154ea9aa84db4341688d642ddfd9c692e053c /lib
parent2895ad70c8e65cd6c220cf06c5e04ce7adfd29bd (diff)
downloadNim-03ded27021f2fedce92ba5208cb03b8dbeb7b3db.tar.gz
preparations to be able to use atomics in runtime_v2.nim
Diffstat (limited to 'lib')
-rw-r--r--lib/system.nim27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 61fb6ec03..6b07b2cf4 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -3098,6 +3098,21 @@ when not defined(js):
 when not declared(sysFatal):
   include "system/fatal"
 
+when not defined(JS) and not defined(nimscript):
+  {.push stackTrace: off, profiler:off.}
+
+  proc atomicInc*(memLoc: var int, x: int = 1): int {.inline,
+    discardable, benign.}
+    ## Atomic increment of `memLoc`. Returns the value after the operation.
+
+  proc atomicDec*(memLoc: var int, x: int = 1): int {.inline,
+    discardable, benign.}
+    ## Atomic decrement of `memLoc`. Returns the value after the operation.
+
+  include "system/atomics"
+
+  {.pop.}
+
 when defined(nimV2):
   include core/runtime_v2
 
@@ -3643,16 +3658,6 @@ when not defined(JS): #and not defined(nimscript):
       dealloc(a)
 
   when not defined(nimscript):
-    proc atomicInc*(memLoc: var int, x: int = 1): int {.inline,
-      discardable, benign.}
-      ## Atomic increment of `memLoc`. Returns the value after the operation.
-
-    proc atomicDec*(memLoc: var int, x: int = 1): int {.inline,
-      discardable, benign.}
-      ## Atomic decrement of `memLoc`. Returns the value after the operation.
-
-    include "system/atomics"
-
     type
       PSafePoint = ptr TSafePoint
       TSafePoint {.compilerproc, final.} = object
@@ -3692,7 +3697,7 @@ when not defined(JS): #and not defined(nimscript):
         ## Gets the stack trace associated with `e`, which is the stack that
         ## lead to the ``raise`` statement. This only works for debug builds.
 
-    {.push stack_trace: off, profiler:off.}
+    {.push stackTrace: off, profiler:off.}
     when defined(memtracker):
       include "system/memtracker"