Merge pull request #2671 from rbehrends/fix-register-scan
Fix GC scanning of registers on x86_64 architectures.
This commit is contained in:
commit
177129195f
2 changed files with 18 additions and 0 deletions
|
|
@ -922,6 +922,15 @@ else:
|
||||||
if c_setjmp(registers) == 0'i32: # To fill the C stack with registers.
|
if c_setjmp(registers) == 0'i32: # To fill the C stack with registers.
|
||||||
var max = cast[ByteAddress](gch.stackBottom)
|
var max = cast[ByteAddress](gch.stackBottom)
|
||||||
var sp = cast[ByteAddress](addr(registers))
|
var sp = cast[ByteAddress](addr(registers))
|
||||||
|
when defined(amd64):
|
||||||
|
# words within the jmp_buf structure may not be properly aligned.
|
||||||
|
let regEnd = sp +% sizeof(registers)
|
||||||
|
while sp <% regEnd:
|
||||||
|
gcMark(gch, cast[PPointer](sp)[])
|
||||||
|
gcMark(gch, cast[PPointer](sp +% sizeof(pointer) div 2)[])
|
||||||
|
sp = sp +% sizeof(pointer)
|
||||||
|
# Make sure sp is word-aligned
|
||||||
|
sp = sp and not (sizeof(pointer) - 1)
|
||||||
# loop unrolled:
|
# loop unrolled:
|
||||||
while sp <% max - 8*sizeof(pointer):
|
while sp <% max - 8*sizeof(pointer):
|
||||||
gcMark(gch, cast[PStackSlice](sp)[0])
|
gcMark(gch, cast[PStackSlice](sp)[0])
|
||||||
|
|
|
||||||
|
|
@ -514,6 +514,15 @@ else:
|
||||||
if c_setjmp(registers) == 0'i32: # To fill the C stack with registers.
|
if c_setjmp(registers) == 0'i32: # To fill the C stack with registers.
|
||||||
var max = cast[ByteAddress](gch.stackBottom)
|
var max = cast[ByteAddress](gch.stackBottom)
|
||||||
var sp = cast[ByteAddress](addr(registers))
|
var sp = cast[ByteAddress](addr(registers))
|
||||||
|
when defined(amd64):
|
||||||
|
# words within the jmp_buf structure may not be properly aligned.
|
||||||
|
let regEnd = sp +% sizeof(registers)
|
||||||
|
while sp <% regEnd:
|
||||||
|
gcMark(gch, cast[PPointer](sp)[])
|
||||||
|
gcMark(gch, cast[PPointer](sp +% sizeof(pointer) div 2)[])
|
||||||
|
sp = sp +% sizeof(pointer)
|
||||||
|
# Make sure sp is word-aligned
|
||||||
|
sp = sp and not (sizeof(pointer) - 1)
|
||||||
# loop unrolled:
|
# loop unrolled:
|
||||||
while sp <% max - 8*sizeof(pointer):
|
while sp <% max - 8*sizeof(pointer):
|
||||||
gcMark(gch, cast[PStackSlice](sp)[0])
|
gcMark(gch, cast[PStackSlice](sp)[0])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue