diff --git a/basis/compiler/cfg/linear-scan/allocation/spilling/spilling-docs.factor b/basis/compiler/cfg/linear-scan/allocation/spilling/spilling-docs.factor index 0715fa9271..01da78a297 100644 --- a/basis/compiler/cfg/linear-scan/allocation/spilling/spilling-docs.factor +++ b/basis/compiler/cfg/linear-scan/allocation/spilling/spilling-docs.factor @@ -32,8 +32,8 @@ HELP: split-for-spill { $values { "live-interval" live-interval-state } { "n" integer } - { "before" live-interval-state } - { "after" live-interval-state } + { "before/f" $maybe live-interval-state } + { "after/f" $maybe live-interval-state } } { $description "During register allocation an interval needs to be split so that the 'after' part of it can be placed in a spill slot." } ; HELP: spill-intersecting diff --git a/basis/compiler/cfg/linear-scan/allocation/spilling/spilling-tests.factor b/basis/compiler/cfg/linear-scan/allocation/spilling/spilling-tests.factor index 62e429d60b..23195d76be 100644 --- a/basis/compiler/cfg/linear-scan/allocation/spilling/spilling-tests.factor +++ b/basis/compiler/cfg/linear-scan/allocation/spilling/spilling-tests.factor @@ -36,6 +36,11 @@ IN: compiler.cfg.linear-scan.allocation.spilling.tests test-live-interval last-use-rep ] unit-test +! spill-before +{ f } [ + 30 spill-before +] unit-test + ! trim-after-ranges { T{ live-interval-state diff --git a/basis/compiler/cfg/linear-scan/allocation/spilling/spilling.factor b/basis/compiler/cfg/linear-scan/allocation/spilling/spilling.factor index d1901a3509..cb7893a340 100644 --- a/basis/compiler/cfg/linear-scan/allocation/spilling/spilling.factor +++ b/basis/compiler/cfg/linear-scan/allocation/spilling/spilling.factor @@ -61,7 +61,7 @@ ERROR: bad-live-ranges interval ; } cleave ] if ; -: split-for-spill ( live-interval n -- before after ) +: split-for-spill ( live-interval n -- before/f after/f ) split-interval [ spill-before ] [ spill-after ] bi* ; : find-next-use ( live-interval new -- n ) @@ -96,8 +96,7 @@ ERROR: bad-live-ranges interval ; : spill ( live-interval n -- ) split-for-spill - [ [ add-handled ] when* ] - [ [ add-unhandled ] when* ] bi* ; + [ [ add-handled ] when* ] [ [ add-unhandled ] when* ] bi* ; :: spill-intersecting-active ( new reg -- ) new active-intervals-for [ [ reg>> reg = ] find swap dup ] keep