Subject: [clisp-list] on FFI:mark-invalid-foreign, malloc() and finali zat i on

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Fri Mar 14 08:58:14 2003

Sam wrote:
>> O(fp_zero) is not to be modified by set-foreign-base.
>why?  I thought you wanted that!
>Isn't it possible that you would want to invalidate all current foreign
>entities referring to O(fp_zero) and to start anew with a 
>fresh O(fp_zero)?

Not any I can think of right now. O(fp_Zero) is a global. It denotes the current session. If it dies, CLISP's FFI is dead. It doesn't make sense to recreate O(fp_zero) except at session start because the programmer has little means to control when and where it's used by the system.

So my clean model is:
o There's O(fp_zero), somewhat the default.
o There's maybe some ancestor of it, found in the image file.
o There's new ones from known places, which are: DEEP-MALLOC, SIMPLE-CALLOC, FOREIGN-LIBRARY and SET-FOREIGN-BASE.
o and possibly other invalidated foreign-pointers.

>keeping the address fixed would require using a negative offset.
That's no problem at all. the Amiga's shared library functions are all at negative offsets w.r.t. the library base. That has been used since 1995. I believe C++ vtables share this property. I believe it could apply to COM methods as well.
That' despite the fact that for whatever reason I cannot remember, IIRC, a uint is the offset in the C struct definition, not an sint.

>I see.  so (setf (foreign-pointer f-ent) :new) just means 
>"uncouple this
>foreign entity from its foreign-pointer group".
"by creating a new one with its own VALIDP bit, and which can then be coupled with FINALIZE."

Regards,
	Jorg Hohle.

---

From: Sam Steingold <[email-masked]>
Date: Fri Mar 14 09:30:11 2003

> * In message <[email-masked]>
> * On the subject of "[clisp-list] on FFI:mark-invalid-foreign, malloc() and finali zat i on"
> * Sent on Fri, 14 Mar 2003 17:57:27 +0100
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>
> Sam wrote:
> That's no problem at all. the Amiga's shared library functions are all
> at negative offsets w.r.t. the library base. That has been used since
> 1995. I believe C++ vtables share this property. I believe it could
> apply to COM methods as well.

OK, I will make the offset signed.

> That' despite the fact that for whatever reason I cannot remember,
> IIRC, a uint is the offset in the C struct definition, not an sint. 

this would have to be changed.

> >foreign entity from its foreign-pointer group".

if f-ent is a FOREIGN-POINTER, tis would have to signal an error.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
UNIX is as friendly to you as you are to it. Windows is hostile no matter what.