public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey A Law <law@redhat.com>
To: Kazu Hirata <kazu@cs.umass.edu>
Cc: rth@redhat.com, gcc-patches@gcc.gnu.org
Subject: Re: [patch] sbitmap.h: Speed up EXECUTE_IF_SET_IN_SBITMAP.
Date: Fri, 22 Oct 2004 19:51:00 -0000	[thread overview]
Message-ID: <1098473603.2915.224.camel@localhost.localdomain> (raw)
In-Reply-To: <20041019.221038.59463737.kazu@cs.umass.edu>

On Tue, 2004-10-19 at 20:10, Kazu Hirata wrote:
> Hi Richard,
> 
> > >     SBITMAP_ELT_TYPE *ptr_ = (SBITMAP)->elms;				\
> > >   									\
> > > !   for (word_num_ = (MIN) / (unsigned int) SBITMAP_ELT_BITS;		\
> > > !        word_num_ < size_; word_num_++, bit_num_ = 0)		\
> > >       {								\
> > > !       SBITMAP_ELT_TYPE word_ = ptr_[word_num_];			\
> > [...]
> > > +   SBITMAP_ELT_TYPE word_ = ptr_[word_num_] >> bit_num_;		\
> > 
> > Previously, setting MIN arbitrarily large would not read from PTR;
> > now it does.  I think this is a faulty translation of this function.
> 
> oops.  I found another problem of accessing PTR beyond its end.  Note
> that I check for the end condition *after* I increment word_num and
> get a new word_ like so.
> 
>   for (;								\
>        word_num_ < size_;						\
>        word_num_++, bit_num_ = 0, word_ = ptr_[word_num_])		\
> 
> I'll be testing the patch below shortly.  The end result is a bit
> ugly, but there shouldn't be any performance loss.  OK to apply if
> testing passes?
> 
> Kazu Hirata
> 
> 2004-10-19  Kazu Hirata  <kazu@cs.umass.edu>
> 
> 	* sbitmap.h (EXECUTE_IF_SET_IN_SBITMAP): Don't access PTR
> 	beyond its end.
This is OK assuming it passed regression testing.
jeff


      parent reply	other threads:[~2004-10-22 19:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-18 21:35 Kazu Hirata
2004-10-18 22:36 ` Jeffrey A Law
2004-10-18 22:45   ` Zdenek Dvorak
2004-10-19 23:21 ` Richard Henderson
2004-10-20  2:26   ` Kazu Hirata
2004-10-21  1:33     ` Kazu Hirata
2004-10-22 19:51     ` Jeffrey A Law [this message]

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

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

  git send-email \
    --in-reply-to=1098473603.2915.224.camel@localhost.localdomain \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kazu@cs.umass.edu \
    --cc=rth@redhat.com \
    /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).