public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
* [patch] Better checking for cache line state
@ 2004-05-10 21:56 Dave Brolley
  2004-05-10 23:15 ` Ben Elliston
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Brolley @ 2004-05-10 21:56 UTC (permalink / raw)
  To: sid

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

Hi,

On the target I'm working on, the programmer can directly write into the
cache tags. This requires more vigilance regarding the state of the cache
tags. Specifically, we should check the result of valid_p () before using
the tag.

I've committed the attached patch.

Dave

[-- Attachment #2: sid-cache.patch.txt --]
[-- Type: text/plain, Size: 1290 bytes --]

Index: sid/component/cache/cacheutil.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/cache/cacheutil.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -p -r1.8 -r1.9
*** sid/component/cache/cacheutil.cxx	29 Apr 2004 20:26:08 -0000	1.8
--- sid/component/cache/cacheutil.cxx	10 May 2004 21:51:10 -0000	1.9
*************** cache_set::find_any_dirty ()
*** 189,195 ****
    for (iterator_t it = lines.begin (); it != lines.end (); it++)
      {
        cache_line* i = * it;
!       if (i->dirty_p ()) return i;
      }
  
    return 0;
--- 189,195 ----
    for (iterator_t it = lines.begin (); it != lines.end (); it++)
      {
        cache_line* i = * it;
!       if (i->valid_p () && i->dirty_p ()) return i;
      }
  
    return 0;
*************** bool
*** 206,212 ****
  cache_set::vacancy_p () const
  {
    for (const_iterator_t it = lines.begin (); it != lines.end (); it++)
!     if (!(*it)->locked_p ())
        return true;
  
    return false;
--- 206,212 ----
  cache_set::vacancy_p () const
  {
    for (const_iterator_t it = lines.begin (); it != lines.end (); it++)
!     if (!(*it)->valid_p () || !(*it)->locked_p ())
        return true;
  
    return false;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch] Better checking for cache line state
  2004-05-10 21:56 [patch] Better checking for cache line state Dave Brolley
@ 2004-05-10 23:15 ` Ben Elliston
  0 siblings, 0 replies; 2+ messages in thread
From: Ben Elliston @ 2004-05-10 23:15 UTC (permalink / raw)
  To: sid

"Dave Brolley" <brolley@redhat.com> writes:

> On the target I'm working on, the programmer can directly write into
> the cache tags. This requires more vigilance regarding the state of
> the cache tags. Specifically, we should check the result of valid_p
> () before using the tag.

Looks good, Dave.  Thanks,

Ben

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-10 23:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-10 21:56 [patch] Better checking for cache line state Dave Brolley
2004-05-10 23:15 ` Ben Elliston

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).