diff --git a/basis/compiler/cfg/linear-scan/assignment/assignment-tests.factor b/basis/compiler/cfg/linear-scan/assignment/assignment-tests.factor index ed62a964dc..354958a40b 100644 --- a/basis/compiler/cfg/linear-scan/assignment/assignment-tests.factor +++ b/basis/compiler/cfg/linear-scan/assignment/assignment-tests.factor @@ -179,7 +179,7 @@ IN: compiler.cfg.linear-scan.assignment.tests } ; { - V{ { RDI float-rep T{ spill-slot } } } + V{ { RDI int-rep T{ spill-slot } } } } [ f f cfg set H{ } clone spill-slots set diff --git a/basis/compiler/cfg/linear-scan/assignment/assignment.factor b/basis/compiler/cfg/linear-scan/assignment/assignment.factor index 3225b583b8..1ce2dd3dbe 100644 --- a/basis/compiler/cfg/linear-scan/assignment/assignment.factor +++ b/basis/compiler/cfg/linear-scan/assignment/assignment.factor @@ -112,14 +112,19 @@ RENAMING: assign [ vreg>reg ] [ vreg>reg ] [ vreg>reg ] [ pending-interval-heap get heap-members ] 2dip '[ _ _ spill-required? ] filter ; -: spill/reload ( interval -- {reg,rep,slot} ) - [ reg>> ] [ vreg>> dup rep-of dup swapd assign-spill-slot ] bi 3array ; +: rep-at-insn ( n interval -- rep ) + (find-use) [ def-rep>> ] [ use-rep>> ] bi or ; -: spill/reloads ( intervals -- spill/reloads ) - [ spill/reload ] map ; +: spill/reload ( n interval -- {reg,rep,slot} ) + [ rep-at-insn ] keep [ reg>> ] [ vreg>> ] bi + pick assign-spill-slot swapd 3array ; + +: spill/reloads ( n intervals -- spill/reloads ) + [ spill/reload ] with map ; : spill/reloads-for-call-gc ( ##call-gc -- spill-seq ) - [ gc-map>> gc-roots>> ] [ insn#>> ] bi spill-intervals spill/reloads ; + [ gc-map>> gc-roots>> ] [ insn#>> ] bi + [ spill-intervals ] keep swap spill/reloads ; : emit-##call-gc ( insn -- ) dup spill/reloads-for-call-gc