Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MC: cosmetics (fight the mc_model_checker singleton)
[simgrid.git] / src / mc / sosp / mc_snapshot.cpp
index 535cfc2..fbe1a42 100644 (file)
@@ -38,7 +38,7 @@ const void* MC_region_read_fragmented(simgrid::mc::RegionSnapshot* region, void*
 
   // Read each page:
   while (simgrid::mc::mmu::split((std::uintptr_t)addr).first != page_end) {
-    void* snapshot_addr = mc_translate_address_region_chunked((uintptr_t)addr, region);
+    void* snapshot_addr = mc_translate_address_region((uintptr_t)addr, region);
     void* next_page     = (void*)simgrid::mc::mmu::join(simgrid::mc::mmu::split((std::uintptr_t)addr).first + 1, 0);
     size_t readable     = (char*)next_page - (char*)addr;
     memcpy(dest, snapshot_addr, readable);
@@ -48,7 +48,7 @@ const void* MC_region_read_fragmented(simgrid::mc::RegionSnapshot* region, void*
   }
 
   // Read the end:
-  void* snapshot_addr = mc_translate_address_region_chunked((uintptr_t)addr, region);
+  void* snapshot_addr = mc_translate_address_region((uintptr_t)addr, region);
   memcpy(dest, snapshot_addr, size);
 
   return target;
@@ -68,12 +68,8 @@ 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;
-  void* buffer1a   = nullptr;
-  void* buffer2a   = nullptr;
-  if (region1 != nullptr && region1->storage_type() != simgrid::mc::StorageType::Flat)
-    buffer1a = stack_alloc ? alloca(size) : ::operator new(size);
-  if (region2 != nullptr && region2->storage_type() != simgrid::mc::StorageType::Flat)
-    buffer2a = stack_alloc ? alloca(size) : ::operator new(size);
+  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);
   const void* buffer2 = MC_region_read(region2, buffer2a, addr2, size);
   int res;
@@ -237,9 +233,9 @@ void simgrid::mc::Snapshot::snapshot_stacks(simgrid::mc::RemoteClient* process)
 
     // Read the context from remote process:
     unw_context_t context;
-    mc_model_checker->process().read_bytes(&context, sizeof(context), remote(stack.context));
+    process->read_bytes(&context, sizeof(context), remote(stack.context));
 
-    st.context.initialize(&mc_model_checker->process(), &context);
+    st.context.initialize(process, &context);
 
     st.stack_frames    = unwind_stack_frames(&st.context);
     st.local_variables = get_local_variables_values(st.stack_frames);
@@ -258,7 +254,7 @@ static void snapshot_handle_ignore(simgrid::mc::Snapshot* snapshot)
   xbt_assert(snapshot->process());
 
   // Copy the memory:
-  for (auto const& region : mc_model_checker->process().ignored_regions()) {
+  for (auto const& region : snapshot->process()->ignored_regions()) {
     s_mc_snapshot_ignored_data_t ignored_data;
     ignored_data.start = (void*)region.addr;
     ignored_data.data.resize(region.size);
@@ -268,7 +264,7 @@ static void snapshot_handle_ignore(simgrid::mc::Snapshot* snapshot)
   }
 
   // Zero the memory:
-  for (auto const& region : mc_model_checker->process().ignored_regions())
+  for (auto const& region : snapshot->process()->ignored_regions())
     snapshot->process()->clear_bytes(remote(region.addr), region.size);
 }
 static void snapshot_ignore_restore(simgrid::mc::Snapshot* snapshot)
@@ -285,7 +281,7 @@ Snapshot::Snapshot(int _num_state, RemoteClient* process)
     , hash_(0)
 {
   for (auto const& p : process->actors())
-    enabled_processes_.insert(p.copy.getBuffer()->get_pid());
+    enabled_processes_.insert(p.copy.get_buffer()->get_pid());
 
   snapshot_handle_ignore(this);