mem: Remove templates in cache model
Review Request #2711 - Created March 30, 2015 and submitted
| Information | |
|---|---|
| Andreas Hansson | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 10805:b0ddc3bf1211 --------------------------- mem: Remove templates in cache model This patch changes the cache implementation to rely on virtual methods rather than using the replacement policy as a template argument. There is no impact on the simulation performance, and overall the changes make it easier to modify (and subclass) the cache and/or replacement policy.
Overall, I'm really glad to see this, especially since it doesn't impact performance. Much cleaner!
Is there a plan to move the cache_impl.hh code to cache.cc now that it's not templated?
-
src/mem/cache/cache.hh (Diff revision 1) -
do we still need this? seems like a good opportunity to do s/BlkType/CacheBlk/g
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
should this comment be above the method?
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
move open brace up to same line as 'for'
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
is 'this->' necessary?
-
src/mem/cache/cache_impl.hh (Diff revision 1) -
'{' placement
-
src/mem/cache/tags/base_set_assoc.cc (Diff revision 1) -
do we really want to replace the visitor pattern with this? I don't know how often this is used, but building this whole list seems like unnecessary overhead. I guess what we really need is the C++ equivalent of python generators...
-
src/mem/cache/tags/fa_lru.cc (Diff revision 1) -
space before '{'
Description: |
|
|||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+227 -324) |
-
src/mem/cache/cache.hh (Diff revision 2) -
should be VisitorFnPtr (since it's a type)
Description: |
|
|||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 3 (+197 -234) |
Thanks for reinstating the callbacks! And also for waiting so patiently for the review!
-
src/mem/cache/blk.hh (Diff revision 3) -
I don't think this needs to be a template anymore, does it? It's only instantiated once with <Cache> as the parameter. I suggest getting rid of the template and also the WrappedBlkVisitor typedef below. The new class could use either name.
-
src/mem/cache/blk.hh (Diff revision 3) -
should be VisitorPtr
Description: |
|
|||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 4 (+199 -236) |
Description: |
|
|||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 5 (+240 -279) |
Thanks!
Wouldn't it make sense to move the CacheBlkVisitor base class to cache.hh too? Whether you make that change or not, go ahead and ship it... no need for another reviewboard round-trip.
