diff options
author | Araq <rumpf_a@web.de> | 2011-05-13 19:14:49 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-05-13 19:14:49 +0200 |
commit | f45967537f3696b20a4a92b2159c8de11913b556 (patch) | |
tree | 8b041099b93135fcee0ec04c9b1cc0e7931d3110 /lib | |
parent | f94941964d8621c452082b47b5810f231edabfa3 (diff) | |
download | Nim-f45967537f3696b20a4a92b2159c8de11913b556.tar.gz |
loop unrolled for stack marking
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/system/gc.nim | 13 | ||||
-rwxr-xr-x | lib/system/repr.nim | 2 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/system/gc.nim b/lib/system/gc.nim index 1edc33375..7c70ccf85 100755 --- a/lib/system/gc.nim +++ b/lib/system/gc.nim @@ -626,10 +626,23 @@ else: # We use a jmp_buf buffer that is in the C stack. # Used to traverse the stack and registers assuming # that 'setjmp' will save registers in the C stack. + type PStackSlice = ptr array [0..7, pointer] var registers: C_JmpBuf if c_setjmp(registers) == 0'i32: # To fill the C stack with registers. var max = cast[TAddress](stackBottom) var sp = cast[TAddress](addr(registers)) + # loop unrolled: + while sp <% max - 8*sizeof(pointer): + gcMark(cast[PStackSlice](sp)[0]) + gcMark(cast[PStackSlice](sp)[1]) + gcMark(cast[PStackSlice](sp)[2]) + gcMark(cast[PStackSlice](sp)[3]) + gcMark(cast[PStackSlice](sp)[4]) + gcMark(cast[PStackSlice](sp)[5]) + gcMark(cast[PStackSlice](sp)[6]) + gcMark(cast[PStackSlice](sp)[7]) + sp = sp +% sizeof(pointer)*8 + # last few entries: while sp <=% max: gcMark(cast[ppointer](sp)[]) sp = sp +% sizeof(pointer) diff --git a/lib/system/repr.nim b/lib/system/repr.nim index 87588421f..9464ff3d8 100755 --- a/lib/system/repr.nim +++ b/lib/system/repr.nim @@ -111,7 +111,7 @@ type TReprClosure {.final.} = object # we cannot use a global variable here # as this wouldn't be thread-safe marked: TCellSet - recdepth: int # do not recurse endless + recdepth: int # do not recurse endlessly indent: int # indentation when not defined(useNimRtl): |