Minor fixes

release
slava 2006-05-14 19:44:07 +00:00
parent 22eae0be15
commit 4513192968
4 changed files with 28 additions and 7 deletions

View File

@ -240,8 +240,3 @@ M: #return generate-node drop end-basic-block %return f ;
: float-offset 8 float-tag - ;
: string-offset 3 cells object-tag - ;
: fp-scratch ( -- vreg )
"fp-scratch" get [
T{ int-regs } alloc-reg dup "fp-scratch" set
] unless* ;

View File

@ -242,8 +242,31 @@ SYMBOL: +clobber
: requested-vregs ( template -- int# float# )
dup length swap [ float eq? ] subset length [ - ] keep ;
: (holds-class?) ( class phantom -- ? )
[ delegate class eq? ] contains-with? ;
: holds-class? ( class -- ? )
dup phantom-d get (holds-class?) swap
phantom-r get (holds-class?) or ;
: (requests-class?) ( class template -- )
[ second reg-spec>class eq? ] contains-with? ;
: requests-class? ( class -- ? )
dup +input get (requests-class?) swap
+scratch get (requests-class?) or ;
: ?fp-scratch ( -- n )
T{ float-regs f 8 } dup holds-class? >r requests-class? r>
or 1 0 ? ;
: fp-scratch ( -- vreg )
"fp-scratch" get [
T{ int-regs } alloc-reg dup "fp-scratch" set
] unless* ;
: guess-vregs ( -- int# float# )
+input get { } additional-vregs
+input get { } additional-vregs ?fp-scratch +
+scratch get [ first ] map requested-vregs >r + r> ;
: alloc-scratch ( -- )

View File

@ -123,7 +123,7 @@ M: int-regs (%replace) ( vreg loc -- )
] bind save-allot-ptr ; inline
M: float-regs (%replace) ( vreg loc reg-class -- )
drop swap
drop swap fp-scratch drop
[ v>operand 12 8 STFD ]
[ fp-scratch v>operand swap loc>operand STW ] H{
{ tag-header [ float-tag ] }

View File

@ -6,6 +6,9 @@ math-internals test ;
[ 2.0 3.0 ] [ 3.0 [ 2.0 swap ] compile-1 ] unit-test
[ 1 2 3 4.0 ] [ [ 1 2 3 4.0 ] compile-1 ] unit-test
[ 3.0 1 2 3 ] [ 1.0 2.0 [ float+ 1 2 3 ] compile-1 ] unit-test
[ 5 ] [ 1.0 [ 2.0 float+ tag ] compile-1 ] unit-test
[ 3.0 ] [ 1.0 [ 2.0 float+ ] compile-1 ] unit-test