#include <vector>
#include "src/mc/mc_forward.hpp"
+#include "src/mc/remote/RemotePtr.hpp"
#include "src/mc/sosp/PageStore.hpp"
namespace simgrid {
namespace simgrid {
namespace mc {
-/** @brief Take a snapshot of a given region
- *
- * @param type
- * @param start_addr Address of the region in the simulated process
- * @param permanent_addr Permanent address of this data (for privatized variables, this is the virtual address of the
- * privatized mapping)
- * @param size Size of the data*
- */
-RegionSnapshot* region(RegionType type, void* start_addr, void* permanent_addr, size_t size)
-{
- return new RegionSnapshot(type, start_addr, permanent_addr, size);
-}
-
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)
{
enum class RegionType { Unknown = 0, Heap = 1, Data = 2 };
-/** A copy/snapshot of a given memory region
- *
- * Different types of region snapshot storage types exist:
- *
- * * flat/dense snapshots are a simple copy of the region;
- *
- * * sparse/per-page snapshots are snaapshots which shared
- * identical pages.
- *
- * * privatized (SMPI global variable privatization).
- *
- * This is handled with a variant based approach:
- *
- * * `storage_type` identified the type of storage;
- *
- * * an anonymous enum is used to distinguish the relevant types for
- * each type.
- */
+/** A copy/snapshot of a given memory region, where identical pages are stored only once */
class RegionSnapshot {
public:
static const RegionType UnknownRegion = RegionType::Unknown;
void restore();
};
-RegionSnapshot* region(RegionType type, void* start_addr, void* data_addr, std::size_t size);
-
} // namespace mc
} // namespace simgrid
else if (type == simgrid::mc::RegionType::Heap)
xbt_assert(not object_info, "Unexpected object info for heap region.");
- simgrid::mc::RegionSnapshot* region = simgrid::mc::region(type, start_addr, permanent_addr, size);
+ simgrid::mc::RegionSnapshot* region = new RegionSnapshot(type, start_addr, permanent_addr, size);
region->object_info(object_info);
snapshot_regions_.push_back(std::unique_ptr<simgrid::mc::RegionSnapshot>(std::move(region)));
}