From d257f7fd36e594803fc1605d46dcf1e654f0e48b Mon Sep 17 00:00:00 2001 From: Araq Date: Sun, 24 Jun 2012 17:15:54 +0200 Subject: tests/gc/gcleak4.nim --- lib/system/debugger.nim | 7 ++++++- lib/system/gc.nim | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/system') diff --git a/lib/system/debugger.nim b/lib/system/debugger.nim index 564f080d1..ca60b0405 100755 --- a/lib/system/debugger.nim +++ b/lib/system/debugger.nim @@ -632,7 +632,12 @@ proc genericHashAux(dest: Pointer, mt: PNimType, shallow: bool, else: result = h var s = cast[ppointer](dest)[] - if s != nil: result = genericHashAux(s, mt.base, shallow, result) + if s != nil: + result = result !& genericHashAux(s, mt.base, shallow, result) + # hash the object header: + #const headerSize = sizeof(int)*2 + #result = result !& hash(cast[pointer](cast[int](s) -% headerSize), + # headerSize) else: result = h !& hash(dest, mt.size) # hash raw bits diff --git a/lib/system/gc.nim b/lib/system/gc.nim index ea30754a6..883089c57 100755 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -100,6 +100,8 @@ proc usrToCell(usr: pointer): PCell {.inline.} = result = cast[PCell](cast[TAddress](usr)-%TAddress(sizeof(TCell))) proc canbeCycleRoot(c: PCell): bool {.inline.} = + if c.typ == nil: + echo "ARRGHHHHHHH" result = ntfAcyclic notin c.typ.flags proc extGetCellType(c: pointer): PNimType {.compilerproc.} = -- cgit 1.4.1-2-gfad0