summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-desktop>2010-08-08 22:45:21 +0200
committerAndreas Rumpf <andreas@andreas-desktop>2010-08-08 22:45:21 +0200
commit8098e2a421bf26ad0f350f297f19f34619207443 (patch)
treeada62dabe6a38c7fbe47d65e2674b9070f2cef3c /lib/system.nim
parentc9e011e36cf400e1a2e5466a1339f716623508f7 (diff)
downloadNim-8098e2a421bf26ad0f350f297f19f34619207443.tar.gz
inlining of the write barrier for dlls
Diffstat (limited to 'lib/system.nim')
-rwxr-xr-xlib/system.nim62
1 files changed, 31 insertions, 31 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 1addece93..da64b233e 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -14,7 +14,7 @@
 ## explicitly. Because of this there cannot be a user-defined module named
 ## ``system``.
 
-{.push hints: off.}
+{.push hints: on.}
 
 type
   int* {.magic: Int.} ## default integer type; bitwidth depends on
@@ -720,25 +720,6 @@ const
 include "system/inclrtl"
 include "system/cgprocs"
 
-when not defined(ECMAScript):
-  {.push overflow_checks:off}
-  proc add* (x: var string, y: cstring) =
-    var i = 0
-    while y[i] != '\0':
-      add(x, y[i])
-      inc(i)
-  {.pop.}
-else:
-  proc add* (x: var string, y: cstring) {.pure.} =
-    asm """
-      var len = `x`[0].length-1;
-      for (var i = 0; i < `y`.length; ++i) {
-        `x`[0][len] = `y`.charCodeAt(i);
-        ++len;
-      }
-      `x`[0][len] = 0
-    """
-
 proc add *[T](x: var seq[T], y: T) {.magic: "AppendSeqElem", noSideEffect.}
 proc add *[T](x: var seq[T], y: openArray[T]) {.noSideEffect.} =
   ## Generic proc for adding a data item `y` to a container `x`.
@@ -850,10 +831,6 @@ proc toBiggestInt*(f: biggestfloat): biggestint {.
   ## rounds `f` if it does not contain an integer value. If the conversion
   ## fails (because `f` is infinite for example), `EInvalidValue` is raised.
 
-proc `/`*(x, y: int): float {.inline, noSideEffect.} =
-  ## integer division that results in a float.
-  result = toFloat(x) / toFloat(y)
-
 proc addQuitProc*(QuitProc: proc {.noconv.}) {.importc: "atexit", nodecl.}
   ## adds/registers a quit procedure. Each call to ``addQuitProc``
   ## registers another quit procedure. Up to 30 procedures can be
@@ -1004,12 +981,6 @@ const
     ## and expect a reasonable result - use the `classify` procedure
     ## in the module ``math`` for checking for NaN.
 
-var
-  dbgLineHook*: proc = nil
-    ## set this variable to provide a procedure that should be called before
-    ## each executed instruction. This should only be used by debuggers!
-    ## Only code compiled with the ``debugger:on`` switch calls this hook.
-
 # GC interface:
 
 proc getOccupiedMem*(): int {.rtl.}
@@ -1265,6 +1236,35 @@ template accumulateResult*(iter: expr) =
 # however, stack-traces are available for most parts
 # of the code
 
+var
+  dbgLineHook*: proc = nil
+    ## set this variable to provide a procedure that should be called before
+    ## each executed instruction. This should only be used by debuggers!
+    ## Only code compiled with the ``debugger:on`` switch calls this hook.
+
+when not defined(ECMAScript):
+  {.push overflow_checks:off}
+  proc add* (x: var string, y: cstring) =
+    var i = 0
+    while y[i] != '\0':
+      add(x, y[i])
+      inc(i)
+  {.pop.}
+else:
+  proc add* (x: var string, y: cstring) {.pure.} =
+    asm """
+      var len = `x`[0].length-1;
+      for (var i = 0; i < `y`.length; ++i) {
+        `x`[0][len] = `y`.charCodeAt(i);
+        ++len;
+      }
+      `x`[0][len] = 0
+    """
+
+proc `/`*(x, y: int): float {.inline, noSideEffect.} =
+  ## integer division that results in a float.
+  result = toFloat(x) / toFloat(y)
+
 proc echo*[Ty](x: openarray[Ty]) {.magic: "Echo".}
   ## equivalent to ``writeln(stdout, x); flush(stdout)``. BUT: This is
   ## available for the ECMAScript target too!
@@ -1342,7 +1342,7 @@ when not defined(EcmaScript) and not defined(NimrodVM):
     # we use binary mode in Windows:
     setmode(fileno(c_stdin), O_BINARY)
     setmode(fileno(c_stdout), O_BINARY)
-
+  
   when defined(endb):
     proc endbStep()