Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
s/MC_IS_ENABLED/MC_is_active()/ to remove an unfriendly pitfall of the codebase
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 16 Oct 2012 20:58:18 +0000 (22:58 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 16 Oct 2012 21:10:27 +0000 (23:10 +0200)
This fixes #14976 (thanks to LucasN for the report)

17 files changed:
examples/msg/chord/chord.c
examples/msg/chord/chord_before_dsend.c
include/simgrid/modelchecker.h
src/mc/mc_global.c
src/msg/msg_global.c
src/simix/smx_context_base.c
src/simix/smx_context_raw.c
src/simix/smx_context_sysv.c
src/simix/smx_global.c
src/simix/smx_host.c
src/simix/smx_network.c
src/simix/smx_process.c
src/simix/smx_user.c
src/smpi/smpi_base.c
src/smpi/smpi_global.c
src/surf/surf.c
src/xbt/mallocator.c

index ec12796..c3fe12c 100644 (file)
@@ -270,7 +270,7 @@ static void set_predecessor(node_t node, int predecessor_id)
 int node(int argc, char *argv[])
 {
   /* Reduce the run size for the MC */
-  if(MC_IS_ENABLED){
+  if(MC_is_active()){
     periodic_stabilize_delay = 8;
     periodic_fix_fingers_delay = 8;
     periodic_check_predecessor_delay = 8;
@@ -633,7 +633,7 @@ static int remote_find_successor(node_t node, int ask_to, int id)
         XBT_DEBUG("Received a task (%p)", task_received);
         task_data_t ans_data = MSG_task_get_data(task_received);
 
-        if (MC_IS_ENABLED) {
+        if (MC_is_active()) {
           // the model-checker is expected to find a counter-example here. 
          // 
          // As you can see in the test right below, task_received is not always equal to task_sent 
@@ -720,7 +720,7 @@ static int remote_get_predecessor(node_t node, int ask_to)
         msg_task_t task_received = MSG_comm_get_task(node->comm_receive);
         task_data_t ans_data = MSG_task_get_data(task_received);
 
-        if (MC_IS_ENABLED) {
+        if (MC_is_active()) {
           MC_assert(task_received == task_sent);
         }
 
index 0c8e280..e70a6d1 100644 (file)
@@ -251,7 +251,7 @@ static void set_predecessor(node_t node, int predecessor_id)
 int node(int argc, char *argv[])
 {
   /* Reduce the run size for the MC */
-  if(MC_IS_ENABLED){
+  if(MC_is_active()){
     periodic_stabilize_delay = 8;
     periodic_fix_fingers_delay = 8;
     periodic_check_predecessor_delay = 8;
@@ -651,7 +651,7 @@ static int remote_find_successor(node_t node, int ask_to, int id)
         XBT_DEBUG("Received a task (%p)", task_received);
         task_data_t ans_data = MSG_task_get_data(task_received);
 
-       if (MC_IS_ENABLED) {
+       if (MC_is_active()) {
          MC_assert(task_received == task_sent);
        }
 
@@ -733,7 +733,7 @@ static int remote_get_predecessor(node_t node, int ask_to)
         msg_task_t task_received = MSG_comm_get_task(node->comm_receive);
         task_data_t ans_data = MSG_task_get_data(task_received);
 
-       if (MC_IS_ENABLED) {
+       if (MC_is_active()) {
          MC_assert(task_received == task_sent);
        }
 
index 3d846c2..65d437a 100644 (file)
 
 #ifdef HAVE_MC
 
-extern int _surf_do_model_check;
-#define MC_IS_ENABLED _surf_do_model_check
+extern int _surf_do_model_check; /* please don't use directly: we inline MC_is_active, but that's what you should use */
+
+static int MC_is_active(void) {
+  return _surf_do_model_check;
+}
 
 XBT_PUBLIC(void) MC_assert(int);
 XBT_PUBLIC(int) MC_random(int min, int max);
@@ -23,9 +26,12 @@ XBT_PUBLIC(void) MC_automaton_new_propositional_symbol(const char* id, void* fct
 
 #else
 
-#define MC_IS_ENABLED 0
 #define MC_assert(a) xbt_assert(a)
 
+static int MC_is_active(void) {
+  return 0;
+}
+
 #endif
 
 
index 421479d..2efb2d0 100644 (file)
@@ -23,6 +23,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_global, mc,
 /* Configuration support */
 e_mc_reduce_t mc_reduce_kind=e_mc_reduce_unset;
 
+
 extern int _surf_init_status;
 void _mc_cfg_cb_reduce(const char *name, int pos) {
   if (_surf_init_status && !_surf_do_model_check) {
@@ -585,7 +586,7 @@ void MC_print_statistics_pairs(mc_stats_pair_t stats)
 
 void MC_assert(int prop)
 {
-  if (MC_IS_ENABLED && !prop){
+  if (MC_is_active() && !prop){
     XBT_INFO("**************************");
     XBT_INFO("*** PROPERTY NOT VALID ***");
     XBT_INFO("**************************");
@@ -597,7 +598,7 @@ void MC_assert(int prop)
 }
 
 static void MC_assert_pair(int prop){
-  if (MC_IS_ENABLED && !prop) {
+  if (MC_is_active() && !prop) {
     XBT_INFO("**************************");
     XBT_INFO("*** PROPERTY NOT VALID ***");
     XBT_INFO("**************************");
index 4bd4eb5..d333f8a 100644 (file)
@@ -59,7 +59,7 @@ void MSG_init_nocheck(int *argc, char **argv) {
     sg_platf_postparse_add_cb(MSG_post_create_environment);
   }
   
-  if(MC_IS_ENABLED){
+  if(MC_is_active()){
     /* Ignore total amount of messages sent during the simulation for heap comparison */
     MC_ignore(&(msg_global->sent_msg), sizeof(msg_global->sent_msg));
   }
@@ -119,7 +119,7 @@ msg_error_t MSG_main(void)
   fflush(stdout);
   fflush(stderr);
 
-  if (MC_IS_ENABLED) { 
+  if (MC_is_active()) {
     MC_do_the_modelcheck_for_real();
   } else {
     SIMIX_run();
index a7a9f49..1f3161b 100644 (file)
@@ -48,7 +48,7 @@ smx_ctx_base_factory_create_context_sized(size_t size,
   smx_context_t context = xbt_malloc0(size);
 
   /* Store the address of the stack in heap to compare it apart of heap comparison */
-  if(MC_IS_ENABLED)   
+  if(MC_is_active())
     MC_ignore(context, size);
 
   /* If the user provided a function for the process then use it.
index b147b97..c89d706 100644 (file)
@@ -327,7 +327,7 @@ smx_ctx_raw_create_context(xbt_main_func_t code, int argc, char **argv,
      } else {
        raw_maestro_context = context;
 
-       if(MC_IS_ENABLED)
+       if(MC_is_active())
          MC_ignore(&(raw_maestro_context->stack_top), sizeof(raw_maestro_context->stack_top));
 
      }
index e67c326..7bdcfc3 100644 (file)
@@ -168,7 +168,7 @@ smx_ctx_sysv_create_context_sized(size_t size, xbt_main_func_t code,
     sysv_maestro_context = context;
   }
 
-  if(MC_IS_ENABLED && code)
+  if(MC_is_active() && code)
     MC_new_stack_area(context, ((smx_process_t)((smx_context_t)context)->data)->name, &(context->uc));
 
   return (smx_context_t) context;
index 100e0fb..728da6f 100644 (file)
@@ -182,7 +182,7 @@ static void SIMIX_clean(void)
  */
 XBT_INLINE double SIMIX_get_clock(void)
 {
-  if(MC_IS_ENABLED){
+  if(MC_is_active()){
     return MC_process_clock_get(SIMIX_process_self());
   }else{
     return surf_get_clock();
index a247d60..2308f27 100644 (file)
@@ -301,7 +301,7 @@ smx_action_t SIMIX_host_execute(const char *name, smx_host_t host,
 #endif
 
   /* set surf's action */
-  if (!MC_IS_ENABLED) {
+  if (!MC_is_active()) {
     action->execution.surf_exec =
       surf_workstation_model->extension.workstation.execute(host->host,
     computation_amount);
@@ -339,7 +339,7 @@ smx_action_t SIMIX_host_parallel_execute( const char *name,
     workstation_list[i] = host_list[i]->host;
 
   /* set surf's action */
-  if (!MC_IS_ENABLED) {
+  if (!MC_is_active()) {
     action->execution.surf_exec =
       surf_workstation_model->extension.workstation.
       execute_parallel_task(host_nb, workstation_list, computation_amount,
@@ -404,7 +404,7 @@ void SIMIX_pre_host_execution_wait(smx_simcall_t simcall)
   simcall->issuer->waiting_action = action;
 
   /* set surf's action */
-  if (MC_IS_ENABLED) {
+  if (MC_is_active()) {
     action->state = SIMIX_DONE;
     SIMIX_execution_finish(action);
     return;
index 9886e65..6a7a7a4 100644 (file)
@@ -30,7 +30,7 @@ static void SIMIX_rdv_free(void *data);
 void SIMIX_network_init(void)
 {
   rdv_points = xbt_dict_new_homogeneous(SIMIX_rdv_free);
-  if(MC_IS_ENABLED)
+  if(MC_is_active())
     MC_ignore(&smx_total_comms, sizeof(smx_total_comms));
 }
 
@@ -388,7 +388,7 @@ smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
 
   other_action->comm.match_fun = match_fun;
 
-  if (MC_IS_ENABLED) {
+  if (MC_is_active()) {
     other_action->state = SIMIX_RUNNING;
     return other_action;
   }
@@ -472,7 +472,7 @@ smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
     SIMIX_comm_copy_data(other_action);*/
 
 
-  if (MC_IS_ENABLED) {
+  if (MC_is_active()) {
     other_action->state = SIMIX_RUNNING;
     return other_action;
   }
@@ -521,7 +521,7 @@ void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double time
   xbt_fifo_push(action->simcalls, simcall);
   simcall->issuer->waiting_action = action;
 
-  if (MC_IS_ENABLED) {
+  if (MC_is_active()) {
     if (idx == 0) {
       action->state = SIMIX_DONE;
     } else {
@@ -559,7 +559,7 @@ void SIMIX_pre_comm_test(smx_simcall_t simcall)
 {
   smx_action_t action = simcall->comm_test.comm;
 
-  if(MC_IS_ENABLED){
+  if(MC_is_active()){
     simcall->comm_test.result = action->comm.src_proc && action->comm.dst_proc;
     if(simcall->comm_test.result){
       action->state = SIMIX_DONE;
@@ -587,7 +587,7 @@ void SIMIX_pre_comm_testany(smx_simcall_t simcall, int idx)
   xbt_dynar_t actions = simcall->comm_testany.comms;
   simcall->comm_testany.result = -1;
 
-  if (MC_IS_ENABLED){
+  if (MC_is_active()){
     if(idx == -1){
       SIMIX_simcall_answer(simcall);
     }else{
@@ -617,7 +617,7 @@ void SIMIX_pre_comm_waitany(smx_simcall_t simcall, int idx)
   unsigned int cursor = 0;
   xbt_dynar_t actions = simcall->comm_waitany.comms;
 
-  if (MC_IS_ENABLED){
+  if (MC_is_active()){
     action = xbt_dynar_get_as(actions, idx, smx_action_t);
     xbt_fifo_push(action->simcalls, simcall);
     simcall->comm_waitany.result = idx;
@@ -715,7 +715,7 @@ void SIMIX_comm_finish(smx_action_t action)
        return it as the result of the simcall */
     if (simcall->call == SIMCALL_COMM_WAITANY) {
       SIMIX_waitany_remove_simcall_from_actions(simcall);
-      if (!MC_IS_ENABLED)
+      if (!MC_is_active())
         simcall->comm_waitany.result = xbt_dynar_search(simcall->comm_waitany.comms, &action);
     }
 
@@ -868,7 +868,7 @@ void SIMIX_comm_cancel(smx_action_t action)
     SIMIX_rdv_remove(action->comm.rdv, action);
     action->state = SIMIX_CANCELED;
   }
-  else if (!MC_IS_ENABLED /* when running the MC there are no surf actions */
+  else if (!MC_is_active() /* when running the MC there are no surf actions */
            && (action->state == SIMIX_READY || action->state == SIMIX_RUNNING)) {
 
     surf_workstation_model->action_cancel(action->comm.surf_comm);
index a25b215..357314a 100644 (file)
@@ -579,7 +579,7 @@ xbt_dict_t SIMIX_process_get_properties(smx_process_t process)
 
 void SIMIX_pre_process_sleep(smx_simcall_t simcall)
 {
-  if (MC_IS_ENABLED) {
+  if (MC_is_active()) {
     MC_process_clock_add(simcall->issuer, simcall->process_sleep.duration);
     simcall->process_sleep.result = SIMIX_DONE;
     SIMIX_simcall_answer(simcall);
index 7f48359..7f32016 100644 (file)
@@ -1,6 +1,6 @@
 /* smx_user.c - public interface to simix                                   */
 
-/* Copyright (c) 2010, 2011. Da SimGrid team. All rights reserved.          */
+/* Copyright (c) 2010-2012. Da SimGrid team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -32,7 +32,7 @@ smx_host_t simcall_host_get_by_name(const char *name)
 
   simcall->call = SIMCALL_HOST_GET_BY_NAME;
   simcall->host_get_by_name.name = name;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->host_get_by_name.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_get_by_name.result;
@@ -51,7 +51,7 @@ const char* simcall_host_get_name(smx_host_t host)
 
   simcall->call = SIMCALL_HOST_GET_NAME;
   simcall->host_get_name.host = host;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->host_get_name.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_get_name.result;
@@ -70,7 +70,7 @@ xbt_dict_t simcall_host_get_properties(smx_host_t host)
 
   simcall->call = SIMCALL_HOST_GET_PROPERTIES;
   simcall->host_get_properties.host = host;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->host_get_properties.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_get_properties.result;
@@ -89,7 +89,7 @@ xbt_dict_t simcall_asr_get_properties(const char *name)
 
   simcall->call = SIMCALL_ASR_GET_PROPERTIES;
   simcall->asr_get_properties.name = name;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->asr_get_properties.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->asr_get_properties.result;
@@ -110,7 +110,7 @@ double simcall_host_get_speed(smx_host_t host)
 
   simcall->call = SIMCALL_HOST_GET_SPEED;
   simcall->host_get_speed.host = host;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->host_get_speed.result = 0.0;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_get_speed.result;
@@ -128,7 +128,7 @@ double simcall_host_get_available_speed(smx_host_t host)
 
   simcall->call = SIMCALL_HOST_GET_AVAILABLE_SPEED;
   simcall->host_get_available_speed.host = host;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->host_get_available_speed.result = 0.0;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_get_available_speed.result;
@@ -148,7 +148,7 @@ int simcall_host_get_state(smx_host_t host)
 
   simcall->call = SIMCALL_HOST_GET_STATE;
   simcall->host_get_state.host = host;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->host_get_state.result = -1;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_get_state.result;
@@ -167,7 +167,7 @@ void* simcall_host_get_data(smx_host_t host)
 
   simcall->call = SIMCALL_HOST_GET_DATA;
   simcall->host_get_data.host = host;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->host_get_data.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_get_data.result;
@@ -219,7 +219,7 @@ smx_action_t simcall_host_execute(const char *name, smx_host_t host,
   simcall->host_execute.host = host;
   simcall->host_execute.computation_amount = computation_amount;
   simcall->host_execute.priority = priority;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->host_execute.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_execute.result;
@@ -271,7 +271,7 @@ smx_action_t simcall_host_parallel_execute(const char *name,
   simcall->host_parallel_execute.communication_amount = communication_amount;
   simcall->host_parallel_execute.amount = amount;
   simcall->host_parallel_execute.rate = rate;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->host_parallel_execute.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_parallel_execute.result;
@@ -322,7 +322,7 @@ double simcall_host_execution_get_remains(smx_action_t execution)
 
   simcall->call = SIMCALL_HOST_EXECUTION_GET_REMAINS;
   simcall->host_execution_get_remains.execution = execution;
-  if(MC_IS_ENABLED) /* Initializeialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initializeialize result to a default value for snapshot comparison done during simcall */
     simcall->host_execution_get_remains.result = 0.0;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_execution_get_remains.result;
@@ -379,7 +379,7 @@ e_smx_state_t simcall_host_execution_wait(smx_action_t execution)
 
   simcall->call = SIMCALL_HOST_EXECUTION_WAIT;
   simcall->host_execution_wait.execution = execution;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->host_execution_wait.result = -1;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->host_execution_wait.result;
@@ -539,7 +539,7 @@ int simcall_process_count(void)
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
   simcall->call = SIMCALL_PROCESS_COUNT;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->process_count.result = -1;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->process_count.result;
@@ -562,7 +562,7 @@ void* simcall_process_get_data(smx_process_t process)
 
   simcall->call = SIMCALL_PROCESS_GET_DATA;
   simcall->process_get_data.process = process;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->process_get_data.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->process_get_data.result;
@@ -626,7 +626,7 @@ smx_host_t simcall_process_get_host(smx_process_t process)
 
   simcall->call = SIMCALL_PROCESS_GET_HOST;
   simcall->process_get_host.process = process;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->process_get_host.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->process_get_host.result;
@@ -651,7 +651,7 @@ const char* simcall_process_get_name(smx_process_t process)
 
   simcall->call = SIMCALL_PROCESS_GET_NAME;
   simcall->process_get_name.process = process;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->process_get_name.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->process_get_name.result;
@@ -671,7 +671,7 @@ int simcall_process_is_suspended(smx_process_t process)
 
   simcall->call = SIMCALL_PROCESS_IS_SUSPENDED;
   simcall->process_is_suspended.process = process;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->process_is_suspended.result = -1;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->process_is_suspended.result;
@@ -689,7 +689,7 @@ xbt_dict_t simcall_process_get_properties(smx_process_t process)
 
   simcall->call = SIMCALL_PROCESS_GET_PROPERTIES;
   simcall->process_get_properties.process = process;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->process_get_properties.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->process_get_properties.result;
@@ -736,7 +736,7 @@ XBT_PUBLIC(smx_process_t) simcall_process_restart(smx_process_t process)
 
   simcall->call = SIMCALL_PROCESS_RESTART;
   simcall->process_restart.process = process;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->process_restart.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -763,7 +763,7 @@ e_smx_state_t simcall_process_sleep(double duration)
 
   simcall->call = SIMCALL_PROCESS_SLEEP;
   simcall->process_sleep.duration = duration;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->process_sleep.result = -1;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->process_sleep.result;
@@ -781,7 +781,7 @@ smx_rdv_t simcall_rdv_create(const char *name)
 
   simcall->call = SIMCALL_RDV_CREATE;
   simcall->rdv_create.name = name;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->rdv_create.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -840,7 +840,7 @@ int simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host)
   simcall->call = SIMCALL_RDV_COMM_COUNT_BY_HOST;
   simcall->rdv_comm_count_by_host.rdv = rdv;
   simcall->rdv_comm_count_by_host.host = host;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->rdv_comm_count_by_host.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -859,7 +859,7 @@ smx_action_t simcall_rdv_get_head(smx_rdv_t rdv)
 
   simcall->call = SIMCALL_RDV_GET_HEAD;
   simcall->rdv_get_head.rdv = rdv;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->rdv_get_head.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -883,7 +883,7 @@ smx_process_t simcall_rdv_get_receiver(smx_rdv_t rdv)
 
   simcall->call = SIMCALL_RDV_GET_RECV;
   simcall->rdv_get_rcv_proc.rdv = rdv;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->rdv_get_rcv_proc.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -905,7 +905,7 @@ void simcall_comm_send(smx_rdv_t rdv, double task_size, double rate,
   
   xbt_assert(rdv, "No rendez-vous point defined for send");
 
-  if (MC_IS_ENABLED) {
+  if (MC_is_active()) {
     /* the model-checker wants two separate simcalls */
     smx_action_t comm = simcall_comm_isend(rdv, task_size, rate,
         src_buff, src_buff_size, match_fun, NULL, data, 0);
@@ -955,7 +955,7 @@ smx_action_t simcall_comm_isend(smx_rdv_t rdv, double task_size, double rate,
   simcall->comm_isend.clean_fun = clean_fun;
   simcall->comm_isend.data = data;
   simcall->comm_isend.detached = detached;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->comm_isend.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -970,7 +970,7 @@ void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size,
   xbt_assert(isfinite(timeout), "timeout is not finite!");
   xbt_assert(rdv, "No rendez-vous point defined for recv");
 
-  if (MC_IS_ENABLED) {
+  if (MC_is_active()) {
     /* the model-checker wants two separate simcalls */
     smx_action_t comm = simcall_comm_irecv(rdv, dst_buff, dst_buff_size,
         match_fun, data);
@@ -1006,7 +1006,7 @@ smx_action_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff
   simcall->comm_irecv.dst_buff_size = dst_buff_size;
   simcall->comm_irecv.match_fun = match_fun;
   simcall->comm_irecv.data = data;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->comm_irecv.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1029,7 +1029,7 @@ smx_action_t simcall_comm_iprobe(smx_rdv_t rdv, int src, int tag,
   simcall->comm_iprobe.src = src;
   simcall->comm_iprobe.match_fun = match_fun;
   simcall->comm_iprobe.data = data;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->comm_iprobe.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
   return simcall->comm_iprobe.result;
@@ -1072,7 +1072,7 @@ unsigned int simcall_comm_waitany(xbt_dynar_t comms)
 
   simcall->call = SIMCALL_COMM_WAITANY;
   simcall->comm_waitany.comms = comms;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->comm_waitany.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1089,7 +1089,7 @@ int simcall_comm_testany(xbt_dynar_t comms)
 
   simcall->call = SIMCALL_COMM_TESTANY;
   simcall->comm_testany.comms = comms;
-    if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+    if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
       simcall->comm_testany.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1144,7 +1144,7 @@ int simcall_comm_test(smx_action_t comm)
 
   simcall->call = SIMCALL_COMM_TEST;
   simcall->comm_test.comm = comm;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->comm_test.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1160,7 +1160,7 @@ double simcall_comm_get_remains(smx_action_t comm)
 
   simcall->call = SIMCALL_COMM_GET_REMAINS;
   simcall->comm_get_remains.comm = comm;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->comm_get_remains.result = 0.0;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1176,7 +1176,7 @@ e_smx_state_t simcall_comm_get_state(smx_action_t comm)
 
   simcall->call = SIMCALL_COMM_GET_STATE;
   simcall->comm_get_state.comm = comm;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->comm_get_state.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1192,7 +1192,7 @@ void *simcall_comm_get_src_data(smx_action_t comm)
 
   simcall->call = SIMCALL_COMM_GET_SRC_DATA;
   simcall->comm_get_src_data.comm = comm;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->comm_get_src_data.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1208,7 +1208,7 @@ void *simcall_comm_get_dst_data(smx_action_t comm)
 
   simcall->call = SIMCALL_COMM_GET_DST_DATA;
   simcall->comm_get_dst_data.comm = comm;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->comm_get_dst_data.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1224,7 +1224,7 @@ smx_process_t simcall_comm_get_src_proc(smx_action_t comm)
 
   simcall->call = SIMCALL_COMM_GET_SRC_PROC;
   simcall->comm_get_src_proc.comm = comm;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->comm_get_src_proc.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1240,7 +1240,7 @@ smx_process_t simcall_comm_get_dst_proc(smx_action_t comm)
 
   simcall->call = SIMCALL_COMM_GET_DST_PROC;
   simcall->comm_get_dst_proc.comm = comm;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->comm_get_dst_proc.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1254,7 +1254,7 @@ int simcall_comm_is_latency_bounded(smx_action_t comm)
 
   simcall->call = SIMCALL_COMM_IS_LATENCY_BOUNDED;
   simcall->comm_is_latency_bounded.comm = comm;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->comm_is_latency_bounded.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1274,7 +1274,7 @@ smx_mutex_t simcall_mutex_init(void)
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
   simcall->call = SIMCALL_MUTEX_INIT;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->mutex_init.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1316,7 +1316,7 @@ int simcall_mutex_trylock(smx_mutex_t mutex)
 
   simcall->call = SIMCALL_MUTEX_TRYLOCK;
   simcall->mutex_trylock.mutex = mutex;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->mutex_trylock.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1344,7 +1344,7 @@ smx_cond_t simcall_cond_init(void)
   smx_simcall_t simcall = SIMIX_simcall_mine();
 
   simcall->call = SIMCALL_COND_INIT;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->cond_init.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1432,7 +1432,7 @@ smx_sem_t simcall_sem_init(int capacity)
 
   simcall->call = SIMCALL_SEM_INIT;
   simcall->sem_init.capacity = capacity;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->sem_init.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1474,7 +1474,7 @@ int simcall_sem_would_block(smx_sem_t sem)
 
   simcall->call = SIMCALL_SEM_WOULD_BLOCK;
   simcall->sem_would_block.sem = sem;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->sem_would_block.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1519,7 +1519,7 @@ int simcall_sem_get_capacity(smx_sem_t sem)
 
   simcall->call = SIMCALL_SEM_GET_CAPACITY;
   simcall->sem_get_capacity.sem = sem;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->sem_get_capacity.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1538,7 +1538,7 @@ double simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream
   simcall->file_read.size = size;
   simcall->file_read.nmemb = nmemb;
   simcall->file_read.stream = stream;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->file_read.result = 0.0;
   SIMIX_simcall_push(simcall->issuer);
 
@@ -1557,7 +1557,7 @@ size_t simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t
   simcall->file_write.size = size;
   simcall->file_write.nmemb = nmemb;
   simcall->file_write.stream = stream;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->file_write.result = 0;
   SIMIX_simcall_push(simcall->issuer);
 
@@ -1575,7 +1575,7 @@ smx_file_t simcall_file_open(const char* mount, const char* path, const char* mo
   simcall->file_open.mount = mount;
   simcall->file_open.path = path;
   simcall->file_open.mode = mode;
-  if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to NULL for snapshot comparison done during simcall */
     simcall->file_open.result = NULL;
   SIMIX_simcall_push(simcall->issuer);
 
@@ -1591,7 +1591,7 @@ int simcall_file_close(smx_file_t fp)
 
   simcall->call = SIMCALL_FILE_CLOSE;
   simcall->file_close.fp = fp;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->file_close.result = -1;
   SIMIX_simcall_push(simcall->issuer);
 
@@ -1606,7 +1606,7 @@ int simcall_file_stat(smx_file_t fd, s_file_stat_t *buf)
   smx_simcall_t simcall = SIMIX_simcall_mine();
   simcall->call = SIMCALL_FILE_STAT;
   simcall->file_stat.fd = fd;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->file_stat.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1625,7 +1625,7 @@ int simcall_file_unlink(smx_file_t fd)
   smx_simcall_t simcall = SIMIX_simcall_mine();
   simcall->call = SIMCALL_FILE_UNLINK;
   simcall->file_unlink.fd = fd;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->file_unlink.result = -1;
 
   SIMIX_simcall_push(simcall->issuer);
@@ -1643,7 +1643,7 @@ xbt_dict_t simcall_file_ls(const char* mount, const char* path)
   simcall->call = SIMCALL_FILE_LS;
   simcall->file_ls.mount = mount;
   simcall->file_ls.path = path;
-  if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+  if(MC_is_active()) /* Initialize result to a default value for snapshot comparison done during simcall */
     simcall->file_ls.result = NULL;
 
   SIMIX_simcall_push(simcall->issuer);
index bee5bd3..9ad302a 100644 (file)
@@ -538,7 +538,7 @@ void smpi_mpi_waitall(int count, MPI_Request requests[],
   }
 
   for(c = 0; c < count; c++) {
-      if(MC_IS_ENABLED) {
+      if(MC_is_active()) {
         smpi_mpi_wait(&requests[c], pstat);
         index = c;
       } else {
index 03a8d6e..f7c6132 100644 (file)
@@ -332,7 +332,7 @@ int MAIN__(void)
   fflush(stdout);
   fflush(stderr);
 
-  if (MC_IS_ENABLED)
+  if (MC_is_active())
     MC_modelcheck();
   else
     SIMIX_run();
index 67cd8a4..136390e 100644 (file)
@@ -426,7 +426,7 @@ void surf_init(int *argc, char **argv)
 
   surf_config_init(argc, argv);
   surf_action_init();
-  if (MC_IS_ENABLED)
+  if (MC_is_active())
     MC_memory_init();
 }
 
index e6753e1..5a4f2fc 100644 (file)
@@ -19,7 +19,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_mallocator, xbt, "Mallocators");
  * memory (so these blocks are killed on restore) and the contrary (so these
  * blocks will leak accross restores).
  */
-#define MALLOCATOR_IS_ENABLED (MALLOCATOR_IS_WANTED && !MC_IS_ENABLED)
+#define MALLOCATOR_IS_ENABLED (MALLOCATOR_IS_WANTED && !MC_is_active())
 
 /**
  * \brief Constructor