Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Remove mc_region_contain(), use the method instead
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 2 Jun 2015 11:55:29 +0000 (13:55 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 2 Jun 2015 11:55:29 +0000 (13:55 +0200)
src/mc/mc_compare.cpp
src/mc/mc_snapshot.cpp
src/mc/mc_snapshot.h

index 174b889..89b495b 100644 (file)
@@ -208,8 +208,8 @@ static int compare_areas_with_type(struct mc_compare_state& state,
       }
 
       // The pointers are both in the current object R/W segment:
       }
 
       // The pointers are both in the current object R/W segment:
-      else if (mc_region_contain(region1, addr_pointed1)) {
-        if (!mc_region_contain(region2, addr_pointed2))
+      else if (region1->contain(simgrid::mc::remote(addr_pointed1))) {
+        if (!region2->contain(simgrid::mc::remote(addr_pointed2)))
           return 1;
         if (type->dw_type_id == NULL)
           return (addr_pointed1 != addr_pointed2);
           return 1;
         if (type->dw_type_id == NULL)
           return (addr_pointed1 != addr_pointed2);
index 89122a3..08eb1b1 100644 (file)
@@ -29,7 +29,7 @@ mc_mem_region_t mc_get_snapshot_region(
   size_t n = snapshot->snapshot_regions_count;
   for (size_t i = 0; i != n; ++i) {
     mc_mem_region_t region = snapshot->snapshot_regions[i];
   size_t n = snapshot->snapshot_regions_count;
   for (size_t i = 0; i != n; ++i) {
     mc_mem_region_t region = snapshot->snapshot_regions[i];
-    if (!(region && mc_region_contain(region, addr)))
+    if (!(region && region->contain(simgrid::mc::remote(addr))))
       continue;
 
     if (region->storage_type() == simgrid::mc::StorageType::Privatized) {
       continue;
 
     if (region->storage_type() == simgrid::mc::StorageType::Privatized) {
@@ -45,7 +45,7 @@ mc_mem_region_t mc_get_snapshot_region(
         xbt_die("Invalid process index");
       }
       simgrid::mc::RegionSnapshot& priv_region = region->privatized_data()[process_index];
         xbt_die("Invalid process index");
       }
       simgrid::mc::RegionSnapshot& priv_region = region->privatized_data()[process_index];
-      xbt_assert(mc_region_contain(&priv_region, addr));
+      xbt_assert(priv_region.contain(simgrid::mc::remote(addr)));
       return &priv_region;
 #else
       xbt_die("Privatized region in a non SMPI build (this should not happen)");
       return &priv_region;
 #else
       xbt_die("Privatized region in a non SMPI build (this should not happen)");
index ee42ed6..d6bd33b 100644 (file)
@@ -29,12 +29,6 @@ SG_BEGIN_DECL()
 
 XBT_INTERNAL void mc_region_restore_sparse(mc_process_t process, mc_mem_region_t reg);
 
 
 XBT_INTERNAL void mc_region_restore_sparse(mc_process_t process, mc_mem_region_t reg);
 
-static inline  __attribute__ ((always_inline))
-bool mc_region_contain(mc_mem_region_t region, const void* p)
-{
-  return region->contain(simgrid::mc::remote(p));
-}
-
 static inline __attribute__((always_inline))
 void* mc_translate_address_region_chunked(uintptr_t addr, mc_mem_region_t region)
 {
 static inline __attribute__((always_inline))
 void* mc_translate_address_region_chunked(uintptr_t addr, mc_mem_region_t region)
 {
@@ -133,7 +127,7 @@ extern "C" {
 static inline __attribute__ ((always_inline))
 mc_mem_region_t mc_get_region_hinted(void* addr, mc_snapshot_t snapshot, int process_index, mc_mem_region_t region)
 {
 static inline __attribute__ ((always_inline))
 mc_mem_region_t mc_get_region_hinted(void* addr, mc_snapshot_t snapshot, int process_index, mc_mem_region_t region)
 {
-  if (mc_region_contain(region, addr))
+  if (region->contain(simgrid::mc::remote(addr)))
     return region;
   else
     return mc_get_snapshot_region(addr, snapshot, process_index);
     return region;
   else
     return mc_get_snapshot_region(addr, snapshot, process_index);
@@ -213,7 +207,7 @@ const void* MC_region_read(mc_mem_region_t region, void* target, const void* add
 
   uintptr_t offset = (uintptr_t) addr - (uintptr_t) region->start().address();
 
 
   uintptr_t offset = (uintptr_t) addr - (uintptr_t) region->start().address();
 
-  xbt_assert(mc_region_contain(region, addr),
+  xbt_assert(region->contain(simgrid::mc::remote(addr)),
     "Trying to read out of the region boundary.");
 
   switch (region->storage_type()) {
     "Trying to read out of the region boundary.");
 
   switch (region->storage_type()) {