compiler.cfg.linear-scan.*: make it so cfg is given as an argument to next-spill-slot

db4
Björn Lindqvist 2015-11-01 09:57:07 +01:00
parent 67e7874e91
commit cfe4fec574
4 changed files with 10 additions and 15 deletions

View File

@ -49,8 +49,8 @@ HELP: init-allocator
{ $see-also reg-class } ;
HELP: next-spill-slot
{ $values { "size" "number of bytes required" } { "spill-slot" spill-slot } }
{ $description "Creates a new " { $link spill-slot } " of the given size and also allocates space in the " { $link cfg } " in the 'cfg' dynamic variable for it." } ;
{ $values { "size" "number of bytes required" } { "cfg" cfg } { "spill-slot" spill-slot } }
{ $description "Creates a new " { $link spill-slot } " of the given size and also allocates space in the " { $link cfg } " in the cfg for it." } ;
HELP: progress
{ $var-description "Start index of current live interval. We ensure that all live intervals added to the unhandled set have a start index strictly greater than this one. This ensures that we can catch infinite loop situations. We also ensure that all live intervals added to the handled set have an end index strictly smaller than this one. This helps catch bugs." }

View File

@ -2,8 +2,8 @@ USING: accessors assocs combinators.extras compiler.cfg
compiler.cfg.instructions compiler.cfg.linear-scan.allocation
compiler.cfg.linear-scan.allocation.state
compiler.cfg.linear-scan.live-intervals compiler.cfg.registers
compiler.cfg.utilities cpu.architecture cpu.x86.assembler.operands heaps
kernel layouts literals namespaces sequences system tools.test ;
compiler.cfg.utilities cpu.architecture cpu.x86.assembler.operands fry
heaps kernel layouts literals namespaces sequences system tools.test ;
IN: compiler.cfg.linear-scan.allocation.state.tests
! active-intervals-for
@ -128,14 +128,11 @@ ${ cell } [
! next-spill-slot
{
T{ cfg { spill-area-size 16 } }
T{ spill-slot f 0 }
T{ spill-slot f 8 }
T{ cfg { spill-area-size 16 } }
} [
H{ } clone spill-slots set
T{ cfg { spill-area-size 0 } } cfg set
[ 8 next-spill-slot ] twice
cfg get
T{ cfg { spill-area-size 0 } } dup '[ 8 _ next-spill-slot ] twice
] unit-test
! >unhandled-min-heap

View File

@ -113,10 +113,8 @@ ERROR: register-already-used live-interval ;
: reg-class-assoc ( quot -- assoc )
[ reg-classes ] dip { } map>assoc ; inline
: next-spill-slot ( size -- spill-slot )
cfg get
[ swap [ align dup ] [ + ] bi ] change-spill-area-size drop
<spill-slot> ;
: next-spill-slot ( size cfg -- spill-slot )
[ swap [ align dup ] [ + ] bi ] change-spill-area-size drop <spill-slot> ;
: align-spill-area ( align cfg -- )
[ max ] change-spill-area-align drop ;
@ -126,7 +124,7 @@ SYMBOL: spill-slots
: assign-spill-slot ( coalesced-vreg rep -- spill-slot )
rep-size
[ cfg get align-spill-area ]
[ spill-slots get [ nip next-spill-slot ] 2cache ]
[ spill-slots get [ nip cfg get next-spill-slot ] 2cache ]
bi ;
: lookup-spill-slot ( coalesced-vreg rep -- spill-slot )

View File

@ -29,7 +29,7 @@ SYMBOL: temp-spills
: temp-spill ( rep -- spill-slot )
rep-size temp-spills get
[ next-spill-slot ] cache ;
[ cfg get next-spill-slot ] cache ;
SYMBOL: temp-locations