Daniel Carvalho has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/33378 )
Change subject: mem-cache: Allow inheriting from DitionaryCompressor's comp
data
......................................................................
mem-cache: Allow inheriting from DitionaryCompressor's comp data
Previously either the compression data was the one declared within
DictionaryCompressor, or the derived class would have to override
the compress() to use a derived compression data.
With this change, the instantiation can be overridden, and thus
any derived class can choose the compression data pointer type
they need to use.
Change-Id: I387936265a3de6785a6096c7a6bd21774202b1c7
Signed-off-by: Daniel R. Carvalho <[email protected]>
---
M src/mem/cache/compressors/dictionary_compressor.hh
M src/mem/cache/compressors/dictionary_compressor_impl.hh
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/mem/cache/compressors/dictionary_compressor.hh
b/src/mem/cache/compressors/dictionary_compressor.hh
index b5e9e67..a0bdf4d 100644
--- a/src/mem/cache/compressors/dictionary_compressor.hh
+++ b/src/mem/cache/compressors/dictionary_compressor.hh
@@ -222,6 +222,14 @@
virtual void addToDictionary(const DictionaryEntry data) = 0;
/**
+ * Instantiate a compression data of the sub-class compressor.
+ *
+ * @return The new compression data entry.
+ */
+ virtual std::unique_ptr<DictionaryCompressor::CompData>
+ instantiateDictionaryCompData() const;
+
+ /**
* Apply compression.
*
* @param data The cache line to be compressed.
diff --git a/src/mem/cache/compressors/dictionary_compressor_impl.hh
b/src/mem/cache/compressors/dictionary_compressor_impl.hh
index 6b6e5fb..b157216 100644
--- a/src/mem/cache/compressors/dictionary_compressor_impl.hh
+++ b/src/mem/cache/compressors/dictionary_compressor_impl.hh
@@ -80,6 +80,13 @@
}
template <typename T>
+std::unique_ptr<typename DictionaryCompressor<T>::CompData>
+DictionaryCompressor<T>::instantiateDictionaryCompData() const
+{
+ return std::unique_ptr<DictionaryCompressor<T>::CompData>(new
CompData());
+}
+
+template <typename T>
std::unique_ptr<typename DictionaryCompressor<T>::Pattern>
DictionaryCompressor<T>::compressValue(const T data)
{
@@ -119,7 +126,7 @@
DictionaryCompressor<T>::compress(const uint64_t* data)
{
std::unique_ptr<Base::CompressionData> comp_data =
- std::unique_ptr<CompData>(new CompData());
+ instantiateDictionaryCompData();
// Reset dictionary
resetDictionary();
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33378
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I387936265a3de6785a6096c7a6bd21774202b1c7
Gerrit-Change-Number: 33378
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Carvalho <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s