summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-04-03 22:59:00 +0200
committerAraq <rumpf_a@web.de>2011-04-03 22:59:00 +0200
commitb38c7adad1e153c8678c93098391cb2bd8d8fef6 (patch)
tree11c696641e4b7567dc2d7ff54407661ce6403e60 /lib
parent623fd8a8abcc0e192cd5e5dd4e1e54b57c39ccf1 (diff)
downloadNim-b38c7adad1e153c8678c93098391cb2bd8d8fef6.tar.gz
bugfix: GC more forgiving
Diffstat (limited to 'lib')
-rwxr-xr-xlib/pure/htmlparser.nim4
-rwxr-xr-xlib/system.nim9
-rwxr-xr-xlib/system/gc.nim5
3 files changed, 11 insertions, 7 deletions
diff --git a/lib/pure/htmlparser.nim b/lib/pure/htmlparser.nim
index d84688be6..4136ecf57 100755
--- a/lib/pure/htmlparser.nim
+++ b/lib/pure/htmlparser.nim
@@ -333,11 +333,11 @@ proc parse(x: var TXmlParser, errors: var seq[string]): PXmlNode =
   of xmlElementOpen: 
     result = newElement(x.elementName.toLower)
     next(x)
-    result.attr = newStringTable()
+    result.attrs = newStringTable()
     while true: 
       case x.kind
       of xmlAttribute:
-        result.attr[x.attrKey] = x.attrValue
+        result.attrs[x.attrKey] = x.attrValue
         next(x)
       of xmlElementClose:
         next(x)
diff --git a/lib/system.nim b/lib/system.nim
index daf0c5423..3c31e65cd 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1213,14 +1213,14 @@ iterator fieldPairs*(x, y: tuple[]): tuple[a, b: expr] {.
   ## in the loop body.
 
 proc `==`*[T: tuple](x, y: T): bool = 
-  ## generic ``==`` operator that is lifted from the components
+  ## generic ``==`` operator for tuples that is lifted from the components
   ## of `x` and `y`.
   for a, b in fields(x, y):
     if a != b: return false
   return true
 
 proc `<=`*[T: tuple](x, y: T): bool = 
-  ## generic ``<=`` operator that is lifted from the components
+  ## generic ``<=`` operator for tuples that is lifted from the components
   ## of `x` and `y`. This implementation uses `cmp`.
   for a, b in fields(x, y):
     var c = cmp(a, b)
@@ -1229,7 +1229,7 @@ proc `<=`*[T: tuple](x, y: T): bool =
   return true
 
 proc `<`*[T: tuple](x, y: T): bool = 
-  ## generic ``<`` operator that is lifted from the components
+  ## generic ``<`` operator for tuples that is lifted from the components
   ## of `x` and `y`. This implementation uses `cmp`.
   for a, b in fields(x, y):
     var c = cmp(a, b)
@@ -1238,7 +1238,8 @@ proc `<`*[T: tuple](x, y: T): bool =
   return false
 
 proc `$`*[T: tuple](x: T): string = 
-  ## generic ``$`` operator that is lifted from the components of `x`.
+  ## generic ``$`` operator for tuples that is lifted from the components
+  ## of `x`.
   result = "("
   for name, value in fieldPairs(x):
     if result.len > 1: result.add(", ")
diff --git a/lib/system/gc.nim b/lib/system/gc.nim
index 5288316f2..882825f5e 100755
--- a/lib/system/gc.nim
+++ b/lib/system/gc.nim
@@ -265,7 +265,10 @@ proc unsureAsgnRef(dest: ppointer, src: pointer) {.compilerProc.} =
   # reference is in the stack or not (this can happen for var parameters).
   if not IsOnStack(dest):
     if src != nil: incRef(usrToCell(src))
-    if dest^ != nil: decRef(usrToCell(dest^))
+    # XXX finally use assembler for the stack checking instead!
+    # the test for '!= nil' is correct, but I got tired of the segfaults
+    # resulting from the crappy stack checking:
+    if cast[int](dest^) >=% PageSize: decRef(usrToCell(dest^))
   dest^ = src
 
 proc initGC() =