diff options
author | Araq <rumpf_a@web.de> | 2013-02-07 16:09:46 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-02-07 16:09:46 +0100 |
commit | 4ee9816a7888f8f125752d75f8528c39c94d732b (patch) | |
tree | 0d2c8c823bd5a2663a721f4330a14175dc8f2851 /lib/system/cellsets.nim | |
parent | ab6f793408c10935bad98071bdae4009f6873d5c (diff) | |
download | Nim-4ee9816a7888f8f125752d75f8528c39c94d732b.tar.gz |
code cleanup for mark&sweep GC
Diffstat (limited to 'lib/system/cellsets.nim')
-rwxr-xr-x | lib/system/cellsets.nim | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/lib/system/cellsets.nim b/lib/system/cellsets.nim index d3886dfda..7ad814da4 100755 --- a/lib/system/cellsets.nim +++ b/lib/system/cellsets.nim @@ -68,38 +68,6 @@ proc deinit(s: var TCellSeq) = s.len = 0 s.cap = 0 -# ------------------- cyclic cell temporary data structure -------------------- - -type - TCycleCell = object - cell: PCell - oldRefcount, newRefcount: TRefCount - PCycleCellArray = ptr array[0..100_000_000, TCycleCell] - TCycleCellSeq {.final, pure.} = object - len, cap: int - d: PCycleCellArray - -proc reserveSlot(s: var TCycleCellSeq): int = - if s.len >= s.cap: - s.cap = s.cap * 3 div 2 - var d = cast[PCycleCellArray](Alloc(s.cap * sizeof(TCycleCell))) - copyMem(d, s.d, s.len * sizeof(TCycleCell)) - Dealloc(s.d) - s.d = d - result = s.len - inc(s.len) - -proc init(s: var TCycleCellSeq, cap: int = 1024) = - s.len = 0 - s.cap = cap - s.d = cast[PCycleCellArray](Alloc(cap * sizeof(TCycleCell))) - -proc deinit(s: var TCycleCellSeq) = - Dealloc(s.d) - s.d = nil - s.len = 0 - s.cap = 0 - # ------------------- cell set handling --------------------------------------- const @@ -230,7 +198,7 @@ iterator elements(t: TCellSet): PCell {.inline.} = inc(i) r = r.next -iterator elementsWithout(t, s: TCellSet): PCell {.inline.} = +iterator elementsExcept(t, s: TCellSet): PCell {.inline.} = var r = t.head while r != nil: let ss = CellSetGet(s, r.key) |