Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Remove compatibility stuff
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 19 May 2015 07:55:35 +0000 (09:55 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Thu, 21 May 2015 09:35:04 +0000 (11:35 +0200)
15 files changed:
src/mc/AddressSpace.hpp
src/mc/mc_base.cpp
src/mc/mc_checkpoint.cpp
src/mc/mc_comm_determinism.cpp
src/mc/mc_compare.cpp
src/mc/mc_diff.cpp
src/mc/mc_dwarf_expression.cpp
src/mc/mc_page_snapshot.cpp
src/mc/mc_process.cpp
src/mc/mc_process.h
src/mc/mc_server.cpp
src/mc/mc_smx.cpp
src/mc/mc_snapshot.cpp
src/mc/mc_snapshot.h
src/mc/mc_unw.cpp

index 8ac72ea..07f18df 100644 (file)
 
 #include "mc_forward.h"
 
 
 #include "mc_forward.h"
 
-// Compatibility stuff, will be removed:
-#define MC_ADDRESS_SPACE_READ_FLAGS_NONE ::simgrid::mc::AddressSpace::Normal
-#define MC_ADDRESS_SPACE_READ_FLAGS_LAZY ::simgrid::mc::AddressSpace::Lazy
-
-// Compatibility stuff, will be removed:
-#define MC_PROCESS_INDEX_MISSING ::simgrid::mc::ProcessIndexMissing
-#define MC_PROCESS_INDEX_DISABLED ::simgrid::mc::ProcessIndexDisabled
-#define MC_PROCESS_INDEX_ANY ::simgrid::mc::ProcessIndexAny
-
 namespace simgrid {
 namespace mc {
 
 namespace simgrid {
 namespace mc {
 
@@ -62,23 +53,11 @@ public:
   {
     static_assert(std::is_trivial<T>::value, "Cannot read a non-trivial type");
     T res;
   {
     static_assert(std::is_trivial<T>::value, "Cannot read a non-trivial type");
     T res;
-    this->read_bytes(&res, sizeof(T), address, process_index);
-    return res;
+    return *(T*)this->read_bytes(&res, sizeof(T), address, process_index);
   }
 };
 
 }
 }
 
   }
 };
 
 }
 }
 
-// Deprecated compatibility wrapper:
-static inline
-const void* MC_address_space_read(
-  mc_address_space_t address_space, simgrid::mc::AddressSpace::ReadMode mode,
-  void* target, const void* addr, size_t size,
-  int process_index)
-{
-  return address_space->read_bytes(target, size, (std::uint64_t) addr,
-    process_index, mode);
-}
-
 #endif
 #endif
index 3f609ab..358ee1d 100644 (file)
@@ -69,9 +69,8 @@ int MC_request_is_enabled(smx_simcall_t req)
 #ifdef HAVE_MC
     // Fetch from MCed memory:
     if (mc_mode == MC_MODE_SERVER) {
 #ifdef HAVE_MC
     // Fetch from MCed memory:
     if (mc_mode == MC_MODE_SERVER) {
-      MC_process_read(&mc_model_checker->process(), MC_ADDRESS_SPACE_READ_FLAGS_NONE,
-        &temp_synchro, act, sizeof(temp_synchro),
-        MC_PROCESS_INDEX_ANY);
+      mc_model_checker->process().read_bytes(
+        &temp_synchro, sizeof(temp_synchro), (std::uint64_t)act);
       act = &temp_synchro;
     }
 #endif
       act = &temp_synchro;
     }
 #endif
@@ -97,8 +96,9 @@ int MC_request_is_enabled(smx_simcall_t req)
     size_t buffer_size = 0;
     if (mc_mode == MC_MODE_SERVER) {
       // Read dynar:
     size_t buffer_size = 0;
     if (mc_mode == MC_MODE_SERVER) {
       // Read dynar:
-      MC_process_read_simple(&mc_model_checker->process(),
-        &comms_buffer, simcall_comm_waitany__get__comms(req), sizeof(comms_buffer));
+      mc_model_checker->process().read_bytes(
+        &comms_buffer, sizeof(comms_buffer),
+        (std::uint64_t)simcall_comm_waitany__get__comms(req));
       assert(comms_buffer.elmsize == sizeof(act));
       buffer_size = comms_buffer.elmsize * comms_buffer.used;
       comms = &comms_buffer;
       assert(comms_buffer.elmsize == sizeof(act));
       buffer_size = comms_buffer.elmsize * comms_buffer.used;
       comms = &comms_buffer;
@@ -108,8 +108,8 @@ int MC_request_is_enabled(smx_simcall_t req)
     // Read all the dynar buffer:
     char buffer[buffer_size];
     if (mc_mode == MC_MODE_SERVER)
     // Read all the dynar buffer:
     char buffer[buffer_size];
     if (mc_mode == MC_MODE_SERVER)
-      MC_process_read_simple(&mc_model_checker->process(),
-        buffer, comms->data, sizeof(buffer));
+      mc_model_checker->process().read_bytes(buffer, sizeof(buffer),
+        (std::uint64_t)comms->data);
 #else
     comms = simcall_comm_waitany__get__comms(req);
 #endif
 #else
     comms = simcall_comm_waitany__get__comms(req);
 #endif
@@ -119,9 +119,8 @@ int MC_request_is_enabled(smx_simcall_t req)
       // Fetch act from MCed memory:
       if (mc_mode == MC_MODE_SERVER) {
         memcpy(&act, buffer + comms->elmsize * index, sizeof(act));
       // Fetch act from MCed memory:
       if (mc_mode == MC_MODE_SERVER) {
         memcpy(&act, buffer + comms->elmsize * index, sizeof(act));
-        MC_process_read(&mc_model_checker->process(), MC_ADDRESS_SPACE_READ_FLAGS_NONE,
-          &temp_synchro, act, sizeof(temp_synchro),
-          MC_PROCESS_INDEX_ANY);
+        mc_model_checker->process().read_bytes(
+          &temp_synchro, sizeof(temp_synchro), (std::uint64_t)act);
         act = &temp_synchro;
       }
       else
         act = &temp_synchro;
       }
       else
@@ -138,9 +137,8 @@ int MC_request_is_enabled(smx_simcall_t req)
 #ifdef HAVE_MC
     s_smx_mutex_t temp_mutex;
     if (mc_mode == MC_MODE_SERVER) {
 #ifdef HAVE_MC
     s_smx_mutex_t temp_mutex;
     if (mc_mode == MC_MODE_SERVER) {
-      MC_process_read(&mc_model_checker->process(), MC_ADDRESS_SPACE_READ_FLAGS_NONE,
-        &temp_mutex, mutex, sizeof(temp_mutex),
-        MC_PROCESS_INDEX_ANY);
+      mc_model_checker->process().read_bytes(
+        &temp_mutex, sizeof(temp_mutex), (std::uint64_t)mutex);
       mutex = &temp_mutex;
     }
 #endif
       mutex = &temp_mutex;
     }
 #endif
index ec0a117..48f67d6 100644 (file)
@@ -112,9 +112,9 @@ static mc_mem_region_t mc_region_new_dense(
   region->permanent_addr = permanent_addr;
   region->size = size;
   region->flat.data = xbt_malloc(size);
   region->permanent_addr = permanent_addr;
   region->size = size;
   region->flat.data = xbt_malloc(size);
-  MC_process_read(&mc_model_checker->process(), MC_ADDRESS_SPACE_READ_FLAGS_NONE,
-    region->flat.data, permanent_addr, size,
-    MC_PROCESS_INDEX_DISABLED);
+  mc_model_checker->process().read_bytes(region->flat.data, size,
+    (std::uint64_t)permanent_addr,
+    simgrid::mc::ProcessIndexDisabled);
   XBT_DEBUG("New region : type : %d, data : %p (real addr %p), size : %zu",
             region_type, region->flat.data, permanent_addr, size);
   return region;
   XBT_DEBUG("New region : type : %d, data : %p (real addr %p), size : %zu",
             region_type, region->flat.data, permanent_addr, size);
   return region;
@@ -189,8 +189,9 @@ static mc_mem_region_t MC_region_new_privatized(
     "smpi_privatisation_regions",
     &remote_smpi_privatisation_regions, sizeof(remote_smpi_privatisation_regions));
   s_smpi_privatisation_region_t privatisation_regions[process_count];
     "smpi_privatisation_regions",
     &remote_smpi_privatisation_regions, sizeof(remote_smpi_privatisation_regions));
   s_smpi_privatisation_region_t privatisation_regions[process_count];
-  MC_process_read_simple(&mc_model_checker->process(), &privatisation_regions,
-    remote_smpi_privatisation_regions, sizeof(privatisation_regions));
+  mc_model_checker->process().read_bytes(
+    &privatisation_regions, sizeof(privatisation_regions),
+    (std::uint64_t)remote_smpi_privatisation_regions);
 
   for (size_t i = 0; i < process_count; i++) {
     region->privatized.regions[i] =
 
   for (size_t i = 0; i < process_count; i++) {
     region->privatized.regions[i] =
@@ -255,7 +256,7 @@ static void MC_get_memory_regions(mc_process_t process, mc_snapshot_t snapshot)
   } else
 #endif
   {
   } else
 #endif
   {
-    snapshot->privatization_index = MC_PROCESS_INDEX_MISSING;
+    snapshot->privatization_index = simgrid::mc::ProcessIndexMissing;
   }
 }
 
   }
 }
 
@@ -508,8 +509,8 @@ static xbt_dynar_t MC_take_snapshot_stacks(mc_snapshot_t * snapshot)
 
     // Read the context from remote process:
     unw_context_t context;
 
     // Read the context from remote process:
     unw_context_t context;
-    MC_process_read_simple(&mc_model_checker->process(),
-      &context, (unw_context_t*) current_stack->context, sizeof(context));
+    mc_model_checker->process().read_bytes(
+      &context, sizeof(context), (std::uint64_t) current_stack->context);
 
     st->context = xbt_new0(s_mc_unw_context_t, 1);
     if (mc_unw_init_context(st->context, &mc_model_checker->process(),
 
     st->context = xbt_new0(s_mc_unw_context_t, 1);
     if (mc_unw_init_context(st->context, &mc_model_checker->process(),
@@ -580,9 +581,9 @@ static void MC_snapshot_handle_ignore(mc_snapshot_t snapshot)
     ignored_data.size = region->size;
     ignored_data.data = malloc(region->size);
     // TODO, we should do this once per privatization segment:
     ignored_data.size = region->size;
     ignored_data.data = malloc(region->size);
     // TODO, we should do this once per privatization segment:
-    MC_process_read(snapshot->process,
-      MC_ADDRESS_SPACE_READ_FLAGS_NONE,
-      ignored_data.data, region->addr, region->size, MC_PROCESS_INDEX_DISABLED);
+    snapshot->process->read_bytes(
+      ignored_data.data, region->size, (std::uint64_t) region->addr,
+      simgrid::mc::ProcessIndexDisabled);
     xbt_dynar_push(snapshot->ignored_data, &ignored_data);
   }
 
     xbt_dynar_push(snapshot->ignored_data, &ignored_data);
   }
 
index eb87892..20236c1 100644 (file)
@@ -91,8 +91,8 @@ static char* print_determinism_result(e_mc_comm_pattern_difference_t diff, int p
 static void update_comm_pattern(mc_comm_pattern_t comm_pattern, smx_synchro_t comm_addr)
 {
   s_smx_synchro_t comm;
 static void update_comm_pattern(mc_comm_pattern_t comm_pattern, smx_synchro_t comm_addr)
 {
   s_smx_synchro_t comm;
-  MC_process_read_simple(&mc_model_checker->process(),
-    &comm, comm_addr, sizeof(comm));
+  mc_model_checker->process().read_bytes(
+    &comm, sizeof(comm), (std::uint64_t)comm_addr);
 
   smx_process_t src_proc = MC_smx_resolve_process(comm.comm.src_proc);
   smx_process_t dst_proc = MC_smx_resolve_process(comm.comm.dst_proc);
 
   smx_process_t src_proc = MC_smx_resolve_process(comm.comm.src_proc);
   smx_process_t dst_proc = MC_smx_resolve_process(comm.comm.dst_proc);
@@ -102,12 +102,13 @@ static void update_comm_pattern(mc_comm_pattern_t comm_pattern, smx_synchro_t co
   comm_pattern->dst_host = MC_smx_process_get_host_name(dst_proc);
   if (comm_pattern->data_size == -1 && comm.comm.src_buff != NULL) {
     size_t buff_size;
   comm_pattern->dst_host = MC_smx_process_get_host_name(dst_proc);
   if (comm_pattern->data_size == -1 && comm.comm.src_buff != NULL) {
     size_t buff_size;
-    MC_process_read_simple(&mc_model_checker->process(),
-      &buff_size, comm.comm.dst_buff_size, sizeof(buff_size));
+    mc_model_checker->process().read_bytes(
+      &buff_size, sizeof(buff_size), (std::uint64_t)comm.comm.dst_buff_size);
     comm_pattern->data_size = buff_size;
     comm_pattern->data = xbt_malloc0(comm_pattern->data_size);
     comm_pattern->data_size = buff_size;
     comm_pattern->data = xbt_malloc0(comm_pattern->data_size);
-    MC_process_read_simple(&mc_model_checker->process(),
-      comm_pattern->data, comm.comm.src_buff, comm_pattern->data_size);
+    mc_model_checker->process().read_bytes(
+      comm_pattern->data, comm_pattern->data_size,
+      (std::uint64_t) comm.comm.src_buff);
   }
 }
 
   }
 }
 
@@ -184,30 +185,26 @@ void MC_get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type
     pattern->type = SIMIX_COMM_SEND;
     pattern->comm_addr = simcall_comm_isend__get__result(request);
 
     pattern->type = SIMIX_COMM_SEND;
     pattern->comm_addr = simcall_comm_isend__get__result(request);
 
-    s_smx_synchro_t synchro;
-    MC_process_read_simple(&mc_model_checker->process(),
-      &synchro, pattern->comm_addr, sizeof(synchro));
+    s_smx_synchro_t synchro = mc_model_checker->process().read<s_smx_synchro_t>(
+      (std::uint64_t) pattern->comm_addr);
 
 
-    char* remote_name;
-    MC_process_read_simple(&mc_model_checker->process(), &remote_name,
-      synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name,
-      sizeof(remote_name));
+    char* remote_name = mc_model_checker->process().read<char*>(
+      (std::uint64_t)(synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name));
     pattern->rdv =
       MC_process_read_string(&mc_model_checker->process(), remote_name);
     pattern->src_proc = MC_smx_resolve_process(synchro.comm.src_proc)->pid;
     pattern->src_host = MC_smx_process_get_host_name(issuer);
 
     pattern->rdv =
       MC_process_read_string(&mc_model_checker->process(), remote_name);
     pattern->src_proc = MC_smx_resolve_process(synchro.comm.src_proc)->pid;
     pattern->src_host = MC_smx_process_get_host_name(issuer);
 
-    struct s_smpi_mpi_request mpi_request;
-    MC_process_read_simple(&mc_model_checker->process(),
-      &mpi_request, (MPI_Request) simcall_comm_isend__get__data(request),
-      sizeof(mpi_request));
+    struct s_smpi_mpi_request mpi_request =
+      mc_model_checker->process().read<s_smpi_mpi_request>(
+        (std::uint64_t) simcall_comm_isend__get__data(request));
     pattern->tag = mpi_request.tag;
 
     if(synchro.comm.src_buff != NULL){
       pattern->data_size = synchro.comm.src_buff_size;
       pattern->data = xbt_malloc0(pattern->data_size);
     pattern->tag = mpi_request.tag;
 
     if(synchro.comm.src_buff != NULL){
       pattern->data_size = synchro.comm.src_buff_size;
       pattern->data = xbt_malloc0(pattern->data_size);
-      MC_process_read_simple(&mc_model_checker->process(),
-        pattern->data, synchro.comm.src_buff, pattern->data_size);
+      mc_model_checker->process().read_bytes(
+        pattern->data, pattern->data_size, (std::uint64_t)synchro.comm.src_buff);
     }
     if(mpi_request.detached){
       if (!initial_global_state->initial_communications_pattern_done) {
     }
     if(mpi_request.detached){
       if (!initial_global_state->initial_communications_pattern_done) {
@@ -231,19 +228,19 @@ void MC_get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type
     pattern->comm_addr = simcall_comm_irecv__get__result(request);
 
     struct s_smpi_mpi_request mpi_request;
     pattern->comm_addr = simcall_comm_irecv__get__result(request);
 
     struct s_smpi_mpi_request mpi_request;
-    MC_process_read_simple(&mc_model_checker->process(),
-      &mpi_request, (MPI_Request) simcall_comm_irecv__get__data(request),
-      sizeof(mpi_request));
+    mc_model_checker->process().read_bytes(
+      &mpi_request, sizeof(mpi_request),
+      (std::uint64_t) simcall_comm_irecv__get__data(request));
     pattern->tag = mpi_request.tag;
 
     s_smx_synchro_t synchro;
     pattern->tag = mpi_request.tag;
 
     s_smx_synchro_t synchro;
-    MC_process_read_simple(&mc_model_checker->process(),
-      &synchro, pattern->comm_addr, sizeof(synchro));
+    mc_model_checker->process().read_bytes(
+      &synchro, sizeof(synchro), (std::uint64_t)pattern->comm_addr);
 
     char* remote_name;
 
     char* remote_name;
-    MC_process_read_simple(&mc_model_checker->process(), &remote_name,
-      synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name,
-      sizeof(remote_name));
+    mc_model_checker->process().read_bytes(
+      &remote_name, sizeof(remote_name),
+      (std::uint64_t)(synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name));
     pattern->rdv =
       MC_process_read_string(&mc_model_checker->process(), remote_name);
     pattern->dst_proc = MC_smx_resolve_process(synchro.comm.dst_proc)->pid;
     pattern->rdv =
       MC_process_read_string(&mc_model_checker->process(), remote_name);
     pattern->dst_proc = MC_smx_resolve_process(synchro.comm.dst_proc)->pid;
index fd01c58..3374e5c 100644 (file)
@@ -492,14 +492,14 @@ int snapshot_compare(void *state1, void *state2)
 #endif
 
   /* Init heap information used in heap comparison algorithm */
 #endif
 
   /* Init heap information used in heap comparison algorithm */
-  xbt_mheap_t heap1 = (xbt_mheap_t) MC_snapshot_read(
-    s1, MC_ADDRESS_SPACE_READ_FLAGS_LAZY,
-    alloca(sizeof(struct mdesc)), process->heap_address, sizeof(struct mdesc),
-    MC_PROCESS_INDEX_MISSING);
-  xbt_mheap_t heap2 = (xbt_mheap_t) MC_snapshot_read(
-    s2, MC_ADDRESS_SPACE_READ_FLAGS_LAZY,
-    alloca(sizeof(struct mdesc)), process->heap_address, sizeof(struct mdesc),
-    MC_PROCESS_INDEX_MISSING);
+  xbt_mheap_t heap1 = (xbt_mheap_t)s1->read_bytes(
+    alloca(sizeof(struct mdesc)), sizeof(struct mdesc),
+    (std::uint64_t)process->heap_address,
+    simgrid::mc::ProcessIndexMissing, simgrid::mc::AddressSpace::Lazy);
+  xbt_mheap_t heap2 = (xbt_mheap_t)s2->read_bytes(
+    alloca(sizeof(struct mdesc)), sizeof(struct mdesc),
+    (std::uint64_t)process->heap_address,
+    simgrid::mc::ProcessIndexMissing, simgrid::mc::AddressSpace::Lazy);
   res_init = init_heap_information(heap1, heap2, s1->to_ignore, s2->to_ignore);
   if (res_init == -1) {
 #ifdef MC_DEBUG
   res_init = init_heap_information(heap1, heap2, s1->to_ignore, s2->to_ignore);
   if (res_init == -1) {
 #ifdef MC_DEBUG
@@ -604,7 +604,7 @@ int snapshot_compare(void *state1, void *state2)
 
     /* Compare global variables */
     is_diff =
 
     /* Compare global variables */
     is_diff =
-      compare_global_variables(region1->object_info, MC_ADDRESS_SPACE_READ_FLAGS_NONE,
+      compare_global_variables(region1->object_info, simgrid::mc::AddressSpace::Normal,
         region1, region2,
         s1, s2);
 
         region1, region2,
         s1, s2);
 
index 3773c00..dd2a16f 100644 (file)
@@ -451,8 +451,10 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
   void* heapinfo_address = &((xbt_mheap_t) process->heap_address)->heapinfo;
 
   // This is in snapshot do not use them directly:
   void* heapinfo_address = &((xbt_mheap_t) process->heap_address)->heapinfo;
 
   // This is in snapshot do not use them directly:
-  const malloc_info* heapinfos1 = (const malloc_info*) MC_snapshot_read_pointer(snapshot1, heapinfo_address, MC_PROCESS_INDEX_MISSING);
-  const malloc_info* heapinfos2 = (const malloc_info*) MC_snapshot_read_pointer(snapshot2, heapinfo_address, MC_PROCESS_INDEX_MISSING);
+  const malloc_info* heapinfos1 = snapshot1->read<malloc_info*>(
+    (std::uint64_t)heapinfo_address, simgrid::mc::ProcessIndexMissing);
+  const malloc_info* heapinfos2 = snapshot2->read<malloc_info*>(
+    (std::uint64_t)heapinfo_address, simgrid::mc::ProcessIndexMissing);
 
   while (i1 <= state->heaplimit) {
 
 
   while (i1 <= state->heaplimit) {
 
@@ -502,7 +504,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
                          (char *) state->std_heap_copy.heapbase;
 
           res_compare =
                          (char *) state->std_heap_copy.heapbase;
 
           res_compare =
-              compare_heap_area(MC_PROCESS_INDEX_MISSING, addr_block1, addr_block2, snapshot1, snapshot2,
+              compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_block1, addr_block2, snapshot1, snapshot2,
                                 NULL, NULL, 0);
 
           if (res_compare != 1) {
                                 NULL, NULL, 0);
 
           if (res_compare != 1) {
@@ -541,7 +543,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
         }
 
         res_compare =
         }
 
         res_compare =
-            compare_heap_area(MC_PROCESS_INDEX_MISSING, addr_block1, addr_block2, snapshot1, snapshot2,
+            compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_block1, addr_block2, snapshot1, snapshot2,
                               NULL, NULL, 0);
 
         if (res_compare != 1) {
                               NULL, NULL, 0);
 
         if (res_compare != 1) {
@@ -593,7 +595,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
                           (j1 << heapinfo2->type));
 
             res_compare =
                           (j1 << heapinfo2->type));
 
             res_compare =
-                compare_heap_area(MC_PROCESS_INDEX_MISSING, addr_frag1, addr_frag2, snapshot1, snapshot2,
+                compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_frag1, addr_frag2, snapshot1, snapshot2,
                                   NULL, NULL, 0);
 
             if (res_compare != 1)
                                   NULL, NULL, 0);
 
             if (res_compare != 1)
@@ -641,7 +643,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2)
                           (j2 << heapinfo2b->type));
 
             res_compare =
                           (j2 << heapinfo2b->type));
 
             res_compare =
-                compare_heap_area(MC_PROCESS_INDEX_MISSING, addr_frag1, addr_frag2, snapshot2, snapshot2,
+                compare_heap_area(simgrid::mc::ProcessIndexMissing, addr_frag1, addr_frag2, snapshot2, snapshot2,
                                   NULL, NULL, 0);
 
             if (res_compare != 1) {
                                   NULL, NULL, 0);
 
             if (res_compare != 1) {
index 3d2bc36..c10df75 100644 (file)
@@ -404,10 +404,9 @@ int mc_dwarf_execute_expression(size_t n, const Dwarf_Op * ops,
         uintptr_t address = (uintptr_t) state->stack[state->stack_size - 1];
         if (!state->address_space)
           xbt_die("Missing address space");
         uintptr_t address = (uintptr_t) state->stack[state->stack_size - 1];
         if (!state->address_space)
           xbt_die("Missing address space");
-        MC_address_space_read(
-          state->address_space, MC_ADDRESS_SPACE_READ_FLAGS_NONE,
-          &state->stack[state->stack_size - 1], (const void*) address,
-          sizeof(uintptr_t), state->process_index);
+        state->address_space->read_bytes(
+          &state->stack[state->stack_size - 1], sizeof(uintptr_t),
+          address, state->process_index);
       }
       break;
 
       }
       break;
 
index 72d71c1..eaaacad 100644 (file)
@@ -53,8 +53,9 @@ size_t* mc_take_page_snapshot_region(mc_process_t process,
             - move the segments in shared memory (this will break `fork` however).
         */
         page_data = temp;
             - move the segments in shared memory (this will break `fork` however).
         */
         page_data = temp;
-        MC_process_read(process, MC_ADDRESS_SPACE_READ_FLAGS_NONE,
-          temp, page, xbt_pagesize, MC_PROCESS_INDEX_DISABLED);
+        process->read_bytes(
+          temp, xbt_pagesize, (std::uint64_t) page,
+          simgrid::mc::ProcessIndexDisabled);
       }
       pagenos[i] = mc_model_checker->page_store().store_page(page_data);
 
       }
       pagenos[i] = mc_model_checker->page_store().store_page(page_data);
 
index cad5f36..5372a63 100644 (file)
@@ -83,9 +83,9 @@ Process::Process(pid_t pid, int sockfd)
     xbt_die("No heap information in the target process");
   if(!std_heap_var->address)
     xbt_die("No constant address for this variable");
     xbt_die("No heap information in the target process");
   if(!std_heap_var->address)
     xbt_die("No constant address for this variable");
-  MC_process_read(process, MC_ADDRESS_SPACE_READ_FLAGS_NONE,
+  MC_process_read(process, simgrid::mc::AddressSpace::Normal,
     &process->heap_address, std_heap_var->address, sizeof(struct mdesc*),
     &process->heap_address, std_heap_var->address, sizeof(struct mdesc*),
-    MC_PROCESS_INDEX_DISABLED);
+    simgrid::mc::ProcessIndexDisabled);
 
   process->smx_process_infos = MC_smx_process_info_list_new();
   process->smx_old_process_infos = MC_smx_process_info_list_new();
 
   process->smx_process_infos = MC_smx_process_info_list_new();
   process->smx_old_process_infos = MC_smx_process_info_list_new();
@@ -163,9 +163,9 @@ void MC_process_refresh_heap(mc_process_t process)
   if (!process->heap) {
     process->heap = (struct mdesc*) malloc(sizeof(struct mdesc));
   }
   if (!process->heap) {
     process->heap = (struct mdesc*) malloc(sizeof(struct mdesc));
   }
-  MC_process_read(process, MC_ADDRESS_SPACE_READ_FLAGS_NONE,
+  MC_process_read(process, simgrid::mc::AddressSpace::Normal,
     process->heap, process->heap_address, sizeof(struct mdesc),
     process->heap, process->heap_address, sizeof(struct mdesc),
-    MC_PROCESS_INDEX_DISABLED
+    simgrid::mc::ProcessIndexDisabled
     );
   process->cache_flags |= MC_PROCESS_CACHE_FLAG_HEAP;
 }
     );
   process->cache_flags |= MC_PROCESS_CACHE_FLAG_HEAP;
 }
@@ -180,10 +180,10 @@ void MC_process_refresh_malloc_info(mc_process_t process)
   size_t malloc_info_bytesize =
     (process->heap->heaplimit + 1) * sizeof(malloc_info);
   process->heap_info = (malloc_info*) realloc(process->heap_info, malloc_info_bytesize);
   size_t malloc_info_bytesize =
     (process->heap->heaplimit + 1) * sizeof(malloc_info);
   process->heap_info = (malloc_info*) realloc(process->heap_info, malloc_info_bytesize);
-  MC_process_read(process, MC_ADDRESS_SPACE_READ_FLAGS_NONE,
+  MC_process_read(process, simgrid::mc::AddressSpace::Normal,
     process->heap_info,
     process->heap->heapinfo, malloc_info_bytesize,
     process->heap_info,
     process->heap->heapinfo, malloc_info_bytesize,
-    MC_PROCESS_INDEX_DISABLED);
+    simgrid::mc::ProcessIndexDisabled);
   process->cache_flags |= MC_PROCESS_CACHE_FLAG_MALLOC_INFO;
 }
 
   process->cache_flags |= MC_PROCESS_CACHE_FLAG_MALLOC_INFO;
 }
 
@@ -419,8 +419,8 @@ void MC_process_read_variable(mc_process_t process, const char* name, void* targ
   if ((size_t) var->type->full_type->byte_size != size)
     xbt_die("Unexpected size for %s (expected %zi, was %zi)",
       name, size, (size_t) var->type->full_type->byte_size);
   if ((size_t) var->type->full_type->byte_size != size)
     xbt_die("Unexpected size for %s (expected %zi, was %zi)",
       name, size, (size_t) var->type->full_type->byte_size);
-  MC_process_read(process, MC_ADDRESS_SPACE_READ_FLAGS_NONE, target, var->address, size,
-    MC_PROCESS_INDEX_ANY);
+  MC_process_read(process, simgrid::mc::AddressSpace::Normal, target, var->address, size,
+    simgrid::mc::ProcessIndexAny);
 }
 
 char* MC_process_read_string(mc_process_t process, void* address)
 }
 
 char* MC_process_read_string(mc_process_t process, void* address)
@@ -529,7 +529,7 @@ const void *Process::read_bytes(void* buffer, std::size_t size,
   std::uint64_t address, int process_index,
   AddressSpace::ReadMode mode)
 {
   std::uint64_t address, int process_index,
   AddressSpace::ReadMode mode)
 {
-  if (process_index != MC_PROCESS_INDEX_DISABLED) {
+  if (process_index != simgrid::mc::ProcessIndexDisabled) {
     mc_object_info_t info = MC_process_find_object_info_rw(this, (void*)address);
     // Segment overlap is not handled.
     if (MC_object_info_is_privatized(info)) {
     mc_object_info_t info = MC_process_find_object_info_rw(this, (void*)address);
     // Segment overlap is not handled.
     if (MC_object_info_is_privatized(info)) {
@@ -543,7 +543,7 @@ const void *Process::read_bytes(void* buffer, std::size_t size,
   }
 
   if (MC_process_is_self(this)) {
   }
 
   if (MC_process_is_self(this)) {
-    if (mode == MC_ADDRESS_SPACE_READ_FLAGS_LAZY)
+    if (mode == simgrid::mc::AddressSpace::Lazy)
       return (void*)address;
     else {
       memcpy(buffer, (void*)address, size);
       return (void*)address;
     else {
       memcpy(buffer, (void*)address, size);
@@ -561,15 +561,6 @@ const void *Process::read_bytes(void* buffer, std::size_t size,
 
 extern "C" {
 
 
 extern "C" {
 
-const void* MC_process_read_simple(mc_process_t process,
-  void* local, const void* remote, size_t len)
-{
-  simgrid::mc::AddressSpace::ReadMode mode = MC_ADDRESS_SPACE_READ_FLAGS_NONE;
-  int index = MC_PROCESS_INDEX_ANY;
-   MC_process_read(process, mode, local, remote, len, index);
-   return local;
-}
-
 const void* MC_process_read_dynar_element(mc_process_t process,
   void* local, const void* remote_dynar, size_t i, size_t len)
 {
 const void* MC_process_read_dynar_element(mc_process_t process,
   void* local, const void* remote_dynar, size_t i, size_t len)
 {
index 53aa8d1..19640aa 100644 (file)
@@ -167,8 +167,12 @@ const void* MC_process_read(mc_process_t process,
 }
 
 // Simplified versions/wrappers (whould be moved in mc_address_space):
 }
 
 // Simplified versions/wrappers (whould be moved in mc_address_space):
-XBT_INTERNAL const void* MC_process_read_simple(mc_process_t process,
-  void* local, const void* remote, size_t len);
+static inline const void* MC_process_read_simple(mc_process_t process,
+  void* local, const void* remote, size_t len)
+{
+  return process->read_bytes(local, len, (std::uint64_t)remote);
+}
+
 XBT_INTERNAL const void* MC_process_read_dynar_element(mc_process_t process,
   void* local, const void* remote_dynar, size_t i, size_t len);
 XBT_INTERNAL unsigned long MC_process_read_dynar_length(mc_process_t process,
 XBT_INTERNAL const void* MC_process_read_dynar_element(mc_process_t process,
   void* local, const void* remote_dynar, size_t i, size_t len);
 XBT_INTERNAL unsigned long MC_process_read_dynar_length(mc_process_t process,
index cf45be1..7613b16 100644 (file)
@@ -42,8 +42,8 @@ static int mc_symbol_pointer_callback_evaluate(void* p)
 {
   struct mc_symbol_pointer_callback* callback = (struct mc_symbol_pointer_callback*) p;
   int value;
 {
   struct mc_symbol_pointer_callback* callback = (struct mc_symbol_pointer_callback*) p;
   int value;
-  MC_process_read(callback->process, MC_ADDRESS_SPACE_READ_FLAGS_NONE,
-    &value, callback->value, sizeof(value), MC_PROCESS_INDEX_ANY);
+  MC_process_read(callback->process, simgrid::mc::AddressSpace::Normal,
+    &value, callback->value, sizeof(value), simgrid::mc::ProcessIndexAny);
   return value;
 }
 
   return value;
 }
 
index a859956..6def3fd 100644 (file)
@@ -60,8 +60,8 @@ static void MC_process_refresh_simix_process_list(
 {
   // swag = REMOTE(*simix_global->process_list)
   s_xbt_swag_t swag;
 {
   // swag = REMOTE(*simix_global->process_list)
   s_xbt_swag_t swag;
-  MC_process_read(process, MC_ADDRESS_SPACE_READ_FLAGS_NONE, &swag, remote_swag, sizeof(swag),
-    MC_PROCESS_INDEX_ANY);
+  MC_process_read(process, simgrid::mc::AddressSpace::Normal, &swag, remote_swag, sizeof(swag),
+    simgrid::mc::ProcessIndexAny);
 
   smx_process_t p;
   xbt_dynar_reset(target);
 
   smx_process_t p;
   xbt_dynar_reset(target);
@@ -74,8 +74,8 @@ static void MC_process_refresh_simix_process_list(
     info.address = p;
     info.name = NULL;
     info.hostname = NULL;
     info.address = p;
     info.name = NULL;
     info.hostname = NULL;
-    MC_process_read(process, MC_ADDRESS_SPACE_READ_FLAGS_NONE,
-      &info.copy, p, sizeof(info.copy), MC_PROCESS_INDEX_ANY);
+    MC_process_read(process, simgrid::mc::AddressSpace::Normal,
+      &info.copy, p, sizeof(info.copy), simgrid::mc::ProcessIndexAny);
     xbt_dynar_push(target, &info);
 
     // Lookup next process address:
     xbt_dynar_push(target, &info);
 
     // Lookup next process address:
@@ -99,9 +99,9 @@ void MC_process_smx_refresh(mc_process_t process)
 
   // simix_global = REMOTE(*simix_global)
   s_smx_global_t simix_global;
 
   // simix_global = REMOTE(*simix_global)
   s_smx_global_t simix_global;
-  MC_process_read(process, MC_ADDRESS_SPACE_READ_FLAGS_NONE, &simix_global,
+  MC_process_read(process, simgrid::mc::AddressSpace::Normal, &simix_global,
     simix_global_p, sizeof(simix_global),
     simix_global_p, sizeof(simix_global),
-    MC_PROCESS_INDEX_ANY);
+    simgrid::mc::ProcessIndexAny);
 
   MC_process_refresh_simix_process_list(
     process, process->smx_process_infos, simix_global.process_list);
 
   MC_process_refresh_simix_process_list(
     process, process->smx_process_infos, simix_global.process_list);
index cd0ffaa..857d47d 100644 (file)
@@ -34,7 +34,7 @@ mc_mem_region_t mc_get_snapshot_region(const void* addr, mc_snapshot_t snapshot,
     if (region->storage_type == MC_REGION_STORAGE_TYPE_PRIVATIZED) {
 #ifdef HAVE_SMPI
       // Use the current process index of the snapshot:
     if (region->storage_type == MC_REGION_STORAGE_TYPE_PRIVATIZED) {
 #ifdef HAVE_SMPI
       // Use the current process index of the snapshot:
-      if (process_index == MC_PROCESS_INDEX_DISABLED) {
+      if (process_index == simgrid::mc::ProcessIndexDisabled) {
         process_index = snapshot->privatization_index;
       }
       if (process_index < 0) {
         process_index = snapshot->privatization_index;
       }
       if (process_index < 0) {
index 5bd9d7a..7d5654b 100644 (file)
@@ -302,6 +302,7 @@ const void* MC_snapshot_read(mc_snapshot_t snapshot,
 {
   return snapshot->read_bytes(target, size, (uint64_t)addr, process_index, mode);
 }
 {
   return snapshot->read_bytes(target, size, (uint64_t)addr, process_index, mode);
 }
+
 MC_SHOULD_BE_INTERNAL int MC_snapshot_region_memcmp(
   const void* addr1, mc_mem_region_t region1,
   const void* addr2, mc_mem_region_t region2, size_t size);
 MC_SHOULD_BE_INTERNAL int MC_snapshot_region_memcmp(
   const void* addr1, mc_mem_region_t region1,
   const void* addr2, mc_mem_region_t region2, size_t size);
@@ -313,7 +314,7 @@ static inline __attribute__ ((always_inline))
 const void* MC_snapshot_read_pointer(mc_snapshot_t snapshot, const void* addr, int process_index)
 {
   void* res;
 const void* MC_snapshot_read_pointer(mc_snapshot_t snapshot, const void* addr, int process_index)
 {
   void* res;
-  return *(const void**) MC_snapshot_read(snapshot, MC_ADDRESS_SPACE_READ_FLAGS_LAZY,
+  return *(const void**) MC_snapshot_read(snapshot, simgrid::mc::AddressSpace::Lazy,
     &res, addr, sizeof(void*), process_index);
 }
 
     &res, addr, sizeof(void*), process_index);
 }
 
@@ -336,9 +337,7 @@ const void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot)
 static inline __attribute__((always_inline))
 const void* MC_region_read(mc_mem_region_t region, void* target, const void* addr, size_t size)
 {
 static inline __attribute__((always_inline))
 const void* MC_region_read(mc_mem_region_t region, void* target, const void* addr, size_t size)
 {
-  if (region==NULL)
-    // Should be deprecated:
-    return addr;
+  xbt_assert(region);
 
   uintptr_t offset = (char*) addr - (char*) region->start_addr;
 
 
   uintptr_t offset = (char*) addr - (char*) region->start_addr;
 
index 6c894b6..6df54b8 100644 (file)
@@ -81,9 +81,7 @@ static int access_mem(unw_addr_space_t as,
   mc_unw_context_t context = (mc_unw_context_t) arg;
   if (write)
     return - UNW_EREADONLYREG;
   mc_unw_context_t context = (mc_unw_context_t) arg;
   if (write)
     return - UNW_EREADONLYREG;
-  MC_address_space_read(context->address_space,
-    MC_ADDRESS_SPACE_READ_FLAGS_NONE, valp, (void*) addr, sizeof(unw_word_t), MC_PROCESS_INDEX_ANY);
-  // We don't handle failure gracefully.
+  context->address_space->read_bytes(valp, sizeof(unw_word_t), addr);
   return 0;
 }
 
   return 0;
 }