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: [PATCH] Add `fixnum?' VM primitive Date: Tue, 29 Mar 2011 13:03:32 +0200 Message-ID: References: <1300846773-19003-1-git-send-email-a.rottmann@gmx.at> <1300846773-19003-2-git-send-email-a.rottmann@gmx.at> <87sjuc2n66.fsf@gnu.org> <87vcz8rsap.fsf@vir.lan> <878vw3xz39.fsf@gnu.org> <877hbn1krs.fsf@gmx.at> <87zkojuyil.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1301398402 6497 80.91.229.12 (29 Mar 2011 11:33:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 29 Mar 2011 11:33:22 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Mar 29 13:33:18 2011 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 1Q4XAj-0008Kr-Qp for guile-devel@m.gmane.org; Tue, 29 Mar 2011 13:33:18 +0200 Original-Received: from localhost ([127.0.0.1]:51278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4XAj-0003r1-9P for guile-devel@m.gmane.org; Tue, 29 Mar 2011 07:33:17 -0400 Original-Received: from [140.186.70.92] (port=41029 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4XAd-0003pT-Go for guile-devel@gnu.org; Tue, 29 Mar 2011 07:33:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4XAb-0002Bl-8c for guile-devel@gnu.org; Tue, 29 Mar 2011 07:33:10 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:59031 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4XAb-0002Bh-6m; Tue, 29 Mar 2011 07:33:09 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id B64D53A1F; Tue, 29 Mar 2011 07:34:55 -0400 (EDT) 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:content-transfer-encoding; s=sasl; bh=Hpu/WITn4NDZ 02P4Rjq8cBLKz4k=; b=waST0FzS0H+Q+KY0EgzzS7QoaEv+4wpBXrt4xp8f78Xi /S02JmLtsCMEkvUwmbvOjTXV6GCpvr/3DNr8xX5U2O29QGwJuX7FC+ctlMFzxPRX WCbrMNHUXI9lp2GicKcYKDzL0/i192jEKLGy2aXSLlq7lDIBrBVwz7G0HXZSyDg= 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:content-transfer-encoding; q=dns; s=sasl; b=pruTPS lgFOIcEPIePH4gFTytbcG5Dvt6OIlsoy5EqcM3BysvSwTwPO9H0yJbxVS2lEfQKe gr+ixleXZgb27svd8ML9C17CQNpN0wxrqim3Sh9X2TGvy3BgZyGSawfzhl3PQ7Pa 4JuB93Wzoa3UBgJBR+T60mYFjR+5k+ySxWzZs= 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 87B5B3A1C; Tue, 29 Mar 2011 07:34:52 -0400 (EDT) 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 928E33A17; Tue, 29 Mar 2011 07:34:49 -0400 (EDT) In-Reply-To: <87zkojuyil.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Fri, 25 Mar 2011 14:21:06 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 900D4020-59F8-11E0-856D-E8AB60295C12-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 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:12039 Archived-At: On Fri 25 Mar 2011 14:21, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > I think that a fixnum API sucks. In an ideal world, the implementation > would be optimized such that you can be switch from fixnum to bignum > with very little overhead: > > 1. The run-time support should be optimized to make arithmetic > operations fast in the fixnum case. > > 2. When the compiler can statically determine that code is dealing > with fixnums, it can generate code that uses untagged machine > integers (that=E2=80=99s what Bigloo does, for instance). > > I=E2=80=99ve always thought that R5RS implicitly acknowledges the fact th= at > implementations can provide almost costless fixnum/bignum transition. I rolled this one around for a while in my mind too, and came to the conclusion that the R6RS fxops can be helpful -- but only to a system that does native compilation. Such a system, for +, for example, would do: output =3D input-a + input-b if overflow-bit-set? promote to bignums; try again R6RS explicitly redefines this: output =3D input-a + input-b if overflow-bit-set? error So there's no more overhead than for normal +. However the fact that the result will always be a fixnum allows you to do more flow analysis. So even without unsafe compilation options, you can omit more fixnum? checks when you use fxops, and the amount of code emitted is smaller. But for Guile, right now, R6RS fxops have no advantage over the normal numeric operations. Andy --=20 http://wingolog.org/