From a816142ba29faddef700304e151716780d431d20 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Thu, 15 Oct 2015 15:35:39 +0200 Subject: [PATCH] [mc] Add std:: namespace for some types --- src/mc/PageStore.hpp | 6 +++--- src/mc/RegionSnapshot.hpp | 10 +++++----- src/mc/mc_checkpoint.cpp | 16 ++++++++++------ src/mc/mc_diff.cpp | 6 +++--- src/mc/mc_protocol.cpp | 2 +- src/mc/mc_snapshot.h | 18 ++++++++++-------- 6 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/mc/PageStore.hpp b/src/mc/PageStore.hpp index 4e2e53e50b..36c90d002c 100644 --- a/src/mc/PageStore.hpp +++ b/src/mc/PageStore.hpp @@ -131,10 +131,10 @@ public: // Methods * changed since the previous cnapshot/restoration and we can avoid * hashing the page, comparing byte-per-byte to candidates. * */ - void ref_page(std::size_t pageno); + void ref_page(size_t pageno); /** @brief Store a page in the page store */ - size_t store_page(void* page); + std::size_t store_page(void* page); /** @brief Get a page from its page number * @@ -184,7 +184,7 @@ std::size_t PageStore::get_ref(std::size_t pageno) } inline __attribute__((always_inline)) -size_t PageStore::size() { +std::size_t PageStore::size() { return this->top_index_ - this->free_pages_.size(); } diff --git a/src/mc/RegionSnapshot.hpp b/src/mc/RegionSnapshot.hpp index 11ba6f8ea5..9a9b219177 100644 --- a/src/mc/RegionSnapshot.hpp +++ b/src/mc/RegionSnapshot.hpp @@ -84,7 +84,7 @@ private: void *start_addr_; /** @brief Size of the data region in bytes */ - size_t size_; + std::size_t size_; /** @brief Permanent virtual address of the region * @@ -224,14 +224,14 @@ public: }; RegionSnapshot privatized_region( - RegionType type, void *start_addr, void* data_addr, size_t size); + RegionType type, void *start_addr, void* data_addr, std::size_t size); RegionSnapshot dense_region( - RegionType type, void *start_addr, void* data_addr, size_t size); + RegionType type, void *start_addr, void* data_addr, std::size_t size); simgrid::mc::RegionSnapshot sparse_region( - RegionType type, void *start_addr, void* data_addr, size_t size, + RegionType type, void *start_addr, void* data_addr, std::size_t size, RegionSnapshot const* ref_region); simgrid::mc::RegionSnapshot region( - RegionType type, void *start_addr, void* data_addr, size_t size, + RegionType type, void *start_addr, void* data_addr, std::size_t size, RegionSnapshot const* ref_region); } diff --git a/src/mc/mc_checkpoint.cpp b/src/mc/mc_checkpoint.cpp index 746d20b115..4360d0648b 100644 --- a/src/mc/mc_checkpoint.cpp +++ b/src/mc/mc_checkpoint.cpp @@ -85,8 +85,8 @@ namespace mc { #ifdef HAVE_SMPI simgrid::mc::RegionSnapshot privatized_region( - RegionType region_type, void *start_addr, void* permanent_addr, size_t size, - const simgrid::mc::RegionSnapshot* ref_region + RegionType region_type, void *start_addr, void* permanent_addr, + std::size_t size, const simgrid::mc::RegionSnapshot* ref_region ) { size_t process_count = MC_smpi_process_count(); @@ -126,7 +126,8 @@ extern "C" { static void MC_snapshot_add_region(int index, mc_snapshot_t snapshot, simgrid::mc::RegionType type, simgrid::mc::ObjectInformation* object_info, - void *start_addr, void* permanent_addr, size_t size) + void *start_addr, void* permanent_addr, + std::size_t size) { if (type == simgrid::mc::RegionType::Data) xbt_assert(object_info, "Missing object info for object."); @@ -196,7 +197,8 @@ static void MC_get_memory_regions(simgrid::mc::Process* process, mc_snapshot_t s * `dl_iterate_phdr` would be more robust but would not work in cross-process. * */ void MC_find_object_address( - std::vector const& maps, simgrid::mc::ObjectInformation* result) + std::vector const& maps, + simgrid::mc::ObjectInformation* result) { char* file_name = xbt_strdup(result->file_name.c_str()); const char *name = basename(file_name); @@ -261,7 +263,8 @@ void MC_find_object_address( * \param ip Instruction pointer * \return true if the variable is valid * */ -static bool mc_valid_variable(simgrid::mc::Variable* var, simgrid::mc::Frame* scope, +static bool mc_valid_variable(simgrid::mc::Variable* var, + simgrid::mc::Frame* scope, const void *ip) { // The variable is not yet valid: @@ -272,7 +275,8 @@ static bool mc_valid_variable(simgrid::mc::Variable* var, simgrid::mc::Frame* sc } static void mc_fill_local_variables_values(mc_stack_frame_t stack_frame, - simgrid::mc::Frame* scope, int process_index, + simgrid::mc::Frame* scope, + int process_index, std::vector& result) { simgrid::mc::Process* process = &mc_model_checker->process(); diff --git a/src/mc/mc_diff.cpp b/src/mc/mc_diff.cpp index 50e58cd31c..7b7ecb7f56 100644 --- a/src/mc/mc_diff.cpp +++ b/src/mc/mc_diff.cpp @@ -34,15 +34,15 @@ typedef char *type_name; struct XBT_PRIVATE s_mc_diff { s_xbt_mheap_t std_heap_copy; - size_t heaplimit; + std::size_t heaplimit; // Number of blocks in the heaps: - size_t heapsize1, heapsize2; + std::size_t heapsize1, heapsize2; std::vector* to_ignore1; std::vector* to_ignore2; s_heap_area_t *equals_to1, *equals_to2; simgrid::mc::Type **types1; simgrid::mc::Type **types2; - size_t available; + std::size_t available; }; #define equals_to1_(i,j) equals_to1[ MAX_FRAGMENT_PER_BLOCK*(i) + (j)] diff --git a/src/mc/mc_protocol.cpp b/src/mc/mc_protocol.cpp index 09b3227a99..325b43320b 100644 --- a/src/mc/mc_protocol.cpp +++ b/src/mc/mc_protocol.cpp @@ -19,7 +19,7 @@ extern "C" { XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_protocol, mc, "Generic MC protocol logic"); -int MC_protocol_send(int socket, const void* message, size_t size) +int MC_protocol_send(int socket, const void* message, std::size_t size) { XBT_DEBUG("Protocol [%s] send %s", MC_mode_name(mc_mode), diff --git a/src/mc/mc_snapshot.h b/src/mc/mc_snapshot.h index 6977237cf9..239d26d6aa 100644 --- a/src/mc/mc_snapshot.h +++ b/src/mc/mc_snapshot.h @@ -149,14 +149,14 @@ public: ReadMode mode = Normal) const override; public: // To be private int num_state; - size_t heap_bytes_used; + std::size_t heap_bytes_used; std::vector> snapshot_regions; std::set enabled_processes; int privatization_index; - std::vector stack_sizes; + std::vector stack_sizes; std::vector stacks; std::vector to_ignore; - uint64_t hash; + std::uint64_t hash; std::vector ignored_data; std::vector current_fds; }; @@ -185,14 +185,14 @@ XBT_PRIVATE void mc_restore_page_snapshot_region( void* start_addr, simgrid::mc::ChunkedData const& pagenos); const void* MC_region_read_fragmented( - mc_mem_region_t region, void* target, const void* addr, size_t size); + mc_mem_region_t region, void* target, const void* addr, std::size_t size); int MC_snapshot_region_memcmp( const void* addr1, mc_mem_region_t region1, - const void* addr2, mc_mem_region_t region2, size_t size); + const void* addr2, mc_mem_region_t region2, std::size_t size); XBT_PRIVATE int MC_snapshot_memcmp( const void* addr1, mc_snapshot_t snapshot1, - const void* addr2, mc_snapshot_t snapshot2, int process_index, size_t size); + const void* addr2, mc_snapshot_t snapshot2, int process_index, std::size_t size); static inline __attribute__ ((always_inline)) const void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot) @@ -211,11 +211,13 @@ const void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot) * @return Pointer where the data is located (target buffer of original location) */ static inline __attribute__((always_inline)) -const void* MC_region_read(mc_mem_region_t region, void* target, const void* addr, size_t size) +const void* MC_region_read( + mc_mem_region_t region, void* target, const void* addr, std::size_t size) { xbt_assert(region); - uintptr_t offset = (uintptr_t) addr - (uintptr_t) region->start().address(); + std::uintptr_t offset = + (std::uintptr_t) addr - (std::uintptr_t) region->start().address(); xbt_assert(region->contain(simgrid::mc::remote(addr)), "Trying to read out of the region boundary."); -- 2.20.1