Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Move stacks_areas code in mcer_ignore
authorGabriel Corona <gabriel.corona@loria.fr>
Mon, 27 Apr 2015 10:58:15 +0000 (12:58 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 28 Apr 2015 06:55:36 +0000 (08:55 +0200)
src/include/mc/mc.h
src/mc/mc_ignore.cpp
src/mc/mcer_ignore.cpp
src/simix/smx_context_sysv.c

index 7cce56c..a4d5c27 100644 (file)
@@ -83,7 +83,7 @@ XBT_PUBLIC(void) MC_ignore_heap(void *address, size_t size);
 XBT_PUBLIC(void) MC_remove_ignore_heap(void *address, size_t size);
 XBT_PUBLIC(void) MC_ignore_local_variable(const char *var_name, const char *frame);
 XBT_PUBLIC(void) MC_ignore_global_variable(const char *var_name);
 XBT_PUBLIC(void) MC_remove_ignore_heap(void *address, size_t size);
 XBT_PUBLIC(void) MC_ignore_local_variable(const char *var_name, const char *frame);
 XBT_PUBLIC(void) MC_ignore_global_variable(const char *var_name);
-XBT_PUBLIC(void) MC_new_stack_area(void *stack, smx_process_t process, void *context, size_t size);
+XBT_PUBLIC(void) MC_register_stack_area(void *stack, smx_process_t process, void *context, size_t size);
 
 /********************************* Memory *************************************/
 XBT_PUBLIC(void) MC_memory_init(void);  /* Initialize the memory subsystem */
 
 /********************************* Memory *************************************/
 XBT_PUBLIC(void) MC_memory_init(void);  /* Initialize the memory subsystem */
index a9f49f2..250c9e4 100644 (file)
@@ -67,17 +67,6 @@ void MC_ignore_global_variable(const char *name)
   xbt_die("Unimplemented");
 }
 
   xbt_die("Unimplemented");
 }
 
-// *****
-
-extern xbt_dynar_t stacks_areas;
-
-void MC_stack_area_add(stack_region_t stack_area)
-{
-  if (stacks_areas == NULL)
-    stacks_areas = xbt_dynar_new(sizeof(stack_region_t), NULL);
-  xbt_dynar_push(stacks_areas, &stack_area);
-}
-
 /** @brief Register a stack in the model checker
  *
  *  The stacks are allocated in the heap. The MC handle them especially
 /** @brief Register a stack in the model checker
  *
  *  The stacks are allocated in the heap. The MC handle them especially
@@ -89,34 +78,30 @@ void MC_stack_area_add(stack_region_t stack_area)
  *  @param context
  *  @param size    Size of the stack
  */
  *  @param context
  *  @param size    Size of the stack
  */
-void MC_new_stack_area(void *stack, smx_process_t process, void *context, size_t size)
+void MC_register_stack_area(void *stack, smx_process_t process, void *context, size_t size)
 {
 {
-  xbt_mheap_t heap = mmalloc_set_current_heap(mc_heap);
+  if (mc_mode != MC_MODE_CLIENT)
+    return;
 
 
-  stack_region_t region = xbt_new0(s_stack_region_t, 1);
-  region->address = stack;
-  region->context = context;
-  region->size = size;
-  region->block =
+  s_stack_region_t region;
+  memset(&region, 0, sizeof(region));
+  region.address = stack;
+  region.context = context;
+  region.size = size;
+  region.block =
       ((char *) stack -
        (char *) std_heap->heapbase) / BLOCKSIZE + 1;
 #ifdef HAVE_SMPI
   if (smpi_privatize_global_variables && process) {
       ((char *) stack -
        (char *) std_heap->heapbase) / BLOCKSIZE + 1;
 #ifdef HAVE_SMPI
   if (smpi_privatize_global_variables && process) {
-    region->process_index = smpi_process_index_of_smx_process(process);
+    region.process_index = smpi_process_index_of_smx_process(process);
   } else
 #endif
   } else
 #endif
-  region->process_index = -1;
+  region.process_index = -1;
 
 
-  if (mc_mode == MC_MODE_CLIENT) {
-    s_mc_stack_region_message_t message;
-    message.type = MC_MESSAGE_STACK_REGION;
-    message.stack_region = *region;
-    MC_client_send_message(&message, sizeof(message));
-  }
-
-  MC_stack_area_add(region);
-
-  mmalloc_set_current_heap(heap);
+  s_mc_stack_region_message_t message;
+  message.type = MC_MESSAGE_STACK_REGION;
+  message.stack_region = region;
+  MC_client_send_message(&message, sizeof(message));
 }
 
 }
 }
 
 }
index 7e04041..3e8b3bf 100644 (file)
@@ -316,4 +316,13 @@ void MC_process_ignore_memory(mc_process_t process, void *addr, size_t size)
   }
 }
 
   }
 }
 
+extern xbt_dynar_t stacks_areas;
+
+void MC_stack_area_add(stack_region_t stack_area)
+{
+  if (stacks_areas == NULL)
+    stacks_areas = xbt_dynar_new(sizeof(stack_region_t), NULL);
+  xbt_dynar_push(stacks_areas, &stack_area);
+}
+
 }
 }
index 6144555..cedbd51 100644 (file)
@@ -154,7 +154,7 @@ smx_ctx_sysv_create_context(xbt_main_func_t code, int argc, char **argv,
 
 #ifdef HAVE_MC
   if (MC_is_active() && code) {
 
 #ifdef HAVE_MC
   if (MC_is_active() && code) {
-    MC_new_stack_area(context->stack, ((smx_context_t)context)->process,
+    MC_register_stack_area(context->stack, ((smx_context_t)context)->process,
                       &(context->uc), smx_context_usable_stack_size);
   }
 #endif
                       &(context->uc), smx_context_usable_stack_size);
   }
 #endif