GNU bug report logs - #14916
Fixnum procedures can be made to return non-fixnums

Previous Next

Package: guile;

Reported by: Göran Weinholt <goran <at> weinholt.se>

Date: Sat, 20 Jul 2013 06:00:03 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Göran Weinholt <goran <at> weinholt.se>
To: Mark H Weaver <mhw <at> netris.org>
Cc: 14916 <at> debbugs.gnu.org
Subject: bug#14916: Fixnum procedures can be made to return non-fixnums
Date: Sat, 17 Aug 2013 09:55:14 +0200
[Message part 1 (text/plain, inline)]
Mark H Weaver <mhw <at> netris.org> writes:

> Göran Weinholt <goran <at> weinholt.se> writes:
>
>> the fxdiv procedure from (rnrs) fails to check that its result is
>> representable as a fixnum:

> Hmm.  Currently, our fixnum and flonum operations are implemented in
> terms of the generic operations, with added checks.  Whereas the most
> important generic arithmetic operations compile to VM instructions, the
> fixnum and flonum operations compile into procedure calls to scheme code
> that performs the checks and then uses the generic ops.
>
> Needless to say, this is terribly slow.  I'm reluctant to make that code
> any slower by adding more checks.

I agree with this sentiment. The fixnum operations are supposed to be
fast, so making them slower doesn't make sense. There is a delicious
irony in the fact that the generic operations have all these extra
checks that would have to be undone by adding more checks afterwards.

> However, in the coming months I intend to reimplement the fixnum and
> flonum operations, using dedicated instructions in the new RTL VM which
> will be the basis of Guile 2.2.
>
> It would be possible to backport some of this to Guile 2.0 as well, but
> I'm not sure it's worth the effort.
>
> What do you think?

It's better to look toward the future. If Guile 2.2 will be much faster
then you get more leverage when optimizing the fixnum/flonum operations
than compared with Guile 2.0.

Regards,

-- 
Göran Weinholt <goran <at> weinholt.se>
"I knew it! He's stepping up his game! We must match
his game with... MUCH MORE GAME!" -- The Monarch
[Message part 2 (application/pgp-signature, inline)]

This bug report was last modified 8 years and 359 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.