[cffi-devel] Static vectors suitable for FFI

Stelian Ionescu stelian.ionescu-zeus at poste.it
Thu May 7 07:48:08 UTC 2009


On Thu, 2009-05-07 at 11:00 +0900, John Fremlin wrote:
> Stelian Ionescu <stelian.ionescu-zeus at poste.it> writes:
> 
> > Attached is an implementation for SBCL. make-static-vector only
> > allocates instances of (simple-array (unsigned-byte 8) (*)) but that can
> > be extended to other unboxed arrays.
> > The current sharable vector interface doesn't work very well because it
> > doesn't allow me for instance to pin a list of vectors, but only a
> > single vector at a time. Also, I'd prefer to avoid pinning at all given
> > how it interferes with the GC.
> 
> Thanks Stelian!
> 
> This would be really useful as the pinning business with
> shareable-byte-vectors is a real nuisance.
> 
> If the current shareable-byte-vector interface is going to be reworked
> can I suggest that we allow (at least) simple-array
> single-float/double-float as well? Why not just allow all unboxed array

That can be easily done.


> types the underlying Lisp supports? . . . Or a limited sensible subset?

I think that we should allow all types supported by the underlying
implementation but specify in the docs that very few are portable:
(probably, I haven't yet checked) only bit, [un]signed-byte-{8,16,32,64}
and single-float are portable


> Having portable unboxed C-sharable float arrays would be great for our
> numeric work.

Now we only need to see if the trick of "manually" creating unboxed
arrays works on other implementations: CMUCL, CCL, Clisp, ECL, ...
Allegro and Lispworks already support this with make-array's :ALLOCATION
key arg


> I should be very happy to make the Allegro CL interface.

Thanks. See if Allegro has native functions for bit-bashing, otherwise
implement {fill,copy}-foreign-memory in terms of memset/memcpy.

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20090507/d404ba57/attachment.sig>


More information about the cffi-devel mailing list