From: Martin Quinson Date: Fri, 31 May 2019 21:58:11 +0000 (+0200) Subject: MC: rename some files X-Git-Tag: v3.22.4~29 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d574355c7629f9f18b0667c69bfb0f1695b7b3b6 MC: rename some files --- diff --git a/src/mc/VisitedState.hpp b/src/mc/VisitedState.hpp index 42afbeef70..ceae2e063c 100644 --- a/src/mc/VisitedState.hpp +++ b/src/mc/VisitedState.hpp @@ -7,7 +7,7 @@ #define SIMGRID_MC_VISITED_STATE_HPP #include "src/mc/mc_state.hpp" -#include "src/mc/sosp/mc_snapshot.hpp" +#include "src/mc/sosp/Snapshot.hpp" #include #include diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index 8525202ddf..d91e7fc069 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -8,7 +8,7 @@ #include "src/mc/mc_config.hpp" #include "src/mc/mc_private.hpp" #include "src/mc/mc_smx.hpp" -#include "src/mc/sosp/mc_snapshot.hpp" +#include "src/mc/sosp/Snapshot.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_compare, xbt, "Logging specific to mc_compare in mc"); diff --git a/src/mc/mc_global.cpp b/src/mc/mc_global.cpp index 1e7330d6ef..b9a76cca01 100644 --- a/src/mc/mc_global.cpp +++ b/src/mc/mc_global.cpp @@ -17,7 +17,7 @@ #include "src/mc/mc_safety.hpp" #include "src/mc/mc_smx.hpp" #include "src/mc/remote/Client.hpp" -#include "src/mc/sosp/mc_snapshot.hpp" +#include "src/mc/sosp/Snapshot.hpp" #include "xbt/backtrace.hpp" #include diff --git a/src/mc/mc_hash.cpp b/src/mc/mc_hash.cpp index 8c23131509..d23fe6915d 100644 --- a/src/mc/mc_hash.cpp +++ b/src/mc/mc_hash.cpp @@ -4,7 +4,6 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include - #include #include "xbt/log.h" @@ -12,7 +11,7 @@ #include "mc/datatypes.h" #include "src/mc/mc_hash.hpp" #include "src/mc/mc_private.hpp" -#include "src/mc/sosp/mc_snapshot.hpp" +#include "src/mc/sosp/Snapshot.hpp" #include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_hash, mc, "Logging specific to mc_hash"); diff --git a/src/mc/mc_state.hpp b/src/mc/mc_state.hpp index a7a0fb3c7a..480bdea388 100644 --- a/src/mc/mc_state.hpp +++ b/src/mc/mc_state.hpp @@ -6,9 +6,9 @@ #ifndef SIMGRID_MC_STATE_HPP #define SIMGRID_MC_STATE_HPP -#include "src/mc/sosp/mc_snapshot.hpp" #include "src/kernel/activity/CommImpl.hpp" #include "src/mc/Transition.hpp" +#include "src/mc/sosp/Snapshot.hpp" namespace simgrid { namespace mc { diff --git a/src/mc/remote/RemoteClient.cpp b/src/mc/remote/RemoteClient.cpp index b01b482336..4412b4fd0c 100644 --- a/src/mc/remote/RemoteClient.cpp +++ b/src/mc/remote/RemoteClient.cpp @@ -7,10 +7,10 @@ #include "src/mc/remote/RemoteClient.hpp" +#include "src/mc/mc_smx.hpp" +#include "src/mc/sosp/Snapshot.hpp" #include "xbt/file.hpp" #include "xbt/log.h" -#include "src/mc/mc_smx.hpp" -#include "src/mc/sosp/mc_snapshot.hpp" #include #include diff --git a/src/mc/sosp/RegionSnapshot.cpp b/src/mc/sosp/Region.cpp similarity index 97% rename from src/mc/sosp/RegionSnapshot.cpp rename to src/mc/sosp/Region.cpp index 006ff2ba51..b9c4107113 100644 --- a/src/mc/sosp/RegionSnapshot.cpp +++ b/src/mc/sosp/Region.cpp @@ -3,19 +3,18 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include - -#include -#ifdef __FreeBSD__ -#define MAP_POPULATE MAP_PREFAULT_READ -#endif - #include "src/mc/ModelChecker.hpp" #include "src/mc/mc_config.hpp" #include "src/mc/mc_forward.hpp" #include "src/mc/mc_smx.hpp" -#include "src/mc/sosp/RegionSnapshot.hpp" +#include "src/mc/sosp/Region.hpp" + +#include +#include +#ifdef __FreeBSD__ +#define MAP_POPULATE MAP_PREFAULT_READ +#endif XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_RegionSnaphot, mc, "Logging specific to region snapshots"); @@ -45,7 +44,7 @@ void RegionSnapshot::restore() 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)); - } + } } } // namespace mc diff --git a/src/mc/sosp/RegionSnapshot.hpp b/src/mc/sosp/Region.hpp similarity index 87% rename from src/mc/sosp/RegionSnapshot.hpp rename to src/mc/sosp/Region.hpp index 4fd5287ce2..a151b6cffd 100644 --- a/src/mc/sosp/RegionSnapshot.hpp +++ b/src/mc/sosp/Region.hpp @@ -52,11 +52,11 @@ public: } RegionSnapshot& operator=(RegionSnapshot&& that) { - region_type_ = that.region_type_; - object_info_ = that.object_info_; - start_addr_ = that.start_addr_; - size_ = that.size_; - chunks_ = std::move(that.chunks_); + region_type_ = that.region_type_; + object_info_ = that.object_info_; + start_addr_ = that.start_addr_; + size_ = that.size_; + chunks_ = std::move(that.chunks_); that.clear(); return *this; } @@ -65,11 +65,11 @@ public: void clear() { - region_type_ = UnknownRegion; + region_type_ = UnknownRegion; chunks_.clear(); - object_info_ = nullptr; - start_addr_ = nullptr; - size_ = 0; + object_info_ = nullptr; + start_addr_ = nullptr; + size_ = 0; } ChunkedData const& get_chunks() const { return chunks_; } diff --git a/src/mc/sosp/mc_snapshot.cpp b/src/mc/sosp/Snapshot.cpp similarity index 97% rename from src/mc/sosp/mc_snapshot.cpp rename to src/mc/sosp/Snapshot.cpp index 1a61f339ed..a3d6c79efe 100644 --- a/src/mc/sosp/mc_snapshot.cpp +++ b/src/mc/sosp/Snapshot.cpp @@ -3,12 +3,12 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include /* std::size_t */ - +#include "src/mc/sosp/Snapshot.hpp" #include "src/mc/mc_config.hpp" #include "src/mc/mc_hash.hpp" #include "src/mc/mc_smx.hpp" -#include "src/mc/sosp/mc_snapshot.hpp" + +#include /* std::size_t */ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_snapshot, mc, "Taking and restoring snapshots"); @@ -67,7 +67,7 @@ int MC_snapshot_region_memcmp(const void* addr1, simgrid::mc::RegionSnapshot* re { // Using alloca() for large allocations may trigger stack overflow: // use malloc if the buffer is too big. - bool stack_alloc = size < 64; + bool stack_alloc = size < 64; void* buffer1a = stack_alloc ? alloca(size) : ::operator new(size); void* buffer2a = stack_alloc ? alloca(size) : ::operator new(size); const void* buffer1 = MC_region_read(region1, buffer1a, addr1, size); @@ -102,7 +102,7 @@ void simgrid::mc::Snapshot::snapshot_regions(simgrid::mc::RemoteClient* process) void* end_heap = heap->breakval; 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()); + heap_bytes_used_ = mmalloc_get_bytes_used_remote(heap->heaplimit, process->get_malloc_info()); } /** @brief Checks whether the variable is in scope for a given IP. @@ -274,11 +274,7 @@ static void snapshot_ignore_restore(simgrid::mc::Snapshot* snapshot) } Snapshot::Snapshot(int num_state, RemoteClient* process) - : AddressSpace(process) - , num_state_(num_state) - , heap_bytes_used_(0) - , enabled_processes_() - , hash_(0) + : AddressSpace(process), num_state_(num_state), heap_bytes_used_(0), enabled_processes_(), hash_(0) { XBT_DEBUG("Taking snapshot %i", num_state); diff --git a/src/mc/sosp/mc_snapshot.hpp b/src/mc/sosp/Snapshot.hpp similarity index 91% rename from src/mc/sosp/mc_snapshot.hpp rename to src/mc/sosp/Snapshot.hpp index c0e44d64f1..8e24f6c2e0 100644 --- a/src/mc/sosp/mc_snapshot.hpp +++ b/src/mc/sosp/Snapshot.hpp @@ -9,7 +9,7 @@ #include "src/mc/ModelChecker.hpp" #include "src/mc/inspect/mc_unw.hpp" #include "src/mc/remote/RemoteClient.hpp" -#include "src/mc/sosp/RegionSnapshot.hpp" +#include "src/mc/sosp/Region.hpp" // ***** Snapshot region @@ -129,14 +129,14 @@ static XBT_ALWAYS_INLINE const void* MC_region_read(simgrid::mc::RegionSnapshot* xbt_assert(region->contain(simgrid::mc::remote(addr)), "Trying to read out of the region boundary."); - // Last byte of the region: - void* end = (char*)addr + size - 1; - if (simgrid::mc::mmu::same_chunk((std::uintptr_t)addr, (std::uintptr_t)end)) { - // The memory is contained in a single page: - return mc_translate_address_region((uintptr_t)addr, region); - } - // Otherwise, the memory spans several pages: - return MC_region_read_fragmented(region, target, addr, size); + // Last byte of the region: + void* end = (char*)addr + size - 1; + if (simgrid::mc::mmu::same_chunk((std::uintptr_t)addr, (std::uintptr_t)end)) { + // The memory is contained in a single page: + return mc_translate_address_region((uintptr_t)addr, region); + } + // Otherwise, the memory spans several pages: + return MC_region_read_fragmented(region, target, addr, size); } static XBT_ALWAYS_INLINE void* MC_region_read_pointer(simgrid::mc::RegionSnapshot* region, const void* addr) diff --git a/src/mc/sosp/mc_snapshot_test.cpp b/src/mc/sosp/Snapshot_test.cpp similarity index 99% rename from src/mc/sosp/mc_snapshot_test.cpp rename to src/mc/sosp/Snapshot_test.cpp index 87dbca3d99..8c5528534f 100644 --- a/src/mc/sosp/mc_snapshot_test.cpp +++ b/src/mc/sosp/Snapshot_test.cpp @@ -5,7 +5,7 @@ #include "src/include/catch.hpp" #include "src/mc/mc_config.hpp" -#include "src/mc/sosp/mc_snapshot.hpp" +#include "src/mc/sosp/Snapshot.hpp" #include #include diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index f2fc1eb869..08015db27f 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -633,10 +633,10 @@ set(MC_SRC src/mc/sosp/PageStore.cpp src/mc/sosp/ChunkedData.hpp src/mc/sosp/ChunkedData.cpp - src/mc/sosp/RegionSnapshot.cpp - src/mc/sosp/RegionSnapshot.hpp - src/mc/sosp/mc_snapshot.hpp - src/mc/sosp/mc_snapshot.cpp + src/mc/sosp/Region.cpp + src/mc/sosp/Region.hpp + src/mc/sosp/Snapshot.hpp + src/mc/sosp/Snapshot.cpp src/mc/AddressSpace.hpp src/mc/ModelChecker.hpp diff --git a/tools/cmake/Tests.cmake b/tools/cmake/Tests.cmake index 3b6bc72b5f..2988ed0f95 100644 --- a/tools/cmake/Tests.cmake +++ b/tools/cmake/Tests.cmake @@ -102,9 +102,9 @@ set(UNIT_TESTS src/xbt/unit-tests_main.cpp src/xbt/dynar_test.cpp src/xbt/xbt_str_test.cpp) if (SIMGRID_HAVE_MC) - set(UNIT_TESTS ${UNIT_TESTS} src/mc/sosp/mc_snapshot_test.cpp src/mc/sosp/PageStore_test.cpp) + set(UNIT_TESTS ${UNIT_TESTS} src/mc/sosp/Snapshot_test.cpp src/mc/sosp/PageStore_test.cpp) else() - set(EXTRA_DIST ${EXTRA_DIST} src/mc/sosp/mc_snapshot_test.cpp src/mc/sosp/PageStore_test.cpp) + set(EXTRA_DIST ${EXTRA_DIST} src/mc/sosp/Snapshot_test.cpp src/mc/sosp/PageStore_test.cpp) endif() add_executable (unit-tests ${UNIT_TESTS})