From 3ac757444f711f90c29cfb1b7d5045cb65c79c2c Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Tue, 2 Jun 2015 13:55:29 +0200 Subject: [PATCH] [mc] Remove mc_region_contain(), use the method instead --- src/mc/mc_compare.cpp | 4 ++-- src/mc/mc_snapshot.cpp | 4 ++-- src/mc/mc_snapshot.h | 10 ++-------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/mc/mc_compare.cpp b/src/mc/mc_compare.cpp index 174b889644..89b495b389 100644 --- a/src/mc/mc_compare.cpp +++ b/src/mc/mc_compare.cpp @@ -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: - 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); diff --git a/src/mc/mc_snapshot.cpp b/src/mc/mc_snapshot.cpp index 89122a387e..08eb1b1bb5 100644 --- a/src/mc/mc_snapshot.cpp +++ b/src/mc/mc_snapshot.cpp @@ -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]; - if (!(region && mc_region_contain(region, addr))) + if (!(region && region->contain(simgrid::mc::remote(addr)))) 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_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)"); diff --git a/src/mc/mc_snapshot.h b/src/mc/mc_snapshot.h index ee42ed6b8e..d6bd33bcd1 100644 --- a/src/mc/mc_snapshot.h +++ b/src/mc/mc_snapshot.h @@ -29,12 +29,6 @@ SG_BEGIN_DECL() 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) { @@ -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) { - 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); @@ -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(); - 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()) { -- 2.20.1