[gambit-list] More inlinable routines

Bradley Lucier lucier at math.purdue.edu
Tue Mar 21 17:59:45 EST 2006


Marc:

I decided to go through gambit.h in a somewhat regular way to see  
which functions are inlined and which could be inlined in  
gambc40b17.  I know your current source tree inlines more, so I  
apologize if some of these are already done, but here are things that  
I found could be inlined.  This is copied from an expansion of test  
code.

1.  With mostly-fixnum:

            (bitwise-ior:80 x:57 y:58)
            (bitwise-xor:81 x:57 y:58)
            (bitwise-and:82 x:57 y:58)
            (bitwise-not:83 x:57)
            (arithmetic-shift:84 x:57 -2)
            (zero?:85 x:57)
            (negative?:86 x:57)
            (positive?:87 x:57)
            (odd?:88 x:57)
            (even?:89 x:57)
            (exact->inexact:99)
            (max:100 x:57 y:58)
            (min:101 x:57 y:58)
            (abs:103 x:57)
            (floor:104 x:57)
            (ceiling:105 x:57)
            (round:106 x:57)
            (set-car!:123 x:57 y:58)
            (set-cdr!:124 x:57 y:58)
            (vector-length:138 x:57)
            (vector-ref:139 x:57 y:58)
            (vector-set!:140 x:57 y:58 z:59)
            (string-length:141 x:57)
            (string-ref:142 x:57 y:58)
            (string-set!:143 x:57 y:58 z:59)
            (s8vector-length:144 x:57)
            (s8vector-ref:145 x:57 y:58)
            (s8vector-set!:146 x:57 y:58 z:59)
            (s16vector-length:147 x:57)
            (s16vector-ref:148 x:57 y:58)
            (s16vector-set!:149 x:57 y:58 z:59)
            (s32vector-length:150 x:57)
            (s32vector-ref:151 x:57 y:58)
            (s32vector-set!:152 x:57 y:58 z:59)
            (s64vector-length:153 x:57)
            (s64vector-ref:154 x:57 y:58)
            (s64vector-set!:155 x:57 y:58 z:59)
            (u8vector-length:156 x:57)
            (u8vector-ref:157 x:57 y:58)
            (u8vector-set!:158 x:57 y:58 z:59)
            (u16vector-length:159 x:57)
            (u16vector-ref:160 x:57 y:58)
            (u16vector-set!:161 x:57 y:58 z:59)
            (u32vector-length:162 x:57)
            (u32vector-ref:163 x:57 y:58)
            (u32vector-set!:164 x:57 y:58 z:59)
            (u64vector-length:165 x:57)
            (u64vector-ref:166 x:57 y:58)
            (u64vector-set!:167 x:57 y:58 z:59)
            (f32vector-length:168 x:57)
            (f32vector-ref:169 x:57 y:58)
            (f32vector-set!:170 x:57 y:58 z:59)
            (f64vector-length:171 x:57)
            (f64vector-ref:172 x:57 y:58)
            (f64vector-set!:173 x:57 y:58 z:59))))

2.  With mostly-flonum:

If x is a flonum, these should just return x; instead, they box a  
copy of x:

       (+ x)
       (* x)

These actually generate incorrect code, returning (a copy of) flonum  
0. and 1. instead of fixnum 0 and 1:

      (+)
      (*)

Unimplemented:

             (zero?:85 x:205)
             (negative?:86 x:205)
             (positive?:87 x:205)

This should just check if its argument is inexact, and return it if so:

             (exact->inexact:99)

Unimplemented:

             (max:100 x:205 y:206)
             (min:101 x:205 y:206)

             (abs:103 x:205)
             (floor:104 x:205)
             (ceiling:105 x:205)
             (round:106 x:205)
             (exp:107 x:205)

unimplemented (need care to check for range of arguments):

             (asin:112 x:205)
             (acos:113 x:205)
             (atan:114 x:205)
             (sqrt:116 x:205)

Unimplemented:

             (atan:114 x:205 y:206)





More information about the Gambit-list mailing list