Global write barrier elimination tracks newly allocated objects

db4
Daniel Ehrenberg 2009-08-13 15:18:47 -05:00
parent ad772cd261
commit 5a3e350490
2 changed files with 25 additions and 4 deletions

View File

@ -93,6 +93,24 @@ cfg new 1 get >>entry 0 set
T{ ##set-slot-imm f 2 1 3 4 }
} ] [ 2 get instructions>> ] unit-test
V{
T{ ##allot f 1 }
} 1 test-bb
V{
T{ ##set-slot-imm f 2 1 3 4 }
T{ ##write-barrier f 1 2 3 }
} 2 test-bb
1 get 2 get 1vector >>successors drop
cfg new 1 get >>entry 0 set
[ ] [ 0 [ eliminate-write-barriers ] change ] unit-test
[ V{
T{ ##allot f 1 }
} ] [ 1 get instructions>> ] unit-test
[ V{
T{ ##set-slot-imm f 2 1 3 4 }
} ] [ 2 get instructions>> ] unit-test
V{
T{ ##set-slot-imm f 2 1 3 4 }
T{ ##write-barrier f 1 2 3 }

View File

@ -36,12 +36,15 @@ FORWARD-ANALYSIS: safe
: has-allocation? ( bb -- ? )
instructions>> [ { [ ##allocation? ] [ ##call? ] } 1|| ] any? ;
GENERIC: safe-slot ( insn -- slot ? )
M: object safe-slot drop f f ;
M: ##write-barrier safe-slot src>> t ;
M: ##allot safe-slot dst>> t ;
M: safe-analysis transfer-set
drop [ H{ } assoc-clone-like ] dip
instructions>> over '[
dup ##write-barrier? [
src>> _ conjoin
] [ drop ] if
safe-slot [ _ conjoin ] [ drop ] if
] each ;
M: safe-analysis join-sets
@ -53,5 +56,5 @@ M: safe-analysis join-sets
instructions>> [ eliminate-write-barrier ] filter-here ;
: eliminate-write-barriers ( cfg -- cfg' )
dup compute-safe-sets
dup compute-safe-sets
dup [ write-barriers-step ] each-basic-block ;