changeset 42807286d6cb in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=42807286d6cb
description:
Ruby: Correct DataBlock =operator
The =operator for the DataBlock class was incorrectly interpreting the
class
member m_alloc. This variable stands for whether the assigned memory
for the
data block needs to be freed or not by the class itself. It seems that
the
=operator interpreted the variable as whether the memory is assigned to
the
data block. This wrong interpretation was causing values not to
propagate
to RubySystem::m_mem_vec_ptr. This caused major issues with restoring
from
checkpoints when using a protocol which verified that the cache data was
consistent with the backing store (i.e. MOESI-hammer).
diffstat:
src/mem/ruby/common/DataBlock.cc | 10 +---------
src/mem/ruby/common/DataBlock.hh | 2 ++
2 files changed, 3 insertions(+), 9 deletions(-)
diffs (38 lines):
diff -r ee8d7a51651d -r 42807286d6cb src/mem/ruby/common/DataBlock.cc
--- a/src/mem/ruby/common/DataBlock.cc Tue Aug 28 14:30:33 2012 -0400
+++ b/src/mem/ruby/common/DataBlock.cc Tue Aug 28 17:57:51 2012 -0500
@@ -87,14 +87,6 @@
DataBlock &
DataBlock::operator=(const DataBlock & obj)
{
- if (this == &obj) {
- // assert(false);
- } else {
- if (!m_alloc)
- m_data = new uint8[RubySystem::getBlockSizeBytes()];
- memcpy(m_data, obj.m_data, RubySystem::getBlockSizeBytes());
- m_alloc = true;
- }
-
+ memcpy(m_data, obj.m_data, RubySystem::getBlockSizeBytes());
return *this;
}
diff -r ee8d7a51651d -r 42807286d6cb src/mem/ruby/common/DataBlock.hh
--- a/src/mem/ruby/common/DataBlock.hh Tue Aug 28 14:30:33 2012 -0400
+++ b/src/mem/ruby/common/DataBlock.hh Tue Aug 28 17:57:51 2012 -0500
@@ -29,6 +29,7 @@
#ifndef __MEM_RUBY_COMMON_DATABLOCK_HH__
#define __MEM_RUBY_COMMON_DATABLOCK_HH__
+#include <cassert>
#include <iomanip>
#include <iostream>
@@ -72,6 +73,7 @@
inline void
DataBlock::assign(uint8* data)
{
+ assert(data != NULL);
if (m_alloc) {
delete [] m_data;
}
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev