,(if (policy *lexenv* (zerop verify-arg-count))
`(declare (ignore ,n-supplied))
`(%verify-arg-count ,n-supplied ,nargs))
- (locally
- (declare (optimize (merge-tail-calls 3)))
- (%funcall ,fun ,@temps)))))
+ (%funcall ,fun ,@temps))))
(optional-dispatch
(let* ((min (optional-dispatch-min-args fun))
(max (optional-dispatch-max-args fun))
,(with-unique-names (n-context n-count)
`(multiple-value-bind (,n-context ,n-count)
(%more-arg-context ,n-supplied ,max)
- (locally
- (declare (optimize (merge-tail-calls 3)))
- (%funcall ,more ,@temps ,n-context ,n-count)))))))
+ (%funcall ,more ,@temps ,n-context ,n-count))))))
(t
(%arg-count-error ,n-supplied)))))))))
(call-args t)))
(:rest
(call-args `(list ,@more-temps))
+ ;; &REST arguments may be accompanied by extra
+ ;; context and count arguments. We know this by
+ ;; the ARG-INFO-DEFAULT. Supply NIL and 0 or
+ ;; don't convert at all depending.
+ (let ((more (arg-info-default info)))
+ (when more
+ (unless (eq t more)
+ (destructuring-bind (context count &optional used) more
+ (declare (ignore context count))
+ (when used
+ ;; We've already converted to use the more context
+ ;; instead of the rest list.
+ (return-from convert-more-call))))
+ (call-args nil)
+ (call-args 0)
+ (setf (arg-info-default info) t)))
(return))
(:keyword
(return)))