[patch][rfa] Inheriting from cache_component and friends
Dave Brolley
brolley@redhat.com
Tue Apr 27 22:23:00 GMT 2004
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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sid-cache.ChangeLog
URL: <http://sourceware.org/pipermail/sid/attachments/20040427/59e05370/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sid-cache.patch.txt
URL: <http://sourceware.org/pipermail/sid/attachments/20040427/59e05370/attachment.txt>
More information about the Sid
mailing list