compiler.tree.propagation: ensure that we don't call 'equal?' or 'hashcode' on literals in words being compiled

db4
Slava Pestov 2010-01-16 20:00:48 +13:00
parent d0dc6ba8af
commit 3b5f7a9ecf
2 changed files with 12 additions and 10 deletions

View File

@ -312,16 +312,12 @@ SYMBOL: value-infos
value-info >literal< ;
: possible-boolean-values ( info -- values )
dup literal?>> [
literal>> 1array
] [
class>> {
{ [ dup null-class? ] [ { } ] }
{ [ dup true-class? ] [ { t } ] }
{ [ dup false-class? ] [ { f } ] }
[ { t f } ]
} cond nip
] if ;
class>> {
{ [ dup null-class? ] [ { } ] }
{ [ dup true-class? ] [ { t } ] }
{ [ dup false-class? ] [ { f } ] }
[ { t f } ]
} cond nip ;
: node-value-info ( node value -- info )
swap info>> at* [ drop null-info ] unless ;

View File

@ -946,3 +946,9 @@ M: tuple-with-read-only-slot clone
[ t ] [ [ { float float } declare max ] { max } inlined? ] unit-test
[ f ] [ [ { float float } declare max ] { float-max } inlined? ] unit-test
! Propagation should not call equal?, hashcode, etc on literals in user code
[ V{ } ] [ [ 4 <reversed> [ 2drop ] with each ] final-info ] unit-test
! Reduction
[ 1 ] [ [ 4 <reversed> [ nth-unsafe ] [ ] unless ] final-info length ] unit-test