From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12549 invoked by alias); 29 Apr 2004 21:28:39 -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 12499 invoked from network); 29 Apr 2004 21:28:35 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 29 Apr 2004 21:28:35 -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 i3TLSZKG006721 for ; Thu, 29 Apr 2004 17:28:35 -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 i3TLSYv17220; Thu, 29 Apr 2004 17:28:34 -0400 Received: from touchme.toronto.redhat.com (IDENT:postfix@touchme.toronto.redhat.com [172.16.14.9]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id i3TLSYcU030352; Thu, 29 Apr 2004 17:28:34 -0400 Received: from redhat.com (to-dhcp15.toronto.redhat.com [172.16.14.115]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 3BA698002BF; Thu, 29 Apr 2004 17:28:34 -0400 (EDT) Message-ID: <4091735C.6000203@redhat.com> Date: Thu, 29 Apr 2004 21:28:00 -0000 From: Dave Brolley User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) MIME-Version: 1.0 To: Dave Brolley Cc: sid@sources.redhat.com Subject: Re: [patch][rfa] Inheriting from cache_component and friends References: <408EDD4A.80706@redhat.com> In-Reply-To: <408EDD4A.80706@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-q2/txt/msg00009.txt.bz2 Received some feedback offline. I've now committed this. Dave Dave Brolley wrote: > Following up on my recent posting regarding specializing on the > existing cache_component. Here is the patch which allows use of > cache_component and cache_line as base classes. The purpose of this is > to allow me to implement a target-specific cache with a unique cache > line implementation. The main changes are: > > 1) Make cache_line into a virtual base class. The original cache_line > class is now called internal_cache_line (it keeps its data internally) > and its functionality is unchanged. > > 2) Introduce a new cache_line_factory class which is used to allocate > cache lines. Each cache_component is now passed a reference to a > cache_line_factory which it uses to allocate its cache lines. An > instance called internal_line_factory is used to create lines of type > internal_cache_line. > > 3) The find mechanism of cache and cache_set previously passed cache > lines by assignment via reference arguments. This is no longer > possible with a virtual class implementation. The mechanism now > returns a pointer to the found line (if found) and NULL otherwise. > > 4) Similarly, the 'replace' method of cache_replacement_algorithm > previously passed in a new line and returned the old one by assignment > using reference arguments. Now, a pointer to the expelled line is > returned (if any --- all lines might be locked) and NULL otherwise. > The expelled line is updated using access methods. The 'replace' > method has been renamed to 'expell' since the line is no longer > replaced. This also eliminates construction and destruction overhead > for each cache miss. Also, the copy constructor and assignment > operator for cache_line are no longer necessary. > > 5) The 'insert' and 'extract' methods of cache_line are now declared > using a macro for the cartesian product of possible datatypes as is > common elsewhere. It was not possible to instantiate the necessary > termplate methods automatically in the virtual base class. > > 6) The changes the sid/component/cfgroot were found necessary while > debugging problems in my implementation. > > 7) The changes to main/dynamic/commonCfg.h were necessary in order to > allow me to inherit from CacheCfg for my specialized cache > configurator and to get a handle to the loader configuration from the > SessionCfg so that I could connect the loader's "set-endian" pin to my > cache line implementation. > > I have tested this against my own port (with specialized cache and > cache lines) as well as against xstormy16. All of the sid testsuite > checks without regression (including the cache-specific tests). I'm > seeking comments and approval to commit. > > Regards, > Dave > > >------------------------------------------------------------------------ > >2004-04-27 Dave Brolley > > * cache.cxx: Update calls to cache::find. > * cacheutil.cxx (cache_set::allocate_lines): Now takes cache index as > an argument. Update all callers. > (cache_set::find): Now returns a pointer to the line, if found. Update > all callers. > (cache::find): Ditto. > (cache_set::expell_line): Update the status of the expelled line. > * cacheutil.h (cache_line_factory::make_line): Now takes cache index as > an argument. Update all callers. > (cache_set::allocate_lines): Now takes cache index as > an argument. Update all callers. > (cache_set::find): Now returns a pointer to the line, if found. Update > all callers. > (cache::find): Ditto. > >2004-04-27 Dave Brolley > > * cacheutil.h (cache_line): Removed copy constructor. Now virtual base > class. > (cache_line::operator=): Removed. > (internal_cache_line): New class implements former cache_line class. > (cache_set): Now takes cache_line_factory. > (allocate_lines): New method moves line allocation from the constructor. > (cache_set::set_line): Now takes reference to cache_line. > (cache_set::replace_line): Renamed to expell_line. Now returns a pointer > to the expelled line. > (cache): Now takes cache_line_factory argument. > (cache::init): New method moves set allocation from the constructor. > (cache_set::expell_line): Renamed to expell_line. Now returns a pointer > to the expelled line. > (cache_line_factory): New class. > * cacheutil.cxx (cache_line): Removed copy constructor. Now virtual base > class. > (cache_line::operator=): Removed. > (internal_cache_line): New class implements former cache_line class. > (cache_set): Now takes cache_line_factory. > (allocate_lines): New method moves line allocation from the constructor. > (cache_set::set_line): Now takes reference to cache_line. > (dummy): Now internal to cache_set::find. > (cache_set::replace_line): Renamed to expell_line. Now returns a pointer > to the expelled line. > (cache): Now takes cache_line_factory argument. > (cache::init): New method moves set allocation from the constructor. > (cache_set::expell_line): Renamed to expell_line. Now returns a pointer > to the expelled line. > * cache.h (cache_replacement_algorithm::expell): Renamed from 'replace'. > Returns a pointer to the expelled line. Update specializations. > (cache_component): Now takes a cache_line_factory as an argument. > Private data now protected. > (line_factory): New member of cache_component. > (~cache_component): Now virtual. > (CacheCreate): Pass internal_line_factory to cache_component. > * cache.cxx (line_sizes): Make it static. > (line_sizes): Ditto. > (replacement_algorithms): Ditto. > (internal_line_factory): New static cache_line_factory. > (cache_component): Now takes a cache_line_factory as an argument. Pass > the cache line factory to the constructor for acache. Save a reference > to the line factory. Call acache.init > (write_any): Rewrite to use cache::expell_line instead of the former > cache::replace. > (read_any): Ditto. > (cache_replacement_algorithm::expell): Renamed from 'replace'. Returns > a pointer to the expelled line. Update all callers and specializations. > (CacheCreate): Pass internal_line_factory to cache_component. > >2004-04-27 Dave Brolley > > * compConfig.cxx (register_dso): Check dl_handle before attempting to > open ".a". > * Makefile.am (libconfig_la_DEPENDENCIES): Add @LIBLTDL@. > * Makefile.in: Regenerated. > >2004-04-27 Dave Brolley > > * commonCfg.h (CacheCfg::compute_comptype): Now virtual. > (SessionCfg::get_loader): New method. > > > > >