From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: A Working (but Minimal) JIT Date: Mon, 06 Dec 2010 23:06:51 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1291673261 28852 80.91.229.12 (6 Dec 2010 22:07:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 6 Dec 2010 22:07:41 +0000 (UTC) Cc: guile-devel@gnu.org To: Noah Lavine Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Mon Dec 06 23:07:34 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PPjDW-0003Ii-Qf for guile-devel@m.gmane.org; Mon, 06 Dec 2010 23:07:31 +0100 Original-Received: from localhost ([127.0.0.1]:33389 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPjDW-0007K9-5O for guile-devel@m.gmane.org; Mon, 06 Dec 2010 17:07:30 -0500 Original-Received: from [140.186.70.92] (port=47438 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPj8p-0004yV-SE for guile-devel@gnu.org; Mon, 06 Dec 2010 17:02:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPj8o-000426-EP for guile-devel@gnu.org; Mon, 06 Dec 2010 17:02:39 -0500 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:64889 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPj8o-00041x-BS for guile-devel@gnu.org; Mon, 06 Dec 2010 17:02:38 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 04B692F08; Mon, 6 Dec 2010 17:03:00 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=bR3BUPLbDAgoko/W/GRgovOW40c=; b=sqoRwS jAcUAu3whmo1501vEnyTEMUEw4JjW+UWME6rHOajBOrTvrh+bPsDFPfrvj2HOK+6 lEtOdwVE14kPeWNllrI6FiKG9BjwRsr1I4FJVDsblWPkn+T61CH+vocTWlWTBfZc ClvO5ZlkMIgXrRL5bepgxjI8MhIxhrswjO6jc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=BzPhfRhfbTQew1kmLVq53ywRMqIKoySx OQetZ/yzfy+lHfDn4sFJNLdCadEDLp14uzm8XW6X41iCJJ0cYRX3SpCTRf+PyAgK kwxtnz2zkYqg3YqWiZdLtL7v22IuaKR5Lyn+GxF/FiyzgC7a1PP8jYScG6WBB57r Jr7DB2BphzM= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id CB97F2F06; Mon, 6 Dec 2010 17:02:58 -0500 (EST) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id E68082F04; Mon, 6 Dec 2010 17:02:56 -0500 (EST) In-Reply-To: (Noah Lavine's message of "Wed, 1 Dec 2010 22:58:47 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 962C7FF6-0184-11E0-91A4-C4BE9B774584-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:11234 Archived-At: Hi Noah, Apologies for the stochastic response times here... On Thu 02 Dec 2010 04:58, Noah Lavine writes: > have the JITed code be a C function that returns an enum to indicate > what the VM should do next. This is widely known as the "trampoline" approach -- you fall down to some known dispatcher, then bounce back up. It would be nice to avoid it though. And actually, terminology-wise, I should have been more precise when I said: >> I prefer the trampoline approach used by primitives, continuations, >> foreign functions, etc -- they are normal procedures, whose code is a >> stub that does the type-specific dispatch. Let's call this sort of thing the "stub" pattern. > 1. Make the regular 'call' instruction be the one that implements > JITing. But this would introduce a branch to procedure calls. Regarding whether or not to jit, I'm OK with doing that in the `call' instruction. > 2. Add an instruction, to be put in the normal function preamble, that > decides whether or not to JIT the function that is currently > executing I think this would be too much overhead. > It sounds like 2 is what you want. Is that right? (Currently I'm doing > option 1.) No, I think what you're doing is right in this regard. But regarding how to call a natively-compiled function -- I think this is really, really critical. It's an important decision that will have some far-reaching effects. I would like for natively-compiled functions to get their objcode replaced with a short stub that tail-calls the native code -- maybe the stub would consist of just one instruction, `native-call' or something. (Obviously this instruction doesn't exist yet). That instruction would do a tail call in such a way that the vm engine is no longer on the stack. I am concerned about JIT libraries precisely because they tend to impose a C calling convention on native code, without allowing for more appropriate conventions that allow for tail calls and multiple values on the stack. Anyway, these are my concerns. Obviously you're the one hacking the code, so do what you like :) Happy hacking, Andy -- http://wingolog.org/