Lisp HUG Maillist Archive

Inline expansion not found

Hi all,

I'm busy trying to get an idea of how to better optimize lisp code by 
using various declarations. However I get the following warning when 
compiling this code.

(declaim (ftype (function (single-float) single-float) foo)
          (ftype (function (single-float) single-float) bar))

(defun bar (float)
   (declare (optimize speed (safety 0) (debug 0) (float 0)))
   (1+ float))

(defun foo (float)
   (declare (optimize speed (safety 0) (debug 0) (float 0))
            (inline bar))
   (bar (1- float)))


;;;*** Warning in FOO: Inline expansion for BAR not found

Does anyone know how to get BAR inlined?
I've seen this in a couple of systems (eg. ironclad) and am quite 
curious as to what causes it.

Thanks,
  Sean.


Re: Inline expansion not found

Le 3/07/2006 15:14, Sean Ross écrivait :

>Hi all,
>
>I'm busy trying to get an idea of how to better 
>optimize lisp code by using various 
>declarations. However I get the following warning when compiling this code.
>
>(declaim (ftype (function (single-float) single-float) foo)
>          (ftype (function (single-float) single-float) bar))
>
>(defun bar (float)
>   (declare (optimize speed (safety 0) (debug 0) (float 0)))
>   (1+ float))
>
>(defun foo (float)
>   (declare (optimize speed (safety 0) (debug 0) (float 0))
>            (inline bar))
>   (bar (1- float)))

On ACL (5 as far as I remember) I would end up with:

(declaim (inline bar))
(defun bar (float)
   ...)
(declaim (notinline bar))

....

defun foo (float)
   (declare (inline bar))
....)

Francis




>;;*** Warning in FOO: Inline expansion for BAR not found
>
>Does anyone know how to get BAR inlined?
>I've seen this in a couple of systems (eg. 
>ironclad) and am quite curious as to what causes it.
>
>Thanks,
>  Sean.
>



Re: Inline expansion not found

On 3 Jul 2006, at 14:14, Sean Ross wrote:

>
> I'm busy trying to get an idea of how to better optimize lisp code  
> by using various declarations. However I get the following warning  
> when compiling this code.
>
> (declaim (ftype (function (single-float) single-float) foo)
>          (ftype (function (single-float) single-float) bar))
>
> (defun bar (float)
>   (declare (optimize speed (safety 0) (debug 0) (float 0)))
>   (1+ float))

You must have an INLINE declaration in effect at the time the  
definition of BAR is processed.  So you need a declaration *before*  
BAR.  Say:

(declaim (inline bar))
....
(defun bar ...)
....

(defun function-calling-bar ... (bar ...))

--tim


Updated at: 2020-12-10 08:48 UTC