Fix %write-barrier

db4
Slava Pestov 2008-10-10 03:16:26 -05:00
parent c98651043c
commit 3844cb62d8
5 changed files with 19 additions and 12 deletions

View File

@ -247,7 +247,9 @@ M: #dispatch emit-node
: emit-write-barrier ( -- )
phantom-pop dup >vreg fresh-object? [ drop ] [
int-regs next-vreg ##write-barrier
int-regs next-vreg
int-regs next-vreg
##write-barrier
] if ;
: emit-intrinsic ( word -- next )

View File

@ -49,7 +49,7 @@ INSN: ##box-alien < ##unary temp ;
! Memory allocation
INSN: ##allot < ##nullary size type tag temp ;
INSN: ##write-barrier src temp ;
INSN: ##write-barrier src card# table ;
INSN: ##gc ;
! FFI
@ -62,7 +62,8 @@ GENERIC: uses-vregs ( insn -- seq )
M: ##nullary defs-vregs dst>> >vreg 1array ;
M: ##unary defs-vregs dst>> >vreg 1array ;
M: ##write-barrier defs-vregs temp>> >vreg 1array ;
M: ##write-barrier defs-vregs
[ card#>> >vreg ] [ table>> >vreg ] bi 2array ;
: allot-defs-vregs ( insn -- seq )
[ dst>> >vreg ] [ temp>> >vreg ] bi 2array ;

View File

@ -182,7 +182,10 @@ M: ##allot generate-insn
%allot ;
M: ##write-barrier generate-insn
[ src>> v>operand ] [ temp>> v>operand ] bi %write-barrier ;
[ src>> v>operand ]
[ card#>> v>operand ]
[ table>> v>operand ]
tri %write-barrier ;
M: ##gc generate-insn drop %gc ;

View File

@ -189,7 +189,7 @@ HOOK: %box-alien cpu ( dst src temp1 temp2 -- )
! Allocation
HOOK: %allot cpu ( dst size type tag temp -- )
HOOK: %write-barrier cpu ( src temp -- )
HOOK: %write-barrier cpu ( src card# table -- )
! GC check
HOOK: %gc cpu ( -- )

View File

@ -7,17 +7,18 @@ compiler.constants compiler.cfg.templates compiler.cfg.builder
compiler.codegen compiler.codegen.fixup ;
IN: cpu.x86.allot
M:: x86 %write-barrier ( src temp -- )
M:: x86 %write-barrier ( src card# table -- )
#! Mark the card pointed to by vreg.
! Mark the card
src card-bits SHR
"cards_offset" f temp %alien-global
temp src [+] card-mark <byte> MOV
card# src MOV
card# card-bits SHR
"cards_offset" f table %alien-global
table card# [+] card-mark <byte> MOV
! Mark the card deck
src deck-bits card-bits - SHR
"decks_offset" f temp %alien-global
temp src [+] card-mark <byte> MOV ;
card# deck-bits card-bits - SHR
"decks_offset" f table %alien-global
table card# [+] card-mark <byte> MOV ;
: load-zone-ptr ( reg -- )
#! Load pointer to start of zone array