compiler.tree.propagation: ensure that we don't call 'equal?' or 'hashcode' on literals in words being compiled
parent
d0dc6ba8af
commit
3b5f7a9ecf
|
@ -312,16 +312,12 @@ SYMBOL: value-infos
|
||||||
value-info >literal< ;
|
value-info >literal< ;
|
||||||
|
|
||||||
: possible-boolean-values ( info -- values )
|
: possible-boolean-values ( info -- values )
|
||||||
dup literal?>> [
|
class>> {
|
||||||
literal>> 1array
|
{ [ dup null-class? ] [ { } ] }
|
||||||
] [
|
{ [ dup true-class? ] [ { t } ] }
|
||||||
class>> {
|
{ [ dup false-class? ] [ { f } ] }
|
||||||
{ [ dup null-class? ] [ { } ] }
|
[ { t f } ]
|
||||||
{ [ dup true-class? ] [ { t } ] }
|
} cond nip ;
|
||||||
{ [ dup false-class? ] [ { f } ] }
|
|
||||||
[ { t f } ]
|
|
||||||
} cond nip
|
|
||||||
] if ;
|
|
||||||
|
|
||||||
: node-value-info ( node value -- info )
|
: node-value-info ( node value -- info )
|
||||||
swap info>> at* [ drop null-info ] unless ;
|
swap info>> at* [ drop null-info ] unless ;
|
||||||
|
|
|
@ -946,3 +946,9 @@ M: tuple-with-read-only-slot clone
|
||||||
|
|
||||||
[ t ] [ [ { float float } declare max ] { max } inlined? ] unit-test
|
[ t ] [ [ { float float } declare max ] { max } inlined? ] unit-test
|
||||||
[ f ] [ [ { float float } declare max ] { float-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
|
||||||
|
|
Loading…
Reference in New Issue