Raymond Toy <[EMAIL PROTECTED]> wrote:
> Could you send the macroexpansion you get for dotimes i? Or tell us what
> version of cmucl you are using?
CL-USER> (lisp-implementation-type)
"CMU Common Lisp"
CL-USER> (lisp-implementation-version)
"CVS 19c 19c-release-patch-1 + minimal debian patches (19C)"
CL-USER>
The macro-expansion of the following dotimes call:
(dotimes (i 100)
(declare (type fixnum i))
(stuff))
gives this:
(BLOCK NIL
(LET ((I 0))
(DECLARE (TYPE (INTEGER 0 100) I))
(DECLARE (TYPE FIXNUM I))
(TAGBODY
(GO #:G1885)
#:G1884
(STUFF)
(LET* ()
(MULTIPLE-VALUE-BIND (#:G1886)
(1+ I)
(PROGN
(SETQ I #:G1886)
NIL)))
#:G1885
(IF (NOT (>= I 100))
(PROGN
NIL
(GO #:G1884))
NIL)
(RETURN-FROM NIL
(PROGN
NIL)))))
> While it's pretty obvious that if SIZE has a certain range, and I should
> have a similar range, CMUCL is not smart enough to derive that.
>
> Even with this new macro, I get notes about I but not about J. If you
> declare I to be a fixnum, the notes go away, and the generated code
> looks nice without calls to generic bignum arithmetic.
Yup.
> Perhaps the compiler is able to determine J is a fixnum because of the aref
> operation. I'd have to dig deep into the compiler to figure out what's
> happening here.
OK. Thanks.
--
Didier Verna, [EMAIL PROTECTED], http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-BicĂȘtre, France Fax.+33 (1) 53 14 59 22 [EMAIL PROTECTED]