[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array Register Analog in MCL?



Actually, schar does expand to efficient code if you declare its arguments.
BTW, this thread has been very helpful to me, because I was looking for
exactly this optimization and didn't know how to get it.  --Pete Szolovits


? (defmacro foo (s i)
    `(locally (declare (optimize (speed 3) (safety 0))
                       (simple-string ,s)
                       (fixnum ,i))
       (schar ,s ,i)))
foo
? (defun bar (j)
    (foo "abcdefghijklmnopq" j))
bar
? (disassemble #'bar)
0 (jsr_subprim $SP-ONE-ARG-VPUSH)
4 (move.l '"abcdefghijklmnopq" atemp0)
10 (move.l @vsp d1)
12 (asr.l 3 d1)
14 (moveq 15 d0)
16 (swap d0)
18 (move.b (atemp0 d1.l 7) d0)
22 (swap d0)
24 (spop vsp)
26 (rts)
? (bar 0)
#\a