Fix a bug in the kill literals phase

release
slava 2006-03-04 23:46:49 +00:00
parent b8bcdc8909
commit c9f07af111
4 changed files with 27 additions and 3 deletions

View File

@ -36,6 +36,7 @@
+ compiler/ffi:
- inform-compile dies with funny error
- amd64 %unbox-struct
- float intrinsics
- complex float type

View File

@ -15,7 +15,7 @@ C: sorter ( seq start end -- sorter )
: exchange ( n n seq -- )
[ tuck nth-unsafe >r nth r> ] 3keep tuck
>r >r set-nth-unsafe r> r> set-nth-unsafe ;
>r >r set-nth-unsafe r> r> set-nth-unsafe ; inline
: s*/e* dup sorter-start swap sorter-end ; inline
: s*/e dup sorter-start swap sorter-seq length 1- ; inline

View File

@ -75,8 +75,8 @@ M: #killable live-values* ( node -- seq ) drop { } ;
! #label
M: #label live-values* ( node -- seq )
dup node-child [ node-in-d ] 2apply 2array
purge-invariants ;
dup node-child node-in-d over node-in-d 2array
rot collect-recursion append purge-invariants ;
! branching
UNION: #branch #if #dispatch ;

View File

@ -38,6 +38,20 @@ IN: temporary
: set= 2dup subset? >r swap subset? r> and ;
: kill-set dup live-values swap literals hash-diff ;
: kill-set=
dataflow kill-set hash-keys [ value-literal ] map set= ;
: foo 1 2 3 ;
[ H{ } ] [ \ foo word-def dataflow kill-set ] unit-test
[ t ] [ [ [ 1 ] [ 2 ] ] [ [ 1 ] [ 2 ] if ] kill-set= ] unit-test
[ t ] [ [ [ 1 ] [ 2 ] ] [ [ 1 ] [ 2 ] if ] kill-set= ] unit-test
: literal-kill-test-1 4 compiled-offset 2 cells - ; compiled
[ 4 ] [ literal-kill-test-1 drop ] unit-test
@ -68,6 +82,10 @@ IN: temporary
[ ] [ t literal-kill-test-6 ] unit-test
[ ] [ f literal-kill-test-6 ] unit-test
[ t ] [ [
5 [ dup ] [ dup ] ] \ literal-kill-test-6 word-def kill-set=
] unit-test
: literal-kill-test-7
[ 1 2 3 ] >r + r> drop ; compiled
@ -76,6 +94,11 @@ IN: temporary
: literal-kill-test-8
dup [ >r dup slip r> literal-kill-test-8 ] [ 2drop ] if ; inline
[ t ] [
[ [ ] swap literal-kill-test-8 ] dataflow
live-values hash-values [ value? ] subset empty?
] unit-test
! Test method inlining
[ f ] [ fixnum { } min-class ] unit-test