(1+ *faa*))
(faa 1d0) => type error
-278:
- a.
- (defun foo ()
- (declare (optimize speed))
- (loop for i of-type (integer 0) from 0 by 2 below 10
- collect i))
-
- uses generic arithmetic.
-
- b. (fixed in 0.8.3.6)
-
279: type propagation error -- correctly inferred type goes astray?
In sbcl-0.8.3 and sbcl-0.8.1.47, the warning
The binding of ABS-FOO is a (VALUES (INTEGER 0 0)
* bug fix: FILE-STRING-LENGTH is now external-format sensitive,
returning the number of octets which would be written to the
file-stream. (thanks to Robert J. Macomber)
+ * optimization: improved type inference for arithmetic-for
+ index variables in LOOP
changes in sbcl-0.9.7 relative to sbcl-0.9.6:
* minor incompatible change: (SETF CLASS-NAME) and (SETF
(setq step-hack
`(,variable ,step-hack)))
(let ((first-test test) (remaining-tests test))
+ ;; As far as I can tell, the effect of the following code is
+ ;; to detect cases where we know statically whether the first
+ ;; iteration of the loop will be executed. Depending on the
+ ;; situation, we can either:
+ ;; a) save one jump and one comparison per loop (not per iteration)
+ ;; when it will get executed
+ ;; b) remove the loop body completely when it won't be executed
+ ;;
+ ;; Noble goals. However, the code generated in case a) will
+ ;; fool the loop induction variable detection, and cause
+ ;; code like (LOOP FOR I TO 10 ...) to use generic addition
+ ;; (bug #278a).
+ ;;
+ ;; Since the gain in case a) is rather minimal and Python is
+ ;; generally smart enough to handle b) without any extra
+ ;; support from the loop macro, I've disabled this code for
+ ;; now. The code and the comment left here in case somebody
+ ;; extends the induction variable bound detection to work
+ ;; with code where the stepping precedes the test.
+ ;; -- JES 2005-11-30
+ #+nil
(when (and stepby-constantp start-constantp limit-constantp
(realp start-value) (realp limit-value))
(when (setq first-test
'((:from :upfrom :downfrom) (:to :upto :downto :above :below) (:by))
nil (list (list kwd val)))))
-(defun loop-sequence-elements-path (variable data-type prep-phrases
- &key
- fetch-function
- size-function
- sequence-type
- element-type)
- (multiple-value-bind (indexv) (loop-named-var 'index)
- (let ((sequencev (loop-named-var 'sequence)))
- (list* nil nil ; dummy bindings and prologue
- (loop-sequencer
- indexv 'fixnum
- variable (or data-type element-type)
- sequencev sequence-type
- `(,fetch-function ,sequencev ,indexv)
- `(,size-function ,sequencev)
- prep-phrases)))))
\f
;;;; builtin LOOP iteration paths