Simple optimizatiaon problem -- signed word to integer coercion.

From: Szymon (r5z-u28s_g1d_at_o2.pl)
Date: 10/29/04


Date: 29 Oct 2004 11:12:11 +0200


Hi.

Example code:

(defun is-in-simple-string-p (ch str)
  (declare
   (optimize speed) (inline is-in-simple-string-p) (type character ch) (type simple-string str))
  (prog ((index -1) (str-len (length str)))
        (declare
         (type fixnum index str-len))
        |TAG| (if (not (eql (schar str (if (eql (incf index) str-len) (return NIL) index)) ch))
                  (go |TAG|)
                (return T))))

Compiler(SBCL)=>luser output:

; in: LAMBDA NIL
; (INCF INDEX)
; --> LET* SETQ
; ==>
; (THE #<SB-KERNEL:NUMERIC-TYPE FIXNUM> #:G0)
;
; note: doing signed word to integer coercion (cost 20), for:
; the first argument of CHECK-FIXNUM
; compilation unit finished

How to get rid of this? I declared index FIXNUM...

TIA, Szymon.



Relevant Pages