Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc: create RegionSparse, RegionDense and RegionPrivatized (WIP)
[simgrid.git] / src / mc / sosp / mc_checkpoint.cpp
index 200ee93..1b1ff78 100644 (file)
@@ -75,7 +75,7 @@ static void restore(RegionSnapshot* region)
 
     case simgrid::mc::StorageType::Privatized:
       for (auto& p : region->privatized_data())
-        restore(&p);
+        restore(p.get());
       break;
 
     default: // includes StorageType::NoData
@@ -84,30 +84,6 @@ static void restore(RegionSnapshot* region)
   }
 }
 
-#if HAVE_SMPI
-RegionSnapshot privatized_region(RegionType region_type, void* start_addr, void* permanent_addr, std::size_t size)
-{
-  size_t process_count = MC_smpi_process_count();
-
-  // Read smpi_privatization_regions from MCed:
-  smpi_privatization_region_t remote_smpi_privatization_regions;
-  mc_model_checker->process().read_variable("smpi_privatization_regions", &remote_smpi_privatization_regions,
-                                            sizeof(remote_smpi_privatization_regions));
-  s_smpi_privatization_region_t privatization_regions[process_count];
-  mc_model_checker->process().read_bytes(&privatization_regions, sizeof(privatization_regions),
-                                         remote(remote_smpi_privatization_regions));
-
-  std::vector<RegionSnapshot> data;
-  data.reserve(process_count);
-  for (size_t i = 0; i < process_count; i++)
-    data.push_back(region(region_type, start_addr, privatization_regions[i].address, size));
-
-  RegionSnapshot region = RegionSnapshot(region_type, start_addr, permanent_addr, size);
-  region.privatized_data(std::move(data));
-  return region;
-}
-#endif
-
 static void get_memory_regions(simgrid::mc::RemoteClient* process, simgrid::mc::Snapshot* snapshot)
 {
   snapshot->snapshot_regions_.clear();
@@ -123,15 +99,14 @@ static void get_memory_regions(simgrid::mc::RemoteClient* process, simgrid::mc::
   snapshot->add_region(simgrid::mc::RegionType::Heap, nullptr, start_heap, start_heap,
                        (char*)end_heap - (char*)start_heap);
   snapshot->heap_bytes_used_ = mmalloc_get_bytes_used_remote(heap->heaplimit, process->get_malloc_info());
+  snapshot->privatization_index_ = simgrid::mc::ProcessIndexMissing;
 
 #if HAVE_SMPI
   if (mc_model_checker->process().privatized() && MC_smpi_process_count())
     // snapshot->privatization_index = smpi_loaded_page
     mc_model_checker->process().read_variable("smpi_loaded_page", &snapshot->privatization_index_,
                                               sizeof(snapshot->privatization_index_));
-  else
 #endif
-    snapshot->privatization_index_ = simgrid::mc::ProcessIndexMissing;
 }
 
 /** @brief Fills the position of the segments (executable, read-only, read/write).
@@ -223,8 +198,6 @@ static bool valid_variable(simgrid::mc::Variable* var, simgrid::mc::Frame* scope
 static void fill_local_variables_values(mc_stack_frame_t stack_frame, simgrid::mc::Frame* scope, int process_index,
                                         std::vector<s_local_variable_t>& result)
 {
-  simgrid::mc::RemoteClient* process = &mc_model_checker->process();
-
   if (not scope || not scope->range.contain(stack_frame->ip))
     return;
 
@@ -233,19 +206,11 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame, simgrid::m
     if (not valid_variable(&current_variable, scope, (void*)stack_frame->ip))
       continue;
 
-    int region_type;
-    // FIXME, get rid of `region_type`
-    if ((long)stack_frame->ip > (long)process->libsimgrid_info->start_exec)
-      region_type = 1;
-    else
-      region_type = 2;
-
     s_local_variable_t new_var;
     new_var.subprogram = stack_frame->frame;
     new_var.ip         = stack_frame->ip;
     new_var.name       = current_variable.name;
     new_var.type       = current_variable.type;
-    new_var.region     = region_type;
     new_var.address    = nullptr;
 
     if (current_variable.address != nullptr)