Fix overly-eager strength reduction for mod, and add a type function for >integer (reported by Joe Groff)
parent
741e97e57e
commit
466533d509
|
@ -148,10 +148,6 @@ most-negative-fixnum most-positive-fixnum [a,b]
|
||||||
comparison-ops
|
comparison-ops
|
||||||
[ dup '[ _ define-comparison-constraints ] each-derived-op ] each
|
[ dup '[ _ define-comparison-constraints ] each-derived-op ] each
|
||||||
|
|
||||||
! generic-comparison-ops [
|
|
||||||
! dup specific-comparison define-comparison-constraints
|
|
||||||
! ] each
|
|
||||||
|
|
||||||
! Remove redundant comparisons
|
! Remove redundant comparisons
|
||||||
: fold-comparison ( info1 info2 word -- info )
|
: fold-comparison ( info1 info2 word -- info )
|
||||||
[ [ interval>> ] bi@ ] dip interval-comparison {
|
[ [ interval>> ] bi@ ] dip interval-comparison {
|
||||||
|
@ -217,6 +213,8 @@ generic-comparison-ops [
|
||||||
{ >float float }
|
{ >float float }
|
||||||
{ fixnum>float float }
|
{ fixnum>float float }
|
||||||
{ bignum>float float }
|
{ bignum>float float }
|
||||||
|
|
||||||
|
{ >integer integer }
|
||||||
} [
|
} [
|
||||||
'[
|
'[
|
||||||
_
|
_
|
||||||
|
@ -228,19 +226,26 @@ generic-comparison-ops [
|
||||||
] "outputs" set-word-prop
|
] "outputs" set-word-prop
|
||||||
] assoc-each
|
] assoc-each
|
||||||
|
|
||||||
|
: rem-custom-inlining ( #call -- quot/f )
|
||||||
|
second value-info literal>> dup integer?
|
||||||
|
[ power-of-2? [ 1- bitand ] f ? ] [ drop f ] if ;
|
||||||
|
|
||||||
{
|
{
|
||||||
mod-integer-integer
|
mod-integer-integer
|
||||||
mod-integer-fixnum
|
mod-integer-fixnum
|
||||||
mod-fixnum-integer
|
mod-fixnum-integer
|
||||||
fixnum-mod
|
fixnum-mod
|
||||||
rem
|
|
||||||
} [
|
} [
|
||||||
[
|
[
|
||||||
in-d>> second value-info >literal<
|
in-d>> dup first value-info interval>> [0,inf] interval-subset?
|
||||||
[ dup integer? [ power-of-2? [ 1- bitand ] f ? ] [ drop f ] if ] when
|
[ rem-custom-inlining ] [ drop f ] if
|
||||||
] "custom-inlining" set-word-prop
|
] "custom-inlining" set-word-prop
|
||||||
] each
|
] each
|
||||||
|
|
||||||
|
\ rem [
|
||||||
|
in-d>> rem-custom-inlining
|
||||||
|
] "custom-inlining" set-word-prop
|
||||||
|
|
||||||
{
|
{
|
||||||
bitand-integer-integer
|
bitand-integer-integer
|
||||||
bitand-integer-fixnum
|
bitand-integer-fixnum
|
||||||
|
|
|
@ -690,4 +690,7 @@ TUPLE: littledan-2 { from read-only } { to read-only } ;
|
||||||
! Mutable tuples with circularity should not cause problems
|
! Mutable tuples with circularity should not cause problems
|
||||||
TUPLE: circle me ;
|
TUPLE: circle me ;
|
||||||
|
|
||||||
[ ] [ circle new dup >>me 1quotation final-info drop ] unit-test
|
[ ] [ circle new dup >>me 1quotation final-info drop ] unit-test
|
||||||
|
|
||||||
|
! Joe found an oversight
|
||||||
|
[ V{ integer } ] [ [ >integer ] final-classes ] unit-test
|
Loading…
Reference in New Issue