Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MC: rename some files
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 31 May 2019 21:58:11 +0000 (23:58 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 31 May 2019 21:58:11 +0000 (23:58 +0200)
13 files changed:
src/mc/VisitedState.hpp
src/mc/compare.cpp
src/mc/mc_global.cpp
src/mc/mc_hash.cpp
src/mc/mc_state.hpp
src/mc/remote/RemoteClient.cpp
src/mc/sosp/Region.cpp [moved from src/mc/sosp/RegionSnapshot.cpp with 97% similarity]
src/mc/sosp/Region.hpp [moved from src/mc/sosp/RegionSnapshot.hpp with 87% similarity]
src/mc/sosp/Snapshot.cpp [moved from src/mc/sosp/mc_snapshot.cpp with 97% similarity]
src/mc/sosp/Snapshot.hpp [moved from src/mc/sosp/mc_snapshot.hpp with 91% similarity]
src/mc/sosp/Snapshot_test.cpp [moved from src/mc/sosp/mc_snapshot_test.cpp with 99% similarity]
tools/cmake/DefinePackages.cmake
tools/cmake/Tests.cmake

index 42afbee..ceae2e0 100644 (file)
@@ -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 <cstddef>
 #include <memory>
index 8525202..d91e7fc 100644 (file)
@@ -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");
 
index 1e7330d..b9a76cc 100644 (file)
@@ -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 <libunwind.h>
index 8c23131..d23fe69 100644 (file)
@@ -4,7 +4,6 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <cinttypes>
-
 #include <cstdint>
 
 #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 <mc/mc.h>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_hash, mc, "Logging specific to mc_hash");
index a7a0fb3..480bdea 100644 (file)
@@ -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 {
index b01b482..4412b4f 100644 (file)
@@ -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 <fcntl.h>
 #include <libunwind-ptrace.h>
similarity index 97%
rename from src/mc/sosp/RegionSnapshot.cpp
rename to src/mc/sosp/Region.cpp
index 006ff2b..b9c4107 100644 (file)
@@ -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 <cstdlib>
-
-#include <sys/mman.h>
-#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 <cstdlib>
+#include <sys/mman.h>
+#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
similarity index 87%
rename from src/mc/sosp/RegionSnapshot.hpp
rename to src/mc/sosp/Region.hpp
index 4fd5287..a151b6c 100644 (file)
@@ -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_; }
similarity index 97%
rename from src/mc/sosp/mc_snapshot.cpp
rename to src/mc/sosp/Snapshot.cpp
index 1a61f33..a3d6c79 100644 (file)
@@ -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 <cstddef> /* 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 <cstddef> /* 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);
 
similarity index 91%
rename from src/mc/sosp/mc_snapshot.hpp
rename to src/mc/sosp/Snapshot.hpp
index c0e44d6..8e24f6c 100644 (file)
@@ -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)
similarity index 99%
rename from src/mc/sosp/mc_snapshot_test.cpp
rename to src/mc/sosp/Snapshot_test.cpp
index 87dbca3..8c55285 100644 (file)
@@ -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 <cstddef>
 #include <random>
index f2fc1eb..08015db 100644 (file)
@@ -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
index 3b6bc72..2988ed0 100644 (file)
@@ -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})