From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21959 invoked by alias); 10 May 2004 21:56:25 -0000 Mailing-List: contact sid-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: sid-owner@sources.redhat.com Received: (qmail 21908 invoked from network); 10 May 2004 21:56:25 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 10 May 2004 21:56:25 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.10/8.12.10) with ESMTP id i4ALuP0m008265 for ; Mon, 10 May 2004 17:56:25 -0400 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i4ALuOv15479 for ; Mon, 10 May 2004 17:56:24 -0400 Received: from MDG2004 (vpn50-13.rdu.redhat.com [172.16.50.13]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id i4ALuNcU015081 for ; Mon, 10 May 2004 17:56:23 -0400 Message-Id: <200405102156.i4ALuNcU015081@pobox.toronto.redhat.com> From: "Dave Brolley" To: Subject: [patch] Better checking for cache line state Date: Mon, 10 May 2004 21:56:00 -0000 Organization: Red Hat Canada MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0003_01C436B8.1D9C2030" X-SW-Source: 2004-q2/txt/msg00028.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0003_01C436B8.1D9C2030 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 277 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 ------=_NextPart_000_0003_01C436B8.1D9C2030 Content-Type: text/plain; name="sid-cache.patch.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="sid-cache.patch.txt" Content-length: 1422 Index: sid/component/cache/cacheutil.cxx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D lines.begin (); it !=3D lines.end (); it++) { cache_line* i =3D * it; ! if (i->dirty_p ()) return i; } =20=20 return 0; --- 189,195 ---- for (iterator_t it =3D lines.begin (); it !=3D lines.end (); it++) { cache_line* i =3D * it; ! if (i->valid_p () && i->dirty_p ()) return i; } =20=20 return 0; *************** bool *** 206,212 **** cache_set::vacancy_p () const { for (const_iterator_t it =3D lines.begin (); it !=3D lines.end (); it++) ! if (!(*it)->locked_p ()) return true; =20=20 return false; --- 206,212 ---- cache_set::vacancy_p () const { for (const_iterator_t it =3D lines.begin (); it !=3D lines.end (); it++) ! if (!(*it)->valid_p () || !(*it)->locked_p ()) return true; =20=20 return false; ------=_NextPart_000_0003_01C436B8.1D9C2030--