X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/af4f085dddf9802166aa47d8866efce05d8efc1d..39cf43e4e190f5053b971b13ff1a1d82ebea5dba:/src/mc/sosp/mc_snapshot.hpp?ds=sidebyside diff --git a/src/mc/sosp/mc_snapshot.hpp b/src/mc/sosp/mc_snapshot.hpp index 147c7fa0b6..52f8ac49fc 100644 --- a/src/mc/sosp/mc_snapshot.hpp +++ b/src/mc/sosp/mc_snapshot.hpp @@ -22,8 +22,7 @@ static XBT_ALWAYS_INLINE void* mc_translate_address_region_chunked(uintptr_t add return (char*)snapshot_page + offset; } -static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, simgrid::mc::RegionSnapshot* region, - int process_index) +static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, simgrid::mc::RegionSnapshot* region) { switch (region->storage_type()) { case simgrid::mc::StorageType::Flat: { @@ -32,12 +31,6 @@ static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, simgr } case simgrid::mc::StorageType::Chunked: return mc_translate_address_region_chunked(addr, region); - case simgrid::mc::StorageType::Privatized: { - xbt_assert(process_index >= 0, "Missing process index for privatized region"); - xbt_assert((size_t)process_index < region->privatized_data().size(), "Out of range process index"); - simgrid::mc::RegionSnapshot* subregion = region->privatized_data()[process_index].get(); - return mc_translate_address_region(addr, subregion, process_index); - } default: // includes StorageType::NoData xbt_die("Storage type not supported"); } @@ -81,7 +74,6 @@ struct XBT_PRIVATE s_mc_snapshot_stack_t { std::vector local_variables; simgrid::mc::UnwindContext context; std::vector stack_frames; - int process_index; }; typedef s_mc_snapshot_stack_t* mc_snapshot_stack_t; @@ -90,30 +82,34 @@ namespace mc { class XBT_PRIVATE Snapshot final : public AddressSpace { public: - Snapshot(RemoteClient* process, int num_state); + Snapshot(int num_state, RemoteClient* process = &mc_model_checker->process()); ~Snapshot() = default; /* Initialization */ - void add_region(RegionType type, ObjectInformation* object_info, void* start_addr, void* permanent_addr, - std::size_t size); /* Regular use */ - const void* read_bytes(void* buffer, std::size_t size, RemotePtr address, int process_index = ProcessIndexAny, + const void* read_bytes(void* buffer, std::size_t size, RemotePtr address, ReadOptions options = ReadOptions::none()) const override; - RegionSnapshot* get_region(const void* addr, int process_index) const; - RegionSnapshot* get_region(const void* addr, int process_index, RegionSnapshot* hinted_region) const; + RegionSnapshot* get_region(const void* addr) const; + RegionSnapshot* get_region(const void* addr, RegionSnapshot* hinted_region) const; + void restore(RemoteClient* process); // To be private int num_state_; std::size_t heap_bytes_used_; std::vector> snapshot_regions_; std::set enabled_processes_; - int privatization_index_; std::vector stack_sizes_; std::vector stacks_; std::vector to_ignore_; std::uint64_t hash_ = 0; std::vector ignored_data_; + +private: + void add_region(RegionType type, ObjectInformation* object_info, void* start_addr, void* permanent_addr, + std::size_t size); + void snapshot_regions(simgrid::mc::RemoteClient* process); + void snapshot_stacks(simgrid::mc::RemoteClient* process); }; } // namespace mc } // namespace simgrid @@ -124,7 +120,6 @@ namespace simgrid { namespace mc { XBT_PRIVATE std::shared_ptr take_snapshot(int num_state); -XBT_PRIVATE void restore_snapshot(std::shared_ptr snapshot); } // namespace mc } // namespace simgrid @@ -174,9 +169,7 @@ static XBT_ALWAYS_INLINE const void* MC_region_read(simgrid::mc::RegionSnapshot* } default: - // includes StorageType::NoData and StorageType::Privatized (we currently do not pass the process_index to this - // function so we assume that the privatized region has been resolved in the callers) - xbt_die("Storage type not supported"); + xbt_die("StorageType::NoData not supported"); } }