compiler.tree.propagation.transforms: fix problem with 'shift' transform when input was a bignum

db4
Slava Pestov 2009-10-23 07:50:56 -05:00
parent b23ab401c8
commit e46259bd33
2 changed files with 7 additions and 1 deletions

View File

@ -443,5 +443,7 @@ M: object bad-dispatch-position-test* ;
[ -1 ] [ 3 4 0 dispatch-branch-problem ] unit-test
[ 12 ] [ 3 4 1 dispatch-branch-problem ] unit-test
[ 1024 bignum ] [ 10 [ 1 >bignum swap >fixnum shift ] compile-call dup class ] unit-test
! Not sure if I want to fix this...
! [ t [ [ f ] [ 3 ] if >fixnum ] compile-call ] [ no-method? ] must-fail-with

View File

@ -100,8 +100,12 @@ IN: compiler.tree.propagation.transforms
] each
! Speeds up 2^
: 2^? ( #call -- ? )
in-d>> first value-info
{ [ literal>> 1 = ] [ class>> fixnum class<= ] } 1&& ;
\ shift [
in-d>> first value-info literal>> 1 = [
2^? [
cell-bits tag-bits get - 1 -
'[
>fixnum dup 0 < [ 2drop 0 ] [