From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Lynn Winebarger Newsgroups: gmane.lisp.guile.user Subject: Re: to serialize/deserialize closures; and multithreading Date: Thu, 25 Mar 2004 12:18:03 -0500 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: <4063144B.8050705@indiana.edu> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1080236241 24942 80.91.224.253 (25 Mar 2004 17:37:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 25 Mar 2004 17:37:21 +0000 (UTC) Cc: Nicholas Paul Johnson , guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Mar 25 18:37:08 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B6Ymy-0005SF-00 for ; Thu, 25 Mar 2004 18:37:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6Yc2-0004dl-1t for guile-user@m.gmane.org; Thu, 25 Mar 2004 12:25:50 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B6YZ1-0003tS-TF for guile-user@gnu.org; Thu, 25 Mar 2004 12:22:43 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B6YYU-0003ku-94 for guile-user@gnu.org; Thu, 25 Mar 2004 12:22:42 -0500 Original-Received: from [129.79.1.74] (helo=rockridge.uits.indiana.edu) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B6YMA-0000xh-4A for guile-user@gnu.org; Thu, 25 Mar 2004 12:09:26 -0500 Original-Received: from logchain.uits.indiana.edu (logchain.uits.indiana.edu [129.79.1.77]) by rockridge.uits.indiana.edu (8.12.10/8.12.10/IUPO) with ESMTP id i2PH9BbV006631; Thu, 25 Mar 2004 12:09:11 -0500 (EST) Original-Received: from indiana.edu (dial-122-95.dial.indiana.edu [156.56.122.95]) (authenticated bits=0) by logchain.uits.indiana.edu (8.12.10/8.12.10/IUPO) with ESMTP id i2PH987c010436 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Thu, 25 Mar 2004 12:09:10 -0500 (EST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830 X-Accept-Language: en-us, en Original-To: Greg Troxel X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:2995 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:2995 It's an interesting question all right. What's the purpose of the "migration"? Technically speaking, a closure is just a pair of pointers to its code and its environment. You could create a new "foreign reference" type (tag) that would cause these to be looked up on the original computer whenever you needed them. That would handle synchronization. Of course, you could also make copies of everything. I think tags are constant over all architechtures (last I looked) but there are run-time allocated types that you'd have to do some work for (I think - I don't remember what they're called). Anyway, besides taking care of the tags/synchronizing run-time allocated types/ handling endianness issues, you'd need to munge pointers according to whereever they would be newly allocated on the new machine. It would probably be easiest to just number copies of the cells from 0 to whatever for the transport over and the allocator on the other end could relabel them to the actual values. Also, you'd need to check that any symbols referenced by the code or variables were actually in existence in the new guile instance's symbol table. And that global variables referenced by the code got copied (as well as the lexical variables). So will be recursively nasty. Good Luck. Lynn Greg Troxel wrote: > 1. If I have a scheme value that is a closure, is there any way that I can > serialize this closure (from C code) into a form that it can be > deserialized back into a SCM closure variable (again, by C code)? I can > assume for this question that both ends of the serial line are running the > same version of gnu guile and my software, but cannot assume that both > ends are running on the same computer architecture. Would it instead > only be possible for me to transfer closures as their scheme source. > > I'm not even sure it is well-defined what it means to migrate a > closure. Should a mutation on the new computer of a captured variable > affect the old computer? > _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user