From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA00184; Sat, 13 Dec 2003 09:15:58 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA00168 for ; Sat, 13 Dec 2003 09:15:57 +0100 (MET) Received: from nef.ens.fr (nef.ens.fr [129.199.96.32]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hBD8Fu125662 for ; Sat, 13 Dec 2003 09:15:56 +0100 (MET) Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22]) by nef.ens.fr (8.12.10/1.01.28121999) with ESMTP id hBD8FuaW009302 ; Sat, 13 Dec 2003 09:15:56 +0100 (CET) Received: from localhost (frisch@localhost) by clipper.ens.fr (8.12.3/jb-1.1) id hBD8FtZM002456 ; Sat, 13 Dec 2003 09:15:55 +0100 (MET) X-Authentication-Warning: clipper.ens.fr: frisch owned process doing -bs Date: Sat, 13 Dec 2003 09:15:55 +0100 (MET) From: Alain.Frisch@ens.fr X-X-Sender: frisch@clipper.ens.fr Reply-To: Alain.Frisch@ens.fr To: Nuutti Kotivuori cc: Caml list Subject: Re: [Caml-list] Freeing dynamically loaded code In-Reply-To: <873cbp5gcu.fsf@naked.iki.fi> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; alain:01 frisch:01 caml-list:01 dynamically:01 dynamically:01 closures:01 patching:01 closures:01 alain:01 linked:01 garbage:01 closure:01 closure:01 modules:02 collector:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, 13 Dec 2003, Nuutti Kotivuori wrote: > There was a problem I was pondering out with that suggestion. And it > was basically that the functions from the dynamically linked module > must appear as normal closures taking the appropriate number of > arguments - and yet would have to be called throug CALL_DYN - which > would mean either patching the code of *all* modules, or having an > intermediate code block which does the call to CALL_DYN. And this > didn't sound nice. I was proposing to have an intermediate code block (made of CALL_DYN). > Let's make sure every closure generated from the library has an extra > local variable in it's environment, pointing to the head of the block > where that closure's code resides. This local variable need not even > be used, as long as it doesn't break the other locals in the function. > > So then every closure will carry an extra local variable, and those > are seen by the garbage collector, so the main codefile will exist as > long as any of those closures do. I have been considering this idea too, but I think it does'nt work: sure, the GC won't free the code block, but it can still move it without updating the code pointer in the closure. Maybe this can be addressed by using a different GC tag to denote "movable" closures, so that the GC knows that the code pointer has to be translated by the same amount as the last slot (which is the pointer to the code block). -- Alain ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners