1 USING: math.private kernel combinators accessors arrays
2 generalizations tools.test ;
5 : float-spill-bug ( a -- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b )
47 [ 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 ]
48 [ 1.0 float-spill-bug ] unit-test
50 [ t ] [ \ float-spill-bug optimized>> ] unit-test
52 : float-fixnum-spill-bug ( object -- object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object object )
55 [ float>fixnum dup fixnum+fast ]
57 [ float>fixnum dup fixnum+fast ]
59 [ float>fixnum dup fixnum+fast ]
61 [ float>fixnum dup fixnum+fast ]
63 [ float>fixnum dup fixnum+fast ]
65 [ float>fixnum dup fixnum+fast ]
67 [ float>fixnum dup fixnum+fast ]
69 [ float>fixnum dup fixnum+fast ]
71 [ float>fixnum dup fixnum+fast ]
73 [ float>fixnum dup fixnum+fast ]
75 [ float>fixnum dup fixnum+fast ]
77 [ float>fixnum dup fixnum+fast ]
79 [ float>fixnum dup fixnum+fast ]
81 [ float>fixnum dup fixnum+fast ]
83 [ float>fixnum dup fixnum+fast ]
85 [ float>fixnum dup fixnum+fast ]
87 [ float>fixnum dup fixnum+fast ]
89 [ float>fixnum dup fixnum+fast ]
91 [ float>fixnum dup fixnum+fast ]
93 [ float>fixnum dup fixnum+fast ]
95 [ float>fixnum dup fixnum+fast ]
97 [ float>fixnum dup fixnum+fast ]
99 [ float>fixnum dup fixnum+fast ]
101 [ float>fixnum dup fixnum+fast ]
103 [ float>fixnum dup fixnum+fast ]
105 [ float>fixnum dup fixnum+fast ]
107 [ float>fixnum dup fixnum+fast ]
109 [ float>fixnum dup fixnum+fast ]
111 [ float>fixnum dup fixnum+fast ]
113 [ float>fixnum dup fixnum+fast ]
115 [ float>fixnum dup fixnum+fast ]
117 [ float>fixnum dup fixnum+fast ]
119 [ float>fixnum dup fixnum+fast ]
121 [ float>fixnum dup fixnum+fast ]
123 [ float>fixnum dup fixnum+fast ]
125 [ float>fixnum dup fixnum+fast ]
127 [ float>fixnum dup fixnum+fast ]
129 [ float>fixnum dup fixnum+fast ]
132 [ 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 2.0 2 ]
133 [ 1.0 float-fixnum-spill-bug ] unit-test
135 [ t ] [ \ float-fixnum-spill-bug optimized>> ] unit-test
137 : resolve-spill-bug ( a b -- c )
138 [ 1 fixnum+fast ] bi@ dup 10 fixnum< [
162 [ t ] [ \ resolve-spill-bug optimized>> ] unit-test
164 [ 4 ] [ 1 1 resolve-spill-bug ] unit-test
166 ! The above don't really test spilling...
167 : spill-test-1 ( a -- b )
196 dup 1 fixnum+fast fixnum>float
198 3array [ 8 narray ] dip 2array
199 [ 8 narray [ 8 narray ] dip 2array ] dip 2array
206 { { 2 3 4 5 6 7 8 9 } { 10 11 12 13 14 15 16 17 } }
208 { 18 19 20 21 22 23 24 25 }
209 { 26 27 { 28 29 30.0 } }
213 ] [ 1 spill-test-1 ] unit-test
215 : spill-test-2 ( a -- b )
343 [ t ] [ 1.0 spill-test-2 1.0 \ spill-test-2 def>> call = ] unit-test