2009/9/26 Tamas K Papp <tkpapp@...>:
> Could someone please help me on what this means (ie what is
> closure-init, and how can I make it happy), and whether this is a
> one-time cost (at the time of setting up the closure) or paid every
> time it is called.
>
> src/univariate.lisp:283:10:
> note:
> doing float to pointer coercion (cost 13), for:
> the second argument of CLOSURE-INIT
> --> FUNCTION SB-C::%%ALLOCATE-CLOSURES
> ==>
> (SB-C::%ALLOCATE-CLOSURES
> '(#<SB-C::CLAMBDA
> :%SOURCE-NAME SB-C::.ANONYMOUS.
> :%DEBUG-NAME (LAMBDA #)
> :KIND NIL
> :TYPE #<SB-KERNEL:FUN-TYPE #>
> :WHERE-FROM :DEFINED
> :VARS NIL {B640CA1}>))
Ouch, that's a horrible compiler note in terms of understandability.
The note is emitted because closed-over variables that are both read
and written are boxed -- which is what the float-to-pointer note is
complaining about.
Not much to be done about it as such (though unboxed value cells could
probably be implemented), but you can do something like
(let ((data (make-array 2 :element-type 'single-float
:initial-contents (list (compute-left)
(compute-alpha)))))
(symbol-macrolet ((left (aref data 0))
(alpha (aref data 1)))
...))
instead to ensure unboxed allocation. Since DATA variable will the
presumably the read-only, it doesn't need a cell, which means that you
don't get an additional memory indirect.
Cheers,
-- Nikodemus
|