[cffi-devel] Crashes on X86-64 CLISP

Hoehle, Joerg-Cyril Joerg-Cyril.Hoehle at t-systems.com
Fri Feb 3 17:05:47 UTC 2006


James Bielman wrote:
>Could we be using EQUALP instead for comparing pointers
>(or is the fact that seems to work just a coincidence?)
I realized I didn't specifically answer the question.

No you cannot (or I'd have submitted a patch already :)
You can even write a testcase to prove you cannot.  Try EQUALP on
(setq foo (foreign-alloc ...)) and
(unsigned-foreign-address (foreign-address-unsigned foo))

ffi:set-foreign-pointer is the reason.
Try (ffi:foreign-pointer foo) and on others.

That's how in CLISP, you can link all sorts of foreign pointers together, and invalidate them all in one go.  E.g. when calling foreign-free.
See (SETF VALIDP) in the CLISP impnotes.


And yes, INC-POINTER via addition is costly, compared to what could be otherwise thought of (e.g. Lispworks has an in-place incf-pointer).  But that's not used in CFFI, maybe for fear of destructively modifying the argument? (the comment in cffi-lispworks invokes another reason).
I could add a similar thing to CLISP, but would it help CFFI?

Regards,
	Jorg Hohle.



More information about the cffi-devel mailing list