[cffi-devel] [PATCH] 64-bit support for Allegro, and allocate stack objects in the static area

John Fremlin jf at msi.co.jp
Fri Jan 9 00:51:03 UTC 2009


"Luís Oliveira" <luismbo at gmail.com> writes:

> On Mon, Jan 5, 2009 at 3:48 AM, John Fremlin <jf at msi.co.jp> wrote:
>> On Mon, 5 Jan 2009 03:14:13 +0000, "Luís Oliveira" <luismbo at gmail.com> wrote:
>>> I'm asking these questions because I suspect both changes break with
>>> older versions of Allegro but I can't test it since the express
>>> edition 7.0 is no longer available. It's probably not a big deal but
>>> I'd like to at least try to maintain compatibility.
>>
>> There is no :foreign-address type in Allegro 8.1?
>
> The page <http://www.franz.com/support/documentation/8.1/doc/foreign-functions.htm>
> documents the :FOREIGN-ADDRESS type.

I kept trying to point out that this was being used by cffi as a *Lisp*
type not a *foreign-type*. It is not a Lisp type.

> Can you confirm that the patch I've attached works? Thanks.

Thanks, it looks like a great cleanup and a better way of integrating
:unsigned-nat.

The other change from my patch was about allocating the stack objects in
a space that will not be moved by the GC.

Is it a necessary according to the CFFI semantics of with-foreign-object?

+++ cffi_0.10.3/src/cffi-allegro.lisp
@@ -135,7 +135,7 @@ SIZE-VAR is supplied, it will be bound to SIZE during BODY."
           ;; stack allocation pattern
           `(let ((,size-var ,size))
              (declare (ignorable ,size-var))
-             (ff:with-stack-fobject (,var '(:array :char ,size))
+             (ff:with-stack-fobject (,var '(:array :char ,size) :allocation :foreign-static-gc)
                (let ((,var (ff:fslot-address ,var)))
                  ;; (excl::stack-allocated-p var) => T
                  , at body))))




More information about the cffi-devel mailing list