compiler.tree.propagation: bitand custom inlining was wrong if the second input was a bignum
parent
b4803b3191
commit
f01f7ad6eb
|
@ -82,6 +82,8 @@ IN: compiler.tree.propagation.tests
|
||||||
|
|
||||||
[ bignum ] [ [ { bignum bignum } declare bitxor ] final-math-class ] unit-test
|
[ bignum ] [ [ { bignum bignum } declare bitxor ] final-math-class ] unit-test
|
||||||
|
|
||||||
|
[ bignum ] [ [ { integer } declare 123 >bignum bitand ] final-math-class ] unit-test
|
||||||
|
|
||||||
[ float ] [ [ { float float } declare mod ] final-math-class ] unit-test
|
[ float ] [ [ { float float } declare mod ] final-math-class ] unit-test
|
||||||
|
|
||||||
[ V{ fixnum } ] [ [ 255 bitand ] final-classes ] unit-test
|
[ V{ fixnum } ] [ [ 255 bitand ] final-classes ] unit-test
|
||||||
|
|
|
@ -38,6 +38,12 @@ IN: compiler.tree.propagation.transforms
|
||||||
in-d>> rem-custom-inlining
|
in-d>> rem-custom-inlining
|
||||||
] "custom-inlining" set-word-prop
|
] "custom-inlining" set-word-prop
|
||||||
|
|
||||||
|
: positive-fixnum? ( obj -- ? )
|
||||||
|
{ [ fixnum? ] [ 0 >= ] } 1&& ;
|
||||||
|
|
||||||
|
: simplify-bitand? ( value -- ? )
|
||||||
|
value-info literal>> positive-fixnum? ;
|
||||||
|
|
||||||
{
|
{
|
||||||
bitand-integer-integer
|
bitand-integer-integer
|
||||||
bitand-integer-fixnum
|
bitand-integer-fixnum
|
||||||
|
@ -45,10 +51,17 @@ IN: compiler.tree.propagation.transforms
|
||||||
bitand
|
bitand
|
||||||
} [
|
} [
|
||||||
[
|
[
|
||||||
in-d>> second value-info >literal< [
|
{
|
||||||
0 most-positive-fixnum between?
|
{
|
||||||
[ [ >fixnum ] bi@ fixnum-bitand ] f ?
|
[ dup in-d>> first simplify-bitand? ]
|
||||||
] when
|
[ drop [ >fixnum fixnum-bitand ] ]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
[ dup in-d>> second simplify-bitand? ]
|
||||||
|
[ drop [ [ >fixnum ] dip fixnum-bitand ] ]
|
||||||
|
}
|
||||||
|
[ drop f ]
|
||||||
|
} cond
|
||||||
] "custom-inlining" set-word-prop
|
] "custom-inlining" set-word-prop
|
||||||
] each
|
] each
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue