From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Rob Browning Newsgroups: gmane.lisp.guile.devel Subject: Re: expansion, memoization, and evaluation... Date: Wed, 04 Dec 2002 15:11:02 -0600 Sender: guile-devel-admin@gnu.org Message-ID: <878yz5fq1l.fsf@raven.i.defaultvalue.org> References: <87r8cyh5ec.fsf@raven.i.defaultvalue.org> <87heduh43b.fsf@raven.i.defaultvalue.org> <8765uah1fe.fsf@raven.i.defaultvalue.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1039036332 5426 80.91.224.249 (4 Dec 2002 21:12:12 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 4 Dec 2002 21:12:12 +0000 (UTC) Cc: Dirk Herrmann , guile-devel@gnu.org Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18JgoF-0001Nx-00 for ; Wed, 04 Dec 2002 22:11:55 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18JgoS-0003AL-00; Wed, 04 Dec 2002 16:12:08 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18Jgnk-0001S1-00 for guile-devel@gnu.org; Wed, 04 Dec 2002 16:11:24 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18Jgng-0001H8-00 for guile-devel@gnu.org; Wed, 04 Dec 2002 16:11:23 -0500 Original-Received: from n66644228.ipcdsl.net ([66.64.4.228] helo=defaultvalue.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18Jgnf-0001Aa-00 for guile-devel@gnu.org; Wed, 04 Dec 2002 16:11:19 -0500 Original-Received: from raven.i.defaultvalue.org (raven.i.defaultvalue.org [192.168.1.7]) by defaultvalue.org (Postfix) with ESMTP id 679FFAE16; Wed, 4 Dec 2002 15:11:15 -0600 (CST) Original-Received: by raven.i.defaultvalue.org (Postfix, from userid 1000) id 8DCFD8DEB5; Wed, 4 Dec 2002 15:11:02 -0600 (CST) Original-To: djurfeldt@nada.kth.se In-Reply-To: (Mikael Djurfeldt's message of "Wed, 04 Dec 2002 08:07:00 +0100") User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:1802 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1802 Mikael Djurfeldt writes: >> You may have already said this, but if the method is called later with >> "different types", then does it have to notice that and recompute? > > No, that copy of the compiled code will never be called with anything > but the types it's compiled for. OK, so does that mean that at each invocation, you need to look at the incoming types and check to see if you already have a cached method that matches the incoming signature? i.e. if you have (blah) (foo bar baz) (blarg) and foo is a generic function, and last time through, bar and baz were integers, but this time bar and baz are strings. Would the current behavior be for goops to check, notice this, and build a new "precompiled" invocation for two strings? (Just trying to check to see that I understand...) > Hmm... What do you mean by "control the object code"? Surely, there > is nothing about what I've said about goops which prevents the > optimizations in the "alternate approach" from being done? Well as yet I don't have a clear idea in mind, and in fact a number of the optimizations I've thought of would require flow and scope analysis. To some extent I'm just speculating about possibilities, inspired by clever (non-goops-specific) hacks that can be possible when you know enough about a closed region of source. For example, if you know that within a given function (or closed set of functions) you use some set of symbols, and within the set you have big (case foo ...) statements using those symbols, you may be able to compile the object code to use plain integers to represent these symbols and then issue c-style switches to handle the case statements. Alternately you might be able to use a "small consecutive integers" numbering scheme to represent the integers and then per-case vector jump tables with those integers as indices for the case statements. Either way should beat the much more naive O(N) approach: if (SCM_EQ_P (foo, x_sym)) { ... } else if (SCM_EQ_P (foo, y_sym)) { ... } ... > Maybe there's a misunderstanding here: Goops gives source back to > the compiler. The compiler then can continue to do whatever > optimizations it chooses to, and also has full control over the > object code it's emitting. That makes sense. The reason I was confused was because it sounded like goops was making decisions based on the runtime types of arguments, and if so, and if you were doing compilation offline, then you wouldn't have access to that information. Your comment about possibly having to use type flow analysis for offline compilation cleared that up for me. (Of course if the guile compiler were implemented targeting C, and if guile were to "Depends: gcc", we might be able to use dlopen/dlsym to support heavyweight online compilation. Though first-time execution would be awfully painful unless your machine was really fast ;>) -- Rob Browning rlb @defaultvalue.org, @linuxdevel.com, and @debian.org Previously @cs.utexas.edu GPG starting 2002-11-03 = 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel