- (do ((eps (optional-dispatch-entry-points fun) (rest eps))
- (n min (1+ n)))
- ((null eps))
- (entries `((= ,n-supplied ,n)
- (%funcall ,(first eps) ,@(subseq temps 0 n)))))
- `(lambda (,n-supplied ,@temps)
- ;; FIXME: Make sure that INDEX type distinguishes between
- ;; target and host. (Probably just make the SB!XC:DEFTYPE
- ;; different from CL:DEFTYPE.)
- (declare (type index ,n-supplied))
- (cond
- ,@(if more (butlast (entries)) (entries))
- ,@(when more
- `((,(if (zerop min) t `(>= ,n-supplied ,max))
- ,(let ((n-context (gensym))
- (n-count (gensym)))
- `(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)))))))
- (t
- (%arg-count-error ,n-supplied)))))))))
+ ;; Force convertion of all entries
+ (optional-dispatch-entry-point-fun fun 0)
+ (loop for ep in (optional-dispatch-entry-points fun)
+ and n from min
+ do (entries `((eql ,n-supplied ,n)
+ (%funcall ,(force ep) ,@(subseq temps 0 n)))))
+ `(lambda (,n-supplied ,@temps)
+ ;; FIXME: Make sure that INDEX type distinguishes between
+ ;; target and host. (Probably just make the SB!XC:DEFTYPE
+ ;; different from CL:DEFTYPE.)
+ (declare (type index ,n-supplied))
+ (cond
+ ,@(if more (butlast (entries)) (entries))
+ ,@(when more
+ ;; KLUDGE: (NOT (< ...)) instead of >= avoids one round of
+ ;; deftransforms and lambda-conversion.
+ `((,(if (zerop min) t `(not (< ,n-supplied ,max)))
+ ,(let ((n-context (gensym))
+ (n-count (gensym)))
+ `(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)))))))
+ (t
+ (%arg-count-error ,n-supplied)))))))))