Re: [cffi-devel] Crashes on X86-64 CLISP
![](https://secure.gravatar.com/avatar/2f7ec3b37425cf4e077e7ef376e451be.jpg?s=120&d=mm&r=g)
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.
participants (1)
-
Hoehle, Joerg-Cyril