cache.hh (11130:45a23e44e93d) cache.hh (11168:f98eb2da15a4)
1/*
2 * Copyright (c) 2012-2014 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 421 unchanged lines hidden (view full) ---

430 /** Non-default destructor is needed to deallocate memory. */
431 virtual ~Cache();
432
433 void regStats();
434
435 /** serialize the state of the caches
436 * We currently don't support checkpointing cache state, so this panics.
437 */
1/*
2 * Copyright (c) 2012-2014 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 421 unchanged lines hidden (view full) ---

430 /** Non-default destructor is needed to deallocate memory. */
431 virtual ~Cache();
432
433 void regStats();
434
435 /** serialize the state of the caches
436 * We currently don't support checkpointing cache state, so this panics.
437 */
438 void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
439 void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
438 void serialize(CheckpointOut &cp) const override;
439 void unserialize(CheckpointIn &cp) override;
440};
441
442/**
443 * Wrap a method and present it as a cache block visitor.
444 *
445 * For example the forEachBlk method in the tag arrays expects a
446 * callable object/function as their parameter. This class wraps a
447 * method in an object and presents callable object that adheres to
448 * the cache block visitor protocol.
449 */
450class CacheBlkVisitorWrapper : public CacheBlkVisitor
451{
452 public:
453 typedef bool (Cache::*VisitorPtr)(CacheBlk &blk);
454
455 CacheBlkVisitorWrapper(Cache &_cache, VisitorPtr _visitor)
456 : cache(_cache), visitor(_visitor) {}
457
440};
441
442/**
443 * Wrap a method and present it as a cache block visitor.
444 *
445 * For example the forEachBlk method in the tag arrays expects a
446 * callable object/function as their parameter. This class wraps a
447 * method in an object and presents callable object that adheres to
448 * the cache block visitor protocol.
449 */
450class CacheBlkVisitorWrapper : public CacheBlkVisitor
451{
452 public:
453 typedef bool (Cache::*VisitorPtr)(CacheBlk &blk);
454
455 CacheBlkVisitorWrapper(Cache &_cache, VisitorPtr _visitor)
456 : cache(_cache), visitor(_visitor) {}
457
458 bool operator()(CacheBlk &blk) M5_ATTR_OVERRIDE {
458 bool operator()(CacheBlk &blk) override {
459 return (cache.*visitor)(blk);
460 }
461
462 private:
463 Cache &cache;
464 VisitorPtr visitor;
465};
466

--- 5 unchanged lines hidden (view full) ---

472 * array contains dirty blocks.
473 */
474class CacheBlkIsDirtyVisitor : public CacheBlkVisitor
475{
476 public:
477 CacheBlkIsDirtyVisitor()
478 : _isDirty(false) {}
479
459 return (cache.*visitor)(blk);
460 }
461
462 private:
463 Cache &cache;
464 VisitorPtr visitor;
465};
466

--- 5 unchanged lines hidden (view full) ---

472 * array contains dirty blocks.
473 */
474class CacheBlkIsDirtyVisitor : public CacheBlkVisitor
475{
476 public:
477 CacheBlkIsDirtyVisitor()
478 : _isDirty(false) {}
479
480 bool operator()(CacheBlk &blk) M5_ATTR_OVERRIDE {
480 bool operator()(CacheBlk &blk) override {
481 if (blk.isDirty()) {
482 _isDirty = true;
483 return false;
484 } else {
485 return true;
486 }
487 }
488

--- 12 unchanged lines hidden ---
481 if (blk.isDirty()) {
482 _isDirty = true;
483 return false;
484 } else {
485 return true;
486 }
487 }
488

--- 12 unchanged lines hidden ---