[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14916: Fixnum procedures can be made to return non-fixnums

From: Mark H Weaver
Subject: bug#14916: Fixnum procedures can be made to return non-fixnums
Date: Fri, 16 Aug 2013 23:32:32 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Göran Weinholt <address@hidden> writes:

> the fxdiv procedure from (rnrs) fails to check that its result is
> representable as a fixnum:
> scheme@(guile-user)> (import (rnrs))
> scheme@(guile-user)> (fxdiv (least-fixnum) -1)
> $1 = 2305843009213693952
> It should raise an &implementation-restriction.

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.

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]