super_blk.hh (13940:33cc30e2de52) | super_blk.hh (13947:4cf8087cab09) |
---|---|
1/** 2 * Copyright (c) 2018 Inria 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 112 unchanged lines hidden (view full) --- 121}; 122 123/** 124 * A basic compression superblock. 125 * Contains the tag and a list of blocks associated to this superblock. 126 */ 127class SuperBlk : public SectorBlk 128{ | 1/** 2 * Copyright (c) 2018 Inria 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 112 unchanged lines hidden (view full) --- 121}; 122 123/** 124 * A basic compression superblock. 125 * Contains the tag and a list of blocks associated to this superblock. 126 */ 127class SuperBlk : public SectorBlk 128{ |
129 protected: 130 /** Block size, in bytes. */ 131 std::size_t blkSize; 132 |
|
129 public: | 133 public: |
130 SuperBlk() : SectorBlk() {} | 134 SuperBlk() : SectorBlk(), blkSize(0) {} |
131 SuperBlk(const SuperBlk&) = delete; 132 SuperBlk& operator=(const SuperBlk&) = delete; 133 ~SuperBlk() {}; 134 135 /** 136 * Returns whether the superblock contains compressed blocks or not. By 137 * default, if not blocks are valid, the superblock is compressible. 138 * | 135 SuperBlk(const SuperBlk&) = delete; 136 SuperBlk& operator=(const SuperBlk&) = delete; 137 ~SuperBlk() {}; 138 139 /** 140 * Returns whether the superblock contains compressed blocks or not. By 141 * default, if not blocks are valid, the superblock is compressible. 142 * |
143 * @param ignored_blk If provided don't consider the given block. |
|
139 * @return The compressibility state of the superblock. 140 */ | 144 * @return The compressibility state of the superblock. 145 */ |
141 bool isCompressed() const; | 146 bool isCompressed(const CompressionBlk* ignored_blk = nullptr) const; 147 148 /** 149 * Checks whether a superblock can co-allocate given compressed data block. 150 * 151 * @param compressed_size Size, in bits, of new block to allocate. 152 * @return True if block can be co-allocated in superblock. 153 */ 154 bool canCoAllocate(const std::size_t compressed_size) const; 155 156 /** 157 * Set block size. Should be called only once, when initializing blocks. 158 * 159 * @param blk_size The uncompressed block size. 160 */ 161 void setBlkSize(const std::size_t blk_size); |
142}; 143 144#endif //__MEM_CACHE_TAGS_SUPER_BLK_HH__ | 162}; 163 164#endif //__MEM_CACHE_TAGS_SUPER_BLK_HH__ |