summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system')
-rwxr-xr-xlib/system/alloc.nim13
-rwxr-xr-xlib/system/ansi_c.nim2
-rwxr-xr-xlib/system/arithm.nim2
-rwxr-xr-xlib/system/assign.nim2
-rwxr-xr-xlib/system/atomics.nim2
-rw-r--r--lib/system/avltree.nim2
-rwxr-xr-xlib/system/cellsets.nim2
-rwxr-xr-xlib/system/cgprocs.nim2
-rwxr-xr-xlib/system/channels.nim2
-rwxr-xr-xlib/system/debugger.nim2
-rwxr-xr-xlib/system/dyncalls.nim2
-rwxr-xr-xlib/system/ecmasys.nim2
-rwxr-xr-xlib/system/excpt.nim2
-rwxr-xr-xlib/system/gc.nim2
-rwxr-xr-xlib/system/hti.nim2
-rwxr-xr-xlib/system/inclrtl.nim2
-rwxr-xr-xlib/system/mmdisp.nim2
-rwxr-xr-xlib/system/profiler.nim2
-rwxr-xr-xlib/system/repr.nim2
-rw-r--r--lib/system/reprjs.nim2
-rwxr-xr-xlib/system/sets.nim2
-rwxr-xr-xlib/system/sysio.nim2
-rwxr-xr-xlib/system/syslocks.nim2
-rwxr-xr-xlib/system/sysstr.nim2
-rwxr-xr-xlib/system/threads.nim2
25 files changed, 34 insertions, 27 deletions
diff --git a/lib/system/alloc.nim b/lib/system/alloc.nim
index e31ef47df..8522e6877 100755
--- a/lib/system/alloc.nim
+++ b/lib/system/alloc.nim
@@ -219,7 +219,10 @@ proc allocAvlNode(a: var TMemRegion, key, upperBound: int): PAvlNode =
   result.upperBound = upperBound
   result.link[0] = bottom
   result.link[1] = bottom
-  result.level = 0
+  result.level = 1
+  sysAssert(bottom == addr(bottomData), "bottom data")
+  sysAssert(bottom.link[0] == bottom, "bottom link[0]")
+  sysAssert(bottom.link[1] == bottom, "bottom link[1]")
 
 proc deallocAvlNode(a: var TMemRegion, n: PAvlNode) {.inline.} =
   n.link[0] = a.freeAvlNodes
@@ -632,7 +635,11 @@ proc interiorAllocatedPtr(a: TMemRegion, p: pointer): pointer =
 
 proc ptrSize(p: pointer): int =
   var x = cast[pointer](cast[TAddress](p) -% sizeof(TFreeCell))
-  result = pageAddr(x).size - sizeof(TFreeCell)
+  var c = pageAddr(p)
+  sysAssert(not chunkUnused(c), "ptrSize")
+  result = c.size -% sizeof(TFreeCell)
+  if not isSmallChunk(c):
+    dec result, bigChunkOverhead()
 
 proc alloc(allocator: var TMemRegion, size: int): pointer =
   result = rawAlloc(allocator, size+sizeof(TFreeCell))
@@ -652,7 +659,7 @@ proc dealloc(allocator: var TMemRegion, p: pointer) =
 
 proc realloc(allocator: var TMemRegion, p: pointer, newsize: int): pointer =
   if newsize > 0:
-    result = alloc(allocator, newsize)
+    result = alloc0(allocator, newsize)
     if p != nil:
       copyMem(result, p, ptrSize(p))
       dealloc(allocator, p)
diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim
index 362b73297..9722e1396 100755
--- a/lib/system/ansi_c.nim
+++ b/lib/system/ansi_c.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/arithm.nim b/lib/system/arithm.nim
index 723195553..54407c04e 100755
--- a/lib/system/arithm.nim
+++ b/lib/system/arithm.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2009 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/assign.nim b/lib/system/assign.nim
index 1c8563c66..dac20f99e 100755
--- a/lib/system/assign.nim
+++ b/lib/system/assign.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/atomics.nim b/lib/system/atomics.nim
index 371168094..b2e1b6bba 100755
--- a/lib/system/atomics.nim
+++ b/lib/system/atomics.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/avltree.nim b/lib/system/avltree.nim
index 9bc2687f4..dcd6c917d 100644
--- a/lib/system/avltree.nim
+++ b/lib/system/avltree.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/cellsets.nim b/lib/system/cellsets.nim
index 78869ed98..4d997d0f9 100755
--- a/lib/system/cellsets.nim
+++ b/lib/system/cellsets.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/cgprocs.nim b/lib/system/cgprocs.nim
index d80747671..e30cfa469 100755
--- a/lib/system/cgprocs.nim
+++ b/lib/system/cgprocs.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/channels.nim b/lib/system/channels.nim
index 47fa5b2e5..520652875 100755
--- a/lib/system/channels.nim
+++ b/lib/system/channels.nim
@@ -1,7 +1,7 @@
 #

 #

 #            Nimrod's Runtime Library

-#        (c) Copyright 2011 Andreas Rumpf

+#        (c) Copyright 2012 Andreas Rumpf

 #

 #    See the file "copying.txt", included in this

 #    distribution, for details about the copyright.

diff --git a/lib/system/debugger.nim b/lib/system/debugger.nim
index 8f381585b..3279e18f2 100755
--- a/lib/system/debugger.nim
+++ b/lib/system/debugger.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/dyncalls.nim b/lib/system/dyncalls.nim
index 447ce3f95..6a80369b9 100755
--- a/lib/system/dyncalls.nim
+++ b/lib/system/dyncalls.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/ecmasys.nim b/lib/system/ecmasys.nim
index bf8a01ecf..7bec2b5bf 100755
--- a/lib/system/ecmasys.nim
+++ b/lib/system/ecmasys.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim
index 9593e3ebc..4f7584d30 100755
--- a/lib/system/excpt.nim
+++ b/lib/system/excpt.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/gc.nim b/lib/system/gc.nim
index c477cadef..6fa5d09b8 100755
--- a/lib/system/gc.nim
+++ b/lib/system/gc.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/hti.nim b/lib/system/hti.nim
index ff669be18..776a4d2c2 100755
--- a/lib/system/hti.nim
+++ b/lib/system/hti.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/inclrtl.nim b/lib/system/inclrtl.nim
index 23cecfbc1..f113430be 100755
--- a/lib/system/inclrtl.nim
+++ b/lib/system/inclrtl.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/mmdisp.nim b/lib/system/mmdisp.nim
index fa257cd9a..9dc0ca8ee 100755
--- a/lib/system/mmdisp.nim
+++ b/lib/system/mmdisp.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/profiler.nim b/lib/system/profiler.nim
index b87b30d4a..295cb43c7 100755
--- a/lib/system/profiler.nim
+++ b/lib/system/profiler.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2008 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/repr.nim b/lib/system/repr.nim
index 6435fecbb..51498b3f5 100755
--- a/lib/system/repr.nim
+++ b/lib/system/repr.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/reprjs.nim b/lib/system/reprjs.nim
index b6b6ffe9c..fd1cb5c8b 100644
--- a/lib/system/reprjs.nim
+++ b/lib/system/reprjs.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/sets.nim b/lib/system/sets.nim
index f9f3eb32b..043d37533 100755
--- a/lib/system/sets.nim
+++ b/lib/system/sets.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2009 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/sysio.nim b/lib/system/sysio.nim
index b0e2c567b..33f16b834 100755
--- a/lib/system/sysio.nim
+++ b/lib/system/sysio.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/syslocks.nim b/lib/system/syslocks.nim
index 17327bb59..4619eaddb 100755
--- a/lib/system/syslocks.nim
+++ b/lib/system/syslocks.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/sysstr.nim b/lib/system/sysstr.nim
index 3e94612b1..43ad02575 100755
--- a/lib/system/sysstr.nim
+++ b/lib/system/sysstr.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
diff --git a/lib/system/threads.nim b/lib/system/threads.nim
index 08184acce..e0812f41c 100755
--- a/lib/system/threads.nim
+++ b/lib/system/threads.nim
@@ -1,7 +1,7 @@
 #
 #
 #            Nimrod's Runtime Library
-#        (c) Copyright 2011 Andreas Rumpf
+#        (c) Copyright 2012 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.