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 AAA11351; Thu, 18 Dec 2003 00:17:03 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 AAA11304 for ; Thu, 18 Dec 2003 00:17:02 +0100 (MET) Received: from smtp2.pp.htv.fi (smtp2.pp.htv.fi [213.243.153.14]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id hBHNH1X14967 for ; Thu, 18 Dec 2003 00:17:01 +0100 (MET) Received: from posti.pp.htv.fi (posti.pp.htv.fi [212.90.64.50]) by smtp2.pp.htv.fi (Postfix) with ESMTP id 66B64297055; Thu, 18 Dec 2003 01:17:01 +0200 (EET) Received: from oro (aka.pp.htv.fi [213.243.183.115]) by posti.pp.htv.fi (8.11.1 (Revision 1.5+JAGae91741+JAGae92668) /8.11.1) with ESMTP id hBHNH0T16678; Thu, 18 Dec 2003 01:17:01 +0200 (EET) Received: from naked by oro with local (Exim 3.36 #1 (Debian)) id 1AWkuZ-0002NX-00; Thu, 18 Dec 2003 01:17:00 +0200 To: Alain.Frisch@ens.fr Cc: Caml list Subject: Re: [Caml-list] Freeing dynamically loaded code References: <87oeuayduv.fsf@naked.iki.fi> From: Nuutti Kotivuori Date: Thu, 18 Dec 2003 01:16:59 +0200 In-Reply-To: <87oeuayduv.fsf@naked.iki.fi> (Nuutti Kotivuori's message of "Mon, 15 Dec 2003 05:11:20 +0200") Message-ID: <87llpbrq50.fsf@naked.iki.fi> User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 dynamically:01 doable:01 pointers:01 pointers:01 offsets:01 eww:99 doable:01 offsets:01 closures:01 caml:01 closure:01 closure:01 objects:02 address:96 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Nuutti Kotivuori wrote: [...] > Now I have no idea what GRAB and RESTART do, and what would be need > to fix them. They look scary. On CLOSUREREC I have an idea what it's > supposed to do, but I have no idea how the Infix headers really work > there - and what we'd need to do to fix that. Okay, I think I now know how GRAB and RESTART work, and they should be doable. And I have a better idea how CLOSUREREC works as well - but that seems to be nasty. Considering that it has several code pointers, and none of those have a local environment but the whole closure only has one - every one of those code pointers would have to point to something like CALLRECDYN or something, and the environment of the CLOSUREREC should have offsets for every subfunction and then the code block address. CALLRECDYN would then have to find the correct offset for the correct closure in the CLOSUREREC block, and call that. Eww. But possibly doable. Another thing which struck me. What about objects? All they have is a virtual table as the first pointer, which carries loads of code pointers that aren't embedded in a closure. And if we can't touch the callers, calling any of those would have to still be compatible, so where on earth could the actual offsets be stored then? Mucho problems. [...] > How do we pass the knowledge where the start of the block is where > this code resides, so it can place that pointer in the env and > calculate the offset there as well? One very hackish way to implement this would be to add a semi-global variable to the interpreter, that has this pointer - then the calldyn instruction could update it for the current block always, so any closures created inside a calldyn'd instruction would have the right pointer. Or something. [...] This is starting to get muddier and muddier - and not looking too good. But I will continue thinking about the problems for now - if something comes up that is really impossible to do, then we can just drop this approach since it isn't going to work and move on to something else. -- Naked ------------------- 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