|
379 | 379 | (block ,name |
380 | 380 | (let ((%%pretty-fname ',pretty-fname)) |
381 | 381 | (declare (ignorable %%pretty-fname)) |
382 | | - (flet ((,name (&rest args) |
383 | | - ,(format nil "Proxy function to forward ~S calls to ~S" name impl-name) |
384 | | - (apply #',impl-name args))) |
385 | | - (declare (ignorable #',name) (inline ,name)) |
386 | | - ,@forms)))) |
| 382 | + ;; For simple functions with only required arguments, locally define |
| 383 | + ;; an inlined proxy function $FOO that forwards to FOO-IMPL. |
| 384 | + ;; Within the proxy function, prevent FOO-IMPL from being inlined, |
| 385 | + ;; as that would cause infinite recursive inlining. |
| 386 | + ;; This mechanism catches direct and indirect (e.g. MAPCAR) recursion |
| 387 | + ;; avoids having to go through $FOO with argument checking each time. |
| 388 | + ,@(if (and nil required-args |
| 389 | + (null optional-args) |
| 390 | + (not restp) |
| 391 | + (not keywords-present-p) |
| 392 | + (not allow-other-keys-p)) |
| 393 | + `((flet ((,name ,required-args |
| 394 | + ,(format nil "Proxy function to forward ~S calls to ~S" name impl-name) |
| 395 | + (declare (notinline ,impl-name)) |
| 396 | + (,impl-name ,@required-args))) |
| 397 | + (declare (ignorable #',name) (inline ,name)) |
| 398 | + ,@forms)) |
| 399 | + forms)))) |
387 | 400 |
|
388 | 401 | (let ,(when deprecated-p `((,warning-done-var nil))) |
389 | 402 | (defun ,name (&rest ,args) |
|
0 commit comments