unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Han-Wen Nienhuys <hanwen@xs4all.nl>
Subject: Re: Serious bug inn GUILE rational handling
Date: Sun, 24 Dec 2006 12:45:45 +0100	[thread overview]
Message-ID: <458E6869.1060402@xs4all.nl> (raw)
In-Reply-To: <20061224112539.M19482@ccrma.Stanford.EDU>

Bill Schottstaedt escreveu:
>> I have removed support for the reduced bit, and put the reduction in
>> make_fraction.
> 
> I think it was intended that equal? would use scm_i_fraction_equalp
> which reduces both arguments before checking equality.  So the
> simplest fix would be to mask off the reduced bit in the cell type
> in the check for cell type equality in scm_equalp.  I would hesitate
> to remove support for this bit because it will mean you get gcd
> on every integer divide!  The current system already slows Guile

I think thes best quick fix would be to put the bit into the 4th 
double cell word. 

> down by about 10%.   On the race condition, my vage recollection
> is that the "is this safe?" question was mine, and I hoped at that
> time that someone who knew about such things would check it
> out -- I believe (it's been a long time since I looked at this stuff)
> that if that line is not safe, there are a lot more like it scattered
> around Guile, so it's scarcely reason to jettison the entire thing.

In that case, we need to fix the more-like-it stuff.  Can you point out 
some of those cases? 

I'm hesitant to put stuff like this in because 

1. it _is_ a race condition

2. if it is triggered, it will be next to impossible to reproduce. In
effect this would lead to a once in a million inexplicable corruption.
And that's really bad.

The correct solution would be a to use a lock-free instruction to 
swap the old and reduced forms, but I'm not sure if we have those in 
GUILE.

As I explained earlier, the logic for doing reduces or not needs to be
more refined. Any program that does serious arithmetic in fractions 
will likely have exploding memory requirements.

-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2006-12-24 11:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-24 11:32 Serious bug inn GUILE rational handling Bill Schottstaedt
2006-12-24 11:45 ` Han-Wen Nienhuys [this message]
2006-12-24 12:32   ` Han-Wen Nienhuys
2006-12-24 21:27     ` Rob Browning
2006-12-25 21:21 ` Kevin Ryde
2006-12-29  2:52 ` Neil Jerram
2006-12-29 12:39   ` Serious bug in " Bill Schottstaedt
2006-12-30 20:42     ` Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=458E6869.1060402@xs4all.nl \
    --to=hanwen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).