That was needed for the MMAP privatization of SMPI, which is gone.
namespace simgrid {
namespace mc {
-RegionSnapshot::RegionSnapshot(RegionType region_type, void* start_addr, void* permanent_addr, size_t size)
- : region_type_(region_type), start_addr_(start_addr), size_(size), permanent_addr_(permanent_addr)
+RegionSnapshot::RegionSnapshot(RegionType region_type, void* start_addr, size_t size)
+ : region_type_(region_type), start_addr_(start_addr), size_(size)
{
simgrid::mc::RemoteClient* process = &mc_model_checker->process();
xbt_assert((((uintptr_t)start_addr) & (xbt_pagesize - 1)) == 0, "Start address not at the beginning of a page");
- xbt_assert((((uintptr_t)permanent_addr) & (xbt_pagesize - 1)) == 0,
- "Permanent address not at the beginning of a page");
- chunks_ =
- ChunkedData(mc_model_checker->page_store(), *process, RemotePtr<void>(permanent_addr), mmu::chunk_count(size));
+ chunks_ = ChunkedData(mc_model_checker->page_store(), *process, RemotePtr<void>(start_addr), mmu::chunk_count(size));
}
/** @brief Restore a region from a snapshot
*/
void RegionSnapshot::restore()
{
- xbt_assert(((permanent_address().address()) & (xbt_pagesize - 1)) == 0, "Not at the beginning of a page");
- xbt_assert(simgrid::mc::mmu::chunk_count(size()) == chunks().page_count());
+ xbt_assert(((start().address()) & (xbt_pagesize - 1)) == 0, "Not at the beginning of a page");
+ xbt_assert(simgrid::mc::mmu::chunk_count(size()) == get_chunks().page_count());
- for (size_t i = 0; i != chunks().page_count(); ++i) {
- void* target_page = (void*)simgrid::mc::mmu::join(i, (std::uintptr_t)(void*)permanent_address().address());
- const void* source_page = chunks().page(i);
- mc_model_checker->process().write_bytes(source_page, xbt_pagesize, remote(target_page));
+ for (size_t i = 0; i != get_chunks().page_count(); ++i) {
+ void* target_page = (void*)simgrid::mc::mmu::join(i, (std::uintptr_t)(void*)start().address());
+ const void* source_page = get_chunks().page(i);
+ mc_model_checker->process().write_bytes(source_page, xbt_pagesize, remote(target_page));
}
}
/** @brief Size of the data region in bytes */
std::size_t size_ = 0;
- /** @brief Permanent virtual address of the region
- *
- * This is usually the same address as the simuilated process address.
- * However, when using SMPI privatization of global variables,
- * each SMPI process has its own set of global variables stored
- * at a different virtual address. The scheduler maps those region
- * on the region of the global variables.
- *
- * */
- void* permanent_addr_ = nullptr;
-
ChunkedData chunks_;
public:
- RegionSnapshot(RegionType type, void* start_addr, void* permanent_addr, size_t size);
+ RegionSnapshot(RegionType type, void* start_addr, size_t size);
~RegionSnapshot() = default;
RegionSnapshot(RegionSnapshot const&) = delete;
RegionSnapshot& operator=(RegionSnapshot const&) = delete;
, object_info_(that.object_info_)
, start_addr_(that.start_addr_)
, size_(that.size_)
- , permanent_addr_(that.permanent_addr_)
, chunks_(std::move(that.chunks_))
{
that.clear();
object_info_ = that.object_info_;
start_addr_ = that.start_addr_;
size_ = that.size_;
- permanent_addr_ = that.permanent_addr_;
chunks_ = std::move(that.chunks_);
that.clear();
return *this;
object_info_ = nullptr;
start_addr_ = nullptr;
size_ = 0;
- permanent_addr_ = nullptr;
}
- ChunkedData const& chunks() const { return chunks_; }
+ ChunkedData const& get_chunks() const { return chunks_; }
simgrid::mc::ObjectInformation* object_info() const { return object_info_; }
void object_info(simgrid::mc::ObjectInformation* info) { object_info_ = info; }
RemotePtr<void> start() const { return remote(start_addr_); }
RemotePtr<void> end() const { return remote((char*)start_addr_ + size_); }
- RemotePtr<void> permanent_address() const { return remote(permanent_addr_); }
std::size_t size() const { return size_; }
RegionType region_type() const { return region_type_; }
snapshot_regions_.clear();
for (auto const& object_info : process->object_infos)
- add_region(simgrid::mc::RegionType::Data, object_info.get(), object_info->start_rw, object_info->start_rw,
+ add_region(simgrid::mc::RegionType::Data, object_info.get(), object_info->start_rw,
object_info->end_rw - object_info->start_rw);
xbt_mheap_t heap = process->get_heap();
void* start_heap = heap->base;
void* end_heap = heap->breakval;
- add_region(simgrid::mc::RegionType::Heap, nullptr, start_heap, start_heap, (char*)end_heap - (char*)start_heap);
+ add_region(simgrid::mc::RegionType::Heap, nullptr, start_heap, (char*)end_heap - (char*)start_heap);
heap_bytes_used_ = mmalloc_get_bytes_used_remote(heap->heaplimit, process->get_malloc_info());
}
snapshot_ignore_restore(this);
}
-void Snapshot::add_region(RegionType type, ObjectInformation* object_info, void* start_addr, void* permanent_addr,
- std::size_t size)
+void Snapshot::add_region(RegionType type, ObjectInformation* object_info, void* start_addr, std::size_t size)
{
if (type == simgrid::mc::RegionType::Data)
xbt_assert(object_info, "Missing object info for object.");
else if (type == simgrid::mc::RegionType::Heap)
xbt_assert(not object_info, "Unexpected object info for heap region.");
- simgrid::mc::RegionSnapshot* region = new RegionSnapshot(type, start_addr, permanent_addr, size);
+ simgrid::mc::RegionSnapshot* region = new RegionSnapshot(type, start_addr, size);
region->object_info(object_info);
snapshot_regions_.push_back(std::unique_ptr<simgrid::mc::RegionSnapshot>(std::move(region)));
}
auto split = simgrid::mc::mmu::split(addr - region->start().address());
auto pageno = split.first;
auto offset = split.second;
- const void* snapshot_page = region->chunks().page(pageno);
+ const void* snapshot_page = region->get_chunks().page(pageno);
return (char*)snapshot_page + offset;
}
std::vector<s_mc_snapshot_ignored_data_t> ignored_data_;
private:
- void add_region(RegionType type, ObjectInformation* object_info, void* start_addr, void* permanent_addr,
- std::size_t size);
+ void add_region(RegionType type, ObjectInformation* object_info, void* start_addr, std::size_t size);
void snapshot_regions(simgrid::mc::RemoteClient* process);
void snapshot_stacks(simgrid::mc::RemoteClient* process);
};
// Init memory and take snapshots:
init_memory(source, byte_size);
simgrid::mc::RegionSnapshot* region0 =
- new simgrid::mc::RegionSnapshot(simgrid::mc::RegionType::Unknown, source, source, byte_size);
+ new simgrid::mc::RegionSnapshot(simgrid::mc::RegionType::Unknown, source, byte_size);
for (int i = 0; i < n; i += 2) {
init_memory((char*)source + i * xbt_pagesize, xbt_pagesize);
}
simgrid::mc::RegionSnapshot* region =
- new simgrid::mc::RegionSnapshot(simgrid::mc::RegionType::Unknown, source, source, byte_size);
+ new simgrid::mc::RegionSnapshot(simgrid::mc::RegionType::Unknown, source, byte_size);
void* destination = mmap(nullptr, byte_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
INFO("Could not allocate destination memory");
prologue_return ret = prologue(1);
memcpy(ret.src, &mc_model_checker, sizeof(void*));
simgrid::mc::RegionSnapshot* region2 =
- new simgrid::mc::RegionSnapshot(simgrid::mc::RegionType::Unknown, ret.src, ret.src, ret.size);
+ new simgrid::mc::RegionSnapshot(simgrid::mc::RegionType::Unknown, ret.src, ret.size);
INFO("Mismtach in MC_region_read_pointer()");
REQUIRE(MC_region_read_pointer(region2, ret.src) == mc_model_checker);