From: Marion Guthmuller Date: Mon, 30 Jan 2012 12:44:30 +0000 (+0100) Subject: merge conflict resolved X-Git-Tag: exp_20120216~119 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c5ad8ca1a68bbaa9152471c8d0eeb99d762f0d86?hp=-c merge conflict resolved --- c5ad8ca1a68bbaa9152471c8d0eeb99d762f0d86 diff --combined include/simix/simix.h index 3d928ba87f,3e5d219821..7dadf97079 --- a/include/simix/simix.h +++ b/include/simix/simix.h @@@ -28,6 -28,7 +28,7 @@@ XBT_PUBLIC(void) SIMIX_function_registe /* Simulation execution */ XBT_PUBLIC(void) SIMIX_run(void); + XBT_INLINE XBT_PUBLIC(double) SIMIX_get_clock(void); /* Timer functions FIXME: should these be public? */ XBT_PUBLIC(void) SIMIX_timer_set(double date, void *function, void *arg); @@@ -81,49 -82,47 +82,47 @@@ XBT_PUBLIC(int) SIMIX_comm_has_recv_mat XBT_PUBLIC(void) SIMIX_comm_finish(smx_action_t action); /******************************************************************************/ - /* SIMIX Smurf Proxy Functions */ + /* SIMIX simcalls */ /******************************************************************************/ - /* These functions issue request through the Smurf proxy. */ - /* They cannot be called from maestro's context, and they are thread safe. */ + /* These functions are a system call-like interface to the simulation kernel. */ + /* They can also be called from maestro's context, and they are thread safe. */ /******************************************************************************/ - XBT_INLINE XBT_PUBLIC(double) SIMIX_get_clock(void); - - /******************************* Host Requests ********************************/ - /* FIXME: use handlers and keep smx_host_t hidden from higher levels */ - XBT_PUBLIC(xbt_dict_t) SIMIX_req_host_get_dict(void); - XBT_INLINE XBT_PUBLIC(smx_host_t) SIMIX_req_host_get_by_name(const char *name); - XBT_PUBLIC(const char *) SIMIX_req_host_get_name(smx_host_t host); - XBT_PUBLIC(xbt_dict_t) SIMIX_req_host_get_properties(smx_host_t host); - XBT_PUBLIC(double) SIMIX_req_host_get_speed(smx_host_t host); - XBT_PUBLIC(double) SIMIX_req_host_get_available_speed(smx_host_t host); + /******************************* Host simcalls ********************************/ + /* TODO use handlers and keep smx_host_t hidden from higher levels */ + XBT_PUBLIC(xbt_dict_t) simcall_host_get_dict(void); + XBT_INLINE XBT_PUBLIC(smx_host_t) simcall_host_get_by_name(const char *name); + XBT_PUBLIC(const char *) simcall_host_get_name(smx_host_t host); + XBT_PUBLIC(xbt_dict_t) simcall_host_get_properties(smx_host_t host); + XBT_PUBLIC(double) simcall_host_get_speed(smx_host_t host); + XBT_PUBLIC(double) simcall_host_get_available_speed(smx_host_t host); /* Two possible states, 1 - CPU ON and 0 CPU OFF */ - XBT_PUBLIC(int) SIMIX_req_host_get_state(smx_host_t host); - XBT_PUBLIC(void *) SIMIX_req_host_get_data(smx_host_t host); + XBT_PUBLIC(int) simcall_host_get_state(smx_host_t host); + XBT_PUBLIC(void *) simcall_host_get_data(smx_host_t host); - XBT_PUBLIC(void) SIMIX_req_host_set_data(smx_host_t host, void *data); + XBT_PUBLIC(void) simcall_host_set_data(smx_host_t host, void *data); - XBT_PUBLIC(smx_action_t) SIMIX_req_host_execute(const char *name, smx_host_t host, + XBT_PUBLIC(smx_action_t) simcall_host_execute(const char *name, smx_host_t host, double computation_amount, double priority); - XBT_PUBLIC(smx_action_t) SIMIX_req_host_parallel_execute(const char *name, + XBT_PUBLIC(smx_action_t) simcall_host_parallel_execute(const char *name, int host_nb, smx_host_t *host_list, double *computation_amount, double *communication_amount, double amount, double rate); - XBT_PUBLIC(void) SIMIX_req_host_execution_destroy(smx_action_t execution); - XBT_PUBLIC(void) SIMIX_req_host_execution_cancel(smx_action_t execution); - XBT_PUBLIC(double) SIMIX_req_host_execution_get_remains(smx_action_t execution); - XBT_PUBLIC(e_smx_state_t) SIMIX_req_host_execution_get_state(smx_action_t execution); - XBT_PUBLIC(void) SIMIX_req_host_execution_set_priority(smx_action_t execution, double priority); - XBT_PUBLIC(e_smx_state_t) SIMIX_req_host_execution_wait(smx_action_t execution); + XBT_PUBLIC(void) simcall_host_execution_destroy(smx_action_t execution); + XBT_PUBLIC(void) simcall_host_execution_cancel(smx_action_t execution); + XBT_PUBLIC(double) simcall_host_execution_get_remains(smx_action_t execution); + XBT_PUBLIC(e_smx_state_t) simcall_host_execution_get_state(smx_action_t execution); + XBT_PUBLIC(void) simcall_host_execution_set_priority(smx_action_t execution, double priority); + XBT_PUBLIC(e_smx_state_t) simcall_host_execution_wait(smx_action_t execution); - /**************************** Process Requests ********************************/ + /**************************** Process simcalls ********************************/ /* Constructor and Destructor */ - XBT_PUBLIC(void) SIMIX_req_process_create(smx_process_t *process, + XBT_PUBLIC(void) simcall_process_create(smx_process_t *process, const char *name, xbt_main_func_t code, void *data, @@@ -131,119 -130,118 +130,121 @@@ int argc, char **argv, xbt_dict_t properties); - XBT_PUBLIC(void) SIMIX_req_process_kill(smx_process_t process); - XBT_PUBLIC(void) SIMIX_req_process_killall(void); + XBT_PUBLIC(void) simcall_process_kill(smx_process_t process); + XBT_PUBLIC(void) simcall_process_killall(void); /* Process handling */ - XBT_PUBLIC(void) SIMIX_req_process_cleanup(smx_process_t process); - XBT_PUBLIC(void) SIMIX_req_process_change_host(smx_process_t process, + XBT_PUBLIC(void) simcall_process_cleanup(smx_process_t process); + XBT_PUBLIC(void) simcall_process_change_host(smx_process_t process, smx_host_t dest); - XBT_PUBLIC(void) SIMIX_req_process_suspend(smx_process_t process); - XBT_PUBLIC(void) SIMIX_req_process_resume(smx_process_t process); + XBT_PUBLIC(void) simcall_process_suspend(smx_process_t process); + XBT_PUBLIC(void) simcall_process_resume(smx_process_t process); /* Getters and Setters */ - XBT_PUBLIC(int) SIMIX_req_process_count(void); - XBT_PUBLIC(void *) SIMIX_req_process_get_data(smx_process_t process); - XBT_PUBLIC(void) SIMIX_req_process_set_data(smx_process_t process, void *data); - XBT_INLINE XBT_PUBLIC(smx_host_t) SIMIX_req_process_get_host(smx_process_t process); - XBT_PUBLIC(const char *) SIMIX_req_process_get_name(smx_process_t process); - XBT_PUBLIC(int) SIMIX_req_process_is_suspended(smx_process_t process); - XBT_PUBLIC(xbt_dict_t) SIMIX_req_process_get_properties(smx_process_t host); + XBT_PUBLIC(int) simcall_process_count(void); + XBT_PUBLIC(void *) simcall_process_get_data(smx_process_t process); + XBT_PUBLIC(void) simcall_process_set_data(smx_process_t process, void *data); + XBT_INLINE XBT_PUBLIC(smx_host_t) simcall_process_get_host(smx_process_t process); + XBT_PUBLIC(const char *) simcall_process_get_name(smx_process_t process); + XBT_PUBLIC(int) simcall_process_is_suspended(smx_process_t process); + XBT_PUBLIC(xbt_dict_t) simcall_process_get_properties(smx_process_t host); /* Sleep control */ - XBT_PUBLIC(e_smx_state_t) SIMIX_req_process_sleep(double duration); + XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration); - /************************** Comunication Requests *****************************/ + /************************** Comunication simcalls *****************************/ /***** Rendez-vous points *****/ - XBT_PUBLIC(smx_rdv_t) SIMIX_req_rdv_create(const char *name); - XBT_PUBLIC(void) SIMIX_req_rdv_destroy(smx_rdv_t rvp); - XBT_PUBLIC(smx_rdv_t) SIMIX_req_rdv_get_by_name(const char *name); - XBT_PUBLIC(int) SIMIX_req_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host); - XBT_PUBLIC(smx_action_t) SIMIX_req_rdv_get_head(smx_rdv_t rdv); ++ + XBT_PUBLIC(smx_rdv_t) simcall_rdv_create(const char *name); + XBT_PUBLIC(void) simcall_rdv_destroy(smx_rdv_t rvp); + XBT_PUBLIC(smx_rdv_t) simcall_rdv_get_by_name(const char *name); + XBT_PUBLIC(int) simcall_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host); + XBT_PUBLIC(smx_action_t) simcall_rdv_get_head(smx_rdv_t rdv); + +XBT_PUBLIC(xbt_dict_t) SIMIX_get_rdv_points(void); + - /***** Communication Requests *****/ + /***** Communication simcalls *****/ - XBT_PUBLIC(void) SIMIX_req_comm_send(smx_rdv_t rdv, double task_size, + XBT_PUBLIC(void) simcall_comm_send(smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, int (*match_fun)(void *, void *), void *data, double timeout); - XBT_PUBLIC(smx_action_t) SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, + XBT_PUBLIC(smx_action_t) simcall_comm_isend(smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, int (*match_fun)(void *, void *), void (*clean_fun)(void *), void *data, int detached); - XBT_PUBLIC(void) SIMIX_req_comm_recv(smx_rdv_t rdv, void *dst_buff, + XBT_PUBLIC(void) simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *), void *data, double timeout); - XBT_PUBLIC(smx_action_t) SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, + XBT_PUBLIC(smx_action_t) simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *), void *data); - XBT_PUBLIC(void) SIMIX_req_comm_destroy(smx_action_t comm); + XBT_PUBLIC(void) simcall_comm_destroy(smx_action_t comm); - XBT_INLINE XBT_PUBLIC(void) SIMIX_req_comm_cancel(smx_action_t comm); + XBT_INLINE XBT_PUBLIC(void) simcall_comm_cancel(smx_action_t comm); /* FIXME: waitany is going to be a vararg function, and should take a timeout */ - XBT_PUBLIC(unsigned int) SIMIX_req_comm_waitany(xbt_dynar_t comms); - XBT_PUBLIC(void) SIMIX_req_comm_wait(smx_action_t comm, double timeout); - XBT_PUBLIC(int) SIMIX_req_comm_test(smx_action_t comm); - XBT_PUBLIC(int) SIMIX_req_comm_testany(xbt_dynar_t comms); + XBT_PUBLIC(unsigned int) simcall_comm_waitany(xbt_dynar_t comms); + XBT_PUBLIC(void) simcall_comm_wait(smx_action_t comm, double timeout); + XBT_PUBLIC(int) simcall_comm_test(smx_action_t comm); + XBT_PUBLIC(int) simcall_comm_testany(xbt_dynar_t comms); /* Getters and setters */ - XBT_PUBLIC(double) SIMIX_req_comm_get_remains(smx_action_t comm); - XBT_PUBLIC(e_smx_state_t) SIMIX_req_comm_get_state(smx_action_t comm); - XBT_PUBLIC(void *) SIMIX_req_comm_get_src_data(smx_action_t comm); - XBT_PUBLIC(void *) SIMIX_req_comm_get_dst_data(smx_action_t comm); - XBT_PUBLIC(smx_process_t) SIMIX_req_comm_get_src_proc(smx_action_t comm); - XBT_PUBLIC(smx_process_t) SIMIX_req_comm_get_dst_proc(smx_action_t comm); + XBT_PUBLIC(double) simcall_comm_get_remains(smx_action_t comm); + XBT_PUBLIC(e_smx_state_t) simcall_comm_get_state(smx_action_t comm); + XBT_PUBLIC(void *) simcall_comm_get_src_data(smx_action_t comm); + XBT_PUBLIC(void *) simcall_comm_get_dst_data(smx_action_t comm); + XBT_PUBLIC(smx_process_t) simcall_comm_get_src_proc(smx_action_t comm); + XBT_PUBLIC(smx_process_t) simcall_comm_get_dst_proc(smx_action_t comm); #ifdef HAVE_LATENCY_BOUND_TRACKING - XBT_PUBLIC(int) SIMIX_req_comm_is_latency_bounded(smx_action_t comm); + XBT_PUBLIC(int) simcall_comm_is_latency_bounded(smx_action_t comm); #endif #ifdef HAVE_TRACING /************************** Tracing handling **********************************/ - XBT_PUBLIC(void) SIMIX_req_set_category(smx_action_t action, const char *category); + XBT_PUBLIC(void) simcall_set_category(smx_action_t action, const char *category); #endif - /************************** Synchro handling **********************************/ + /************************** Synchro simcalls **********************************/ - XBT_PUBLIC(smx_mutex_t) SIMIX_req_mutex_init(void); - XBT_PUBLIC(void) SIMIX_req_mutex_destroy(smx_mutex_t mutex); - XBT_PUBLIC(void) SIMIX_req_mutex_lock(smx_mutex_t mutex); - XBT_PUBLIC(int) SIMIX_req_mutex_trylock(smx_mutex_t mutex); - XBT_PUBLIC(void) SIMIX_req_mutex_unlock(smx_mutex_t mutex); + XBT_PUBLIC(smx_mutex_t) simcall_mutex_init(void); + XBT_PUBLIC(void) simcall_mutex_destroy(smx_mutex_t mutex); + XBT_PUBLIC(void) simcall_mutex_lock(smx_mutex_t mutex); + XBT_PUBLIC(int) simcall_mutex_trylock(smx_mutex_t mutex); + XBT_PUBLIC(void) simcall_mutex_unlock(smx_mutex_t mutex); - XBT_PUBLIC(smx_cond_t) SIMIX_req_cond_init(void); - XBT_PUBLIC(void) SIMIX_req_cond_destroy(smx_cond_t cond); - XBT_PUBLIC(void) SIMIX_req_cond_signal(smx_cond_t cond); - XBT_PUBLIC(void) SIMIX_req_cond_wait(smx_cond_t cond, smx_mutex_t mutex); - XBT_PUBLIC(void) SIMIX_req_cond_wait_timeout(smx_cond_t cond, + XBT_PUBLIC(smx_cond_t) simcall_cond_init(void); + XBT_PUBLIC(void) simcall_cond_destroy(smx_cond_t cond); + XBT_PUBLIC(void) simcall_cond_signal(smx_cond_t cond); + XBT_PUBLIC(void) simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex); + XBT_PUBLIC(void) simcall_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double max_duration); - XBT_PUBLIC(void) SIMIX_req_cond_broadcast(smx_cond_t cond); - - XBT_PUBLIC(smx_sem_t) SIMIX_req_sem_init(int capacity); - XBT_PUBLIC(void) SIMIX_req_sem_destroy(smx_sem_t sem); - XBT_PUBLIC(void) SIMIX_req_sem_release(smx_sem_t sem); - XBT_PUBLIC(void) SIMIX_req_sem_release_forever(smx_sem_t sem); - XBT_PUBLIC(int) SIMIX_req_sem_would_block(smx_sem_t sem); - XBT_PUBLIC(void) SIMIX_req_sem_block_onto(smx_sem_t sem); - XBT_PUBLIC(void) SIMIX_req_sem_acquire(smx_sem_t sem); - XBT_PUBLIC(void) SIMIX_req_sem_acquire_timeout(smx_sem_t sem, + XBT_PUBLIC(void) simcall_cond_broadcast(smx_cond_t cond); + + XBT_PUBLIC(smx_sem_t) simcall_sem_init(int capacity); + XBT_PUBLIC(void) simcall_sem_destroy(smx_sem_t sem); + XBT_PUBLIC(void) simcall_sem_release(smx_sem_t sem); + XBT_PUBLIC(void) simcall_sem_release_forever(smx_sem_t sem); + XBT_PUBLIC(int) simcall_sem_would_block(smx_sem_t sem); + XBT_PUBLIC(void) simcall_sem_block_onto(smx_sem_t sem); + XBT_PUBLIC(void) simcall_sem_acquire(smx_sem_t sem); + XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration); - XBT_PUBLIC(unsigned int) SIMIX_req_sem_acquire_any(xbt_dynar_t sems); - XBT_PUBLIC(int) SIMIX_req_sem_get_capacity(smx_sem_t sem); + XBT_PUBLIC(unsigned int) simcall_sem_acquire_any(xbt_dynar_t sems); + XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem); - const char *SIMIX_request_name(int kind); + XBT_PUBLIC(void) simcall_file_read(char* name); SG_END_DECL() #endif /* _SIMIX_SIMIX_H */ diff --combined src/mc/mc_checkpoint.c index 0c801b4013,5df49f1f65..da376da567 --- a/src/mc/mc_checkpoint.c +++ b/src/mc/mc_checkpoint.c @@@ -18,7 -18,7 +18,7 @@@ static mc_mem_region_t MC_region_new(in new_reg->start_addr = start_addr; new_reg->size = size; new_reg->data = xbt_malloc0(size); - XBT_DEBUG("New reg data %p, start_addr %p", new_reg->data, start_addr); + XBT_DEBUG("New reg data %p, start_addr %p, size %zu", new_reg->data, start_addr, size); memcpy(new_reg->data, start_addr, size); return new_reg; @@@ -39,7 -39,7 +39,7 @@@ static void MC_region_restore(mc_mem_re if (!memcmp(maps->regions[i].pathname, "[stack]", 7)){ size_t diff = (char*)reg->start_addr - (char*)r.start_addr; void *segment = malloc(reg->size + diff); - XBT_DEBUG("Size of segment : %lu", sizeof(segment)); + XBT_DEBUG("Size of segment : %zu", sizeof(segment)); memcpy((char *)segment + diff, reg->data, reg->size); memcpy(r.start_addr, segment, sizeof(segment)); XBT_DEBUG("Memcpy region ok"); @@@ -72,7 -72,10 +72,7 @@@ static void MC_snapshot_add_region(mc_s XBT_DEBUG("New region libsimgrid (%zu)", size); break; case 2 : - XBT_DEBUG("New region program (%zu)", size); - break; - case 3 : - XBT_DEBUG("New region stack (%zu)", size); + XBT_DEBUG("New region program data (%zu)", size); break; } mc_mem_region_t new_reg = MC_region_new(type, start_addr, size); @@@ -131,10 -134,18 +131,10 @@@ void MC_take_snapshot_liveness(mc_snaps if (reg.start_addr == std_heap){ // only save the std heap (and not the raw one) MC_snapshot_add_region(snapshot, 0, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); } - } else { + }else { if (!memcmp(basename(maps->regions[i].pathname), "libsimgrid", 10)){ MC_snapshot_add_region(snapshot, 1, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); - } else { - if (!memcmp(basename(maps->regions[i].pathname), basename(prog_name), strlen(basename(prog_name)))){ - MC_snapshot_add_region(snapshot, 2, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); - } /*else { - if (!memcmp(maps->regions[i].pathname, "[stack]", 7)){ - MC_snapshot_add_region(snapshot, 3, reg.start_addr, (char*)reg.end_addr - (char*)reg.start_addr); - } - }*/ - } + } } } i++; @@@ -194,7 -205,10 +194,7 @@@ void MC_restore_snapshot(mc_snapshot_t XBT_DEBUG("libsimgrid (data) restored"); break; case 2: - XBT_DEBUG("program (data) restored"); - break; - case 3: - XBT_DEBUG("stack restored"); + XBT_DEBUG("data program restored"); break; } diff --combined src/mc/mc_liveness.c index 779ded2fb0,19a312f06a..00a2eb970b --- a/src/mc/mc_liveness.c +++ b/src/mc/mc_liveness.c @@@ -10,8 -10,6 +10,8 @@@ xbt_dynar_t visited_pairs xbt_dynar_t visited_pairs_hash; xbt_dynar_t successors; +xbt_dynar_t hosts_table; + /* fast implementation of djb2 algorithm */ unsigned int hash_region(char *str, int str_len){ @@@ -51,7 -49,7 +51,7 @@@ int snapshot_compare(mc_snapshot_t s1, } switch(s1->regions[i]->type){ - case 0: + case 0: if(s1->regions[i]->size != s2->regions[i]->size){ if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ XBT_DEBUG("Different size of heap (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size); @@@ -68,7 -66,7 +68,7 @@@ return 1; } } - if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data)){ + if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data, std_heap)){ if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ XBT_DEBUG("Different heap (mmalloc_compare)"); errors++; @@@ -77,7 -75,7 +77,7 @@@ } } break; - case 1 : + /*case 1 : if(s1->regions[i]->size != s2->regions[i]->size){ if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ XBT_DEBUG("Different size of libsimgrid (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size); @@@ -97,20 -95,74 +97,20 @@@ if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){ if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ XBT_DEBUG("Different memcmp for data in libsimgrid"); + XBT_DEBUG("Size : %zu", s1->regions[i]->size); errors++; }else{ return 1; } } - break; - /*case 2: - if(s1->regions[i]->size != s2->regions[i]->size){ - if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ - XBT_DEBUG("Different size of program (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size); - errors++; - }else{ - return 1; - } - } - if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){ - if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ - XBT_DEBUG("Different start addr of program (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr); - errors++; - }else{ - return 1; - } - } - if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){ - if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ - XBT_DEBUG("Different memcmp for data in program"); - errors++; - }else{ - return 1; - } - } break;*/ - case 3: - if(s1->regions[i]->size != s2->regions[i]->size){ - if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ - XBT_DEBUG("Different size of stack (s1 = %zu, s2 = %zu)", s1->regions[i]->size, s2->regions[i]->size); - errors++; - }else{ - return 1; - } - } - if(s1->regions[i]->start_addr != s2->regions[i]->start_addr){ - if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ - XBT_DEBUG("Different start addr of stack (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr); - errors++; - }else{ - return 1; - } - } - if(memcmp(s1->regions[i]->data, s2->regions[i]->data, s1->regions[i]->size) != 0){ - if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ - XBT_DEBUG("Different memcmp for data in stack"); - errors++; - }else{ - return 1; - } - } - break; default: break; } } - if(XBT_LOG_ISENABLED(mc_liveness, xbt_log_priority_debug)){ - return (errors>0); - }else{ - return 0; - } + return (errors > 0); + } @@@ -144,26 -196,20 +144,26 @@@ int reached(xbt_state_t st) cursor = 0; mc_pair_reached_t pair_test = NULL; - + //xbt_dict_t current_rdv_points = SIMIX_get_rdv_points(); + xbt_dynar_foreach(reached_pairs, cursor, pair_test){ + XBT_DEBUG("Pair reached #%d", cursor+1); if(automaton_state_compare(pair_test->automaton_state, st) == 0){ if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){ - XBT_DEBUG("Pair reached %d", cursor+1); - if(snapshot_compare(pair_test->system_state, sn) == 0){ - MC_free_snapshot(sn); - xbt_dynar_reset(prop_ato); - xbt_free(prop_ato); - MC_UNSET_RAW_MEM; - return 1; + //XBT_DEBUG("Rdv points size %d - %d", xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points)); + //if(xbt_dict_length(pair_test->rdv_points) == xbt_dict_length(current_rdv_points)){ + //if(rdv_points_compare(pair_test->rdv_points, current_rdv_points) == 0){ + if(snapshot_compare(pair_test->system_state, sn) == 0){ + MC_free_snapshot(sn); + xbt_dynar_reset(prop_ato); + xbt_free(prop_ato); + MC_UNSET_RAW_MEM; + return 1; + } + /* } }else{ - XBT_DEBUG("Different snapshot"); - } + XBT_DEBUG("Different size of rdv points (%d - %d)",xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points) ); + }*/ }else{ XBT_DEBUG("Different values of propositional symbols"); } @@@ -181,167 -227,6 +181,167 @@@ } } +int rdv_points_compare(xbt_dict_t d1, xbt_dict_t d2){ /* d1 = pair_test, d2 = current_pair */ + + xbt_dict_cursor_t cursor_dict = NULL; + char *key; + char *data; + smx_rdv_t rdv1, rdv2; + xbt_fifo_item_t item1, item2; + smx_action_t action1, action2; + xbt_fifo_item_t item_req1, item_req2; + smx_req_t req1, req2; + int i=0; + int j=0; + + xbt_dict_foreach(d1, cursor_dict, key, data){ + rdv1 = (smx_rdv_t)data; + rdv2 = xbt_dict_get_or_null(d2, rdv1->name); + if(rdv2 == NULL){ + XBT_DEBUG("Rdv point unknown"); + return 1; + }else{ + if(xbt_fifo_size(rdv1->comm_fifo) != xbt_fifo_size(rdv2->comm_fifo)){ + XBT_DEBUG("Different total of actions in mailbox \"%s\" (%d - %d)", rdv1->name, xbt_fifo_size(rdv1->comm_fifo),xbt_fifo_size(rdv2->comm_fifo) ); + return 1; + }else{ + + XBT_DEBUG("Total of actions in mailbox \"%s\" : %d", rdv1->name, xbt_fifo_size(rdv1->comm_fifo)); + + item1 = xbt_fifo_get_first_item(rdv1->comm_fifo); + item2 = xbt_fifo_get_first_item(rdv2->comm_fifo); + + while(icomm_fifo)){ + action1 = (smx_action_t) xbt_fifo_get_item_content(item1); + action2 = (smx_action_t) xbt_fifo_get_item_content(item2); + + if(action1->type != action2->type){ + XBT_DEBUG("Different type of action"); + return 1; + } + + if(action1->state != action2->state){ + XBT_DEBUG("Different state of action"); + return 1; + } + + if(xbt_fifo_size(action1->request_list) != xbt_fifo_size(action2->request_list)){ + XBT_DEBUG("Different size of request list (%d - %d", xbt_fifo_size(action1->request_list), xbt_fifo_size(action2->request_list)); + return 1; + }else{ + + item_req1 = xbt_fifo_get_first_item(action1->request_list); + item_req2 = xbt_fifo_get_first_item(action2->request_list); + + while(jrequest_list)){ + + req1 = (smx_req_t) xbt_fifo_get_item_content(item_req1); + req2 = (smx_req_t) xbt_fifo_get_item_content(item_req2); + + if(req1->call != req2->call){ + XBT_DEBUG("Different request call in request_list of action (%d - %d)", req1->call, req2->call); + return 1; + } + if(req1->issuer->pid != req2->issuer->pid){ + XBT_DEBUG("Different request issuer in request_list of action (%lu- %lu)", req1->issuer->pid, req2->issuer->pid); + return 1; + } + + item_req1 = xbt_fifo_get_next_item(item_req1); + item_req2 = xbt_fifo_get_next_item(item_req2); + j++; + + } + } + + switch(action1->type){ + case 0: /* execution */ + case 1: /* parallel execution */ + if(strcmp(action1->execution.host->name, action2->execution.host->name) != 0) + return 1; + break; + case 2: /* comm */ + if(action1->comm.type != action2->comm.type) + return 1; + //XBT_DEBUG("Type of comm : %d", action1->comm.type); + + switch(action1->comm.type){ + case 0: /* SEND */ + if(action1->comm.src_proc->pid != action2->comm.src_proc->pid) + return 1; + if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0) + return 1; + break; + case 1: /* RECEIVE */ + if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid) + return 1; + if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0) + return 1; + break; + case 2: /* READY */ + if(action1->comm.src_proc->pid != action2->comm.src_proc->pid) + return 1; + if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0) + return 1; + if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid) + return 1; + if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0) + return 1; + break; + case 3: /* DONE */ + if(action1->comm.src_proc->pid != action2->comm.src_proc->pid) + return 1; + if(strcmp(action1->comm.src_proc->smx_host->name, action2->comm.src_proc->smx_host->name) != 0) + return 1; + if(action1->comm.dst_proc->pid != action2->comm.dst_proc->pid) + return 1; + if(strcmp(action1->comm.dst_proc->smx_host->name, action2->comm.dst_proc->smx_host->name) != 0) + return 1; + break; + + } /* end of switch on type of comm */ + + if(action1->comm.refcount != action2->comm.refcount) + return 1; + if(action1->comm.detached != action2->comm.detached) + return 1; + if(action1->comm.rate != action2->comm.rate) + return 1; + if(action1->comm.task_size != action2->comm.task_size) + return 1; + if(action1->comm.src_buff != action2->comm.src_buff) + return 1; + if(action1->comm.dst_buff != action2->comm.dst_buff) + return 1; + if(action1->comm.src_data != action2->comm.src_data) + return 1; + if(action1->comm.dst_data != action2->comm.dst_data) + return 1; + + break; + case 3: /* sleep */ + if(strcmp(action1->sleep.host->name, action2->sleep.host->name) != 0) + return 1; + break; + case 4: /* synchro */ + + break; + default: + break; + } + + item1 = xbt_fifo_get_next_item(item1); + item2 = xbt_fifo_get_next_item(item2); + i++; + } + } + } + } + + return 0; + +} + void set_pair_reached(xbt_state_t st){ @@@ -352,7 -237,6 +352,7 @@@ pair->automaton_state = st; pair->prop_ato = xbt_dynar_new(sizeof(int), NULL); pair->system_state = xbt_new0(s_mc_snapshot_t, 1); + //pair->rdv_points = xbt_dict_new(); MC_take_snapshot_liveness(pair->system_state); /* Get values of propositional symbols */ @@@ -366,38 -250,13 +366,38 @@@ res = (*f)(); xbt_dynar_push_as(pair->prop_ato, int, res); } - + + /*xbt_dict_t rdv_points = SIMIX_get_rdv_points(); + + xbt_dict_cursor_t cursor_dict = NULL; + char *key; + char *data; + xbt_fifo_item_t item; + smx_action_t action; + + xbt_dict_foreach(rdv_points, cursor_dict, key, data){ + smx_rdv_t new_rdv = xbt_new0(s_smx_rvpoint_t, 1); + new_rdv->name = strdup(((smx_rdv_t)data)->name); + new_rdv->comm_fifo = xbt_fifo_new(); + xbt_fifo_foreach(((smx_rdv_t)data)->comm_fifo, item, action, smx_action_t) { + smx_action_t a = xbt_new0(s_smx_action_t, 1); + memcpy(a, action, sizeof(s_smx_action_t)); + xbt_fifo_push(new_rdv->comm_fifo, a); + XBT_DEBUG("New action (type = %d, state = %d) in mailbox \"%s\"", action->type, action->state, key); + if(action->type==2) + XBT_DEBUG("Type of communication : %d, Ref count = %d", action->comm.type, action->comm.refcount); + } + //new_rdv->comm_fifo = xbt_fifo_copy(((smx_rdv_t)data)->comm_fifo); + xbt_dict_set(pair->rdv_points, new_rdv->name, new_rdv, NULL); + }*/ + xbt_dynar_push(reached_pairs, &pair); MC_UNSET_RAW_MEM; } + int reached_hash(xbt_state_t st){ @@@ -789,6 -648,9 +789,6 @@@ int MC_automaton_evaluate_label(xbt_exp } - - - /********************* Double-DFS stateless *******************/ void MC_pair_stateless_delete(mc_pair_stateless_t pair){ @@@ -908,7 -770,7 +908,7 @@@ void MC_ddfs(int search_cycle) int value; mc_state_t next_graph_state = NULL; - smx_req_t req = NULL; + smx_simcall_t req = NULL; char *req_str; xbt_transition_t transition_succ; @@@ -940,7 -802,7 +940,7 @@@ MC_state_set_executed_request(current_pair->graph_state, req, value); /* Answer the request */ - SIMIX_request_pre(req, value); + SIMIX_simcall_pre(req, value); /* Wait for requests (schedules processes) */ MC_wait_for_requests(); diff --combined src/mc/private.h index 3295b0f5d3,d35bbddca3..3c7006030e --- a/src/mc/private.h +++ b/src/mc/private.h @@@ -18,9 -18,6 +18,9 @@@ #include "../simix/private.h" #include "xbt/automaton.h" #include "xbt/hash.h" +#include "msg/msg.h" +#include "msg/datatypes.h" +#include "simix/datatypes.h" /****************************** Snapshots ***********************************/ @@@ -56,21 -53,21 +56,21 @@@ void MC_replay(xbt_fifo_t stack) void MC_replay_liveness(xbt_fifo_t stack, int all_stack); void MC_wait_for_requests(void); void MC_get_enabled_processes(); - void MC_show_deadlock(smx_req_t req); - void MC_show_deadlock_stateful(smx_req_t req); + void MC_show_deadlock(smx_simcall_t req); + void MC_show_deadlock_stateful(smx_simcall_t req); void MC_show_stack_safety_stateless(xbt_fifo_t stack); void MC_dump_stack_safety_stateless(xbt_fifo_t stack); void MC_show_stack_safety_stateful(xbt_fifo_t stack); void MC_dump_stack_safety_stateful(xbt_fifo_t stack); /********************************* Requests ***********************************/ - int MC_request_depend(smx_req_t req1, smx_req_t req2); - char* MC_request_to_string(smx_req_t req, int value); - unsigned int MC_request_testany_fail(smx_req_t req); + int MC_request_depend(smx_simcall_t req1, smx_simcall_t req2); + char* MC_request_to_string(smx_simcall_t req, int value); + unsigned int MC_request_testany_fail(smx_simcall_t req); /*int MC_waitany_is_enabled_by_comm(smx_req_t req, unsigned int comm);*/ - int MC_request_is_visible(smx_req_t req); - int MC_request_is_enabled(smx_req_t req); - int MC_request_is_enabled_by_idx(smx_req_t req, unsigned int idx); + int MC_request_is_visible(smx_simcall_t req); + int MC_request_is_enabled(smx_simcall_t req); + int MC_request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx); int MC_process_is_enabled(smx_process_t process); @@@ -94,8 -91,8 +94,8 @@@ typedef struct mc_state unsigned long max_pid; /* Maximum pid at state's creation time */ mc_procstate_t proc_status; /* State's exploration status by process */ s_smx_action_t internal_comm; /* To be referenced by the internal_req */ - s_smx_req_t internal_req; /* Internal translation of request */ - s_smx_req_t executed_req; /* The executed request of the state */ + s_smx_simcall_t internal_req; /* Internal translation of request */ + s_smx_simcall_t executed_req; /* The executed request of the state */ int req_num; /* The request number (in the case of a multi-request like waitany ) */ } s_mc_state_t, *mc_state_t; @@@ -107,10 -104,10 +107,10 @@@ void MC_state_delete(mc_state_t state) void MC_state_interleave_process(mc_state_t state, smx_process_t process); unsigned int MC_state_interleave_size(mc_state_t state); int MC_state_process_is_done(mc_state_t state, smx_process_t process); - void MC_state_set_executed_request(mc_state_t state, smx_req_t req, int value); - smx_req_t MC_state_get_executed_request(mc_state_t state, int *value); - smx_req_t MC_state_get_internal_request(mc_state_t state); - smx_req_t MC_state_get_request(mc_state_t state, int *value); + void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, int value); + smx_simcall_t MC_state_get_executed_request(mc_state_t state, int *value); + smx_simcall_t MC_state_get_internal_request(mc_state_t state); + smx_simcall_t MC_state_get_request(mc_state_t state, int *value); /****************************** Statistics ************************************/ typedef struct mc_stats { @@@ -224,7 -221,6 +224,7 @@@ typedef struct s_mc_pair_reached xbt_state_t automaton_state; xbt_dynar_t prop_ato; mc_snapshot_t system_state; + //xbt_dict_t rdv_points; }s_mc_pair_reached_t, *mc_pair_reached_t; typedef struct s_mc_pair_visited{ @@@ -247,8 -243,6 +247,8 @@@ typedef struct s_mc_pair_reached_hash unsigned int *hash_regions; }s_mc_pair_reached_hash_t, *mc_pair_reached_hash_t; + + int MC_automaton_evaluate_label(xbt_exp_label_t l); mc_pair_t new_pair(mc_snapshot_t sn, mc_state_t sg, xbt_state_t st); @@@ -265,7 -259,6 +265,7 @@@ void set_pair_visited(xbt_state_t st, i int visited_hash(xbt_state_t st, int search_cycle); void set_pair_visited_hash(xbt_state_t st, int search_cycle); unsigned int hash_region(char *str, int str_len); +int rdv_points_compare(xbt_dict_t d1, xbt_dict_t d2); /* **** Double-DFS stateless **** */ diff --combined src/simix/smx_network.c index 475db0a20f,d234bb34ce..6c52ac7a86 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@@ -4,7 -4,7 +4,7 @@@ /* 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. */ - #include "private.h" + #include "smx_private.h" #include "xbt/log.h" #include "mc/mc.h" #include "xbt/dict.h" @@@ -15,11 -15,11 +15,11 @@@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_n static xbt_dict_t rdv_points = NULL; unsigned long int smx_total_comms = 0; - static void SIMIX_waitany_req_remove_from_actions(smx_req_t req); + static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall); static void SIMIX_comm_copy_data(smx_action_t comm); static smx_action_t SIMIX_comm_new(e_smx_comm_type_t type); static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm); - static smx_action_t SIMIX_rdv_get_request(smx_rdv_t rdv, e_smx_comm_type_t type, + static smx_action_t SIMIX_rdv_get_comm(smx_rdv_t rdv, e_smx_comm_type_t type, int (*match_fun)(void *, void *), void *); static void SIMIX_rdv_free(void *data); @@@ -39,7 -39,7 +39,7 @@@ void SIMIX_network_exit(void smx_rdv_t SIMIX_rdv_create(const char *name) { - /* two processes may have pushed the same rdv_create request at the same time */ + /* two processes may have pushed the same rdv_create simcall at the same time */ smx_rdv_t rdv = name ? xbt_dict_get_or_null(rdv_points, name) : NULL; if (!rdv) { @@@ -67,11 -67,6 +67,11 @@@ void SIMIX_rdv_free(void *data xbt_free(rdv); } +xbt_dict_t SIMIX_get_rdv_points() +{ + return rdv_points; +} + smx_rdv_t SIMIX_rdv_get_by_name(const char *name) { return xbt_dict_get_or_null(rdv_points, name); @@@ -97,9 -92,9 +97,9 @@@ smx_action_t SIMIX_rdv_get_head(smx_rdv } /** - * \brief Push a communication request into a rendez-vous point + * \brief Pushes a communication action into a rendez-vous point * \param rdv The rendez-vous point - * \param comm The communication request + * \param comm The communication action */ static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm) { @@@ -108,9 -103,9 +108,9 @@@ } /** - * \brief Remove a communication request from a rendez-vous point + * \brief Removes a communication action from a rendez-vous point * \param rdv The rendez-vous point - * \param comm The communication request + * \param comm The communication action */ XBT_INLINE void SIMIX_rdv_remove(smx_rdv_t rdv, smx_action_t comm) { @@@ -119,10 -114,10 +119,10 @@@ } /** - * \brief Wrapper to SIMIX_rdv_get_request + * \brief Wrapper to SIMIX_rdv_get_comm */ smx_action_t SIMIX_comm_get_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data) { - return SIMIX_rdv_get_request(rdv, SIMIX_COMM_SEND, match_fun, data); + return SIMIX_rdv_get_comm(rdv, SIMIX_COMM_SEND, match_fun, data); } /** @@@ -130,21 -125,21 +130,21 @@@ * \param type The type of communication we are looking for (comm_send, comm_recv) * \return The communication action if found, NULL otherwise */ - smx_action_t SIMIX_rdv_get_request(smx_rdv_t rdv, e_smx_comm_type_t type, + smx_action_t SIMIX_rdv_get_comm(smx_rdv_t rdv, e_smx_comm_type_t type, int (*match_fun)(void *, void *), void *data) { // FIXME rewrite this function by using SIMIX_rdv_has_send/recv_match smx_action_t action; xbt_fifo_item_t item; - void* req_data = NULL; + void* comm_data = NULL; xbt_fifo_foreach(rdv->comm_fifo, item, action, smx_action_t) { if (action->comm.type == SIMIX_COMM_SEND) { - req_data = action->comm.src_data; + comm_data = action->comm.src_data; } else if (action->comm.type == SIMIX_COMM_RECEIVE) { - req_data = action->comm.dst_data; + comm_data = action->comm.dst_data; } - if (action->comm.type == type && (!match_fun || match_fun(data, req_data))) { + if (action->comm.type == type && (!match_fun || match_fun(data, comm_data))) { XBT_DEBUG("Found a matching communication action %p", action); xbt_fifo_remove_item(rdv->comm_fifo, item); xbt_fifo_free_item(item); @@@ -208,7 -203,7 +208,7 @@@ int SIMIX_comm_has_recv_match(smx_rdv_ /** * \brief Creates a new comunicate action - * \param type The type of request (comm_send, comm_recv) + * \param type The direction of communication (comm_send, comm_recv) * \return The new comunicate action */ smx_action_t SIMIX_comm_new(e_smx_comm_type_t type) @@@ -310,9 -305,9 +310,9 @@@ smx_action_t SIMIX_comm_isend(smx_proce { smx_action_t action; - /* Look for communication request matching our needs. + /* Look for communication action matching our needs. If it is not found then create it and push it into the rendez-vous point */ - action = SIMIX_rdv_get_request(rdv, SIMIX_COMM_RECEIVE, match_fun, data); + action = SIMIX_rdv_get_comm(rdv, SIMIX_COMM_RECEIVE, match_fun, data); if (!action) { action = SIMIX_comm_new(SIMIX_COMM_SEND); @@@ -333,7 -328,7 +333,7 @@@ action->comm.clean_fun = NULL; } - /* Setup the communication request */ + /* Setup the communication action */ action->comm.src_proc = src_proc; action->comm.task_size = task_size; action->comm.rate = rate; @@@ -356,10 -351,10 +356,10 @@@ smx_action_t SIMIX_comm_irecv(smx_proce { smx_action_t action; - /* Look for communication request matching our needs. + /* Look for communication action matching our needs. * If it is not found then create it and push it into the rendez-vous point */ - action = SIMIX_rdv_get_request(rdv, SIMIX_COMM_SEND, match_fun, data); + action = SIMIX_rdv_get_comm(rdv, SIMIX_COMM_SEND, match_fun, data); if (!action) { action = SIMIX_comm_new(SIMIX_COMM_RECEIVE); @@@ -370,7 -365,7 +370,7 @@@ } xbt_fifo_push(dst_proc->comms, action); - /* Setup communication request */ + /* Setup communication action */ action->comm.dst_proc = dst_proc; action->comm.dst_buff = dst_buff; action->comm.dst_buff_size = dst_buff_size; @@@ -385,26 -380,26 +385,26 @@@ return action; } - void SIMIX_pre_comm_wait(smx_req_t req, smx_action_t action, double timeout, int idx) + void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout, int idx) { - /* the request may be a wait, a send or a recv */ + /* the simcall may be a wait, a send or a recv */ surf_action_t sleep; - /* Associate this request to the action */ - xbt_fifo_push(action->request_list, req); - req->issuer->waiting_action = action; + /* Associate this simcall to the wait action */ + xbt_fifo_push(action->simcalls, simcall); + simcall->issuer->waiting_action = action; if (MC_IS_ENABLED) { if (idx == 0) { action->state = SIMIX_DONE; } else { - /* If we reached this point, the wait request must have a timeout */ + /* If we reached this point, the wait simcall must have a timeout */ /* Otherwise it shouldn't be enabled and executed by the MC */ if (timeout == -1) THROW_IMPOSSIBLE; - if (action->comm.src_proc == req->issuer) + if (action->comm.src_proc == simcall->issuer) action->state = SIMIX_SRC_TIMEOUT; else action->state = SIMIX_DST_TIMEOUT; @@@ -419,90 -414,90 +419,90 @@@ if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING) { SIMIX_comm_finish(action); } else { /* if (timeout >= 0) { we need a surf sleep action even when there is no timeout, otherwise surf won't tell us when the host fails */ - sleep = surf_workstation_model->extension.workstation.sleep(req->issuer->smx_host->host, timeout); + sleep = surf_workstation_model->extension.workstation.sleep(simcall->issuer->smx_host->host, timeout); surf_workstation_model->action_data_set(sleep, action); - if (req->issuer == action->comm.src_proc) + if (simcall->issuer == action->comm.src_proc) action->comm.src_timeout = sleep; else action->comm.dst_timeout = sleep; } } - void SIMIX_pre_comm_test(smx_req_t req) + void SIMIX_pre_comm_test(smx_simcall_t simcall) { - smx_action_t action = req->comm_test.comm; + smx_action_t action = simcall->comm_test.comm; if(MC_IS_ENABLED){ - req->comm_test.result = action->comm.src_proc && action->comm.dst_proc; - if(req->comm_test.result){ + simcall->comm_test.result = action->comm.src_proc && action->comm.dst_proc; + if(simcall->comm_test.result){ action->state = SIMIX_DONE; - xbt_fifo_push(action->request_list, req); + xbt_fifo_push(action->simcalls, simcall); SIMIX_comm_finish(action); }else{ - SIMIX_request_answer(req); + SIMIX_simcall_answer(simcall); } return; } - req->comm_test.result = (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING); - if (req->comm_test.result) { - xbt_fifo_push(action->request_list, req); + simcall->comm_test.result = (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING); + if (simcall->comm_test.result) { + xbt_fifo_push(action->simcalls, simcall); SIMIX_comm_finish(action); } else { - SIMIX_request_answer(req); + SIMIX_simcall_answer(simcall); } } - void SIMIX_pre_comm_testany(smx_req_t req, int idx) + void SIMIX_pre_comm_testany(smx_simcall_t simcall, int idx) { unsigned int cursor; smx_action_t action; - xbt_dynar_t actions = req->comm_testany.comms; - req->comm_testany.result = -1; + xbt_dynar_t actions = simcall->comm_testany.comms; + simcall->comm_testany.result = -1; if (MC_IS_ENABLED){ if(idx == -1){ - SIMIX_request_answer(req); + SIMIX_simcall_answer(simcall); }else{ action = xbt_dynar_get_as(actions, idx, smx_action_t); - req->comm_testany.result = idx; - xbt_fifo_push(action->request_list, req); + simcall->comm_testany.result = idx; + xbt_fifo_push(action->simcalls, simcall); action->state = SIMIX_DONE; SIMIX_comm_finish(action); } return; } - xbt_dynar_foreach(req->comm_testany.comms,cursor,action) { + xbt_dynar_foreach(simcall->comm_testany.comms,cursor,action) { if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING) { - req->comm_testany.result = cursor; - xbt_fifo_push(action->request_list, req); + simcall->comm_testany.result = cursor; + xbt_fifo_push(action->simcalls, simcall); SIMIX_comm_finish(action); return; } } - SIMIX_request_answer(req); + SIMIX_simcall_answer(simcall); } - void SIMIX_pre_comm_waitany(smx_req_t req, int idx) + void SIMIX_pre_comm_waitany(smx_simcall_t simcall, int idx) { smx_action_t action; unsigned int cursor = 0; - xbt_dynar_t actions = req->comm_waitany.comms; + xbt_dynar_t actions = simcall->comm_waitany.comms; if (MC_IS_ENABLED){ action = xbt_dynar_get_as(actions, idx, smx_action_t); - xbt_fifo_push(action->request_list, req); - req->comm_waitany.result = idx; + xbt_fifo_push(action->simcalls, simcall); + simcall->comm_waitany.result = idx; action->state = SIMIX_DONE; SIMIX_comm_finish(action); return; } xbt_dynar_foreach(actions, cursor, action){ - /* associate this request to the the action */ - xbt_fifo_push(action->request_list, req); + /* associate this simcall to the the action */ + xbt_fifo_push(action->simcalls, simcall); /* see if the action is already finished */ if (action->state != SIMIX_WAITING && action->state != SIMIX_RUNNING){ @@@ -512,22 -507,21 +512,21 @@@ } } - void SIMIX_waitany_req_remove_from_actions(smx_req_t req) + void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall) { smx_action_t action; unsigned int cursor = 0; - xbt_dynar_t actions = req->comm_waitany.comms; + xbt_dynar_t actions = simcall->comm_waitany.comms; - xbt_dynar_foreach(actions, cursor, action){ - xbt_fifo_remove(action->request_list, req); + xbt_dynar_foreach(actions, cursor, action) { + xbt_fifo_remove(action->simcalls, simcall); } } /** - * \brief Start the simulation of a communication request - * \param action The communication action + * \brief Starts the simulation of a communication action. + * \param action the communication action */ - XBT_INLINE void SIMIX_comm_start(smx_action_t action) { /* If both the sender and the receiver are already there, start the communication */ @@@ -565,24 -559,24 +564,24 @@@ } /** - * \brief Answers the SIMIX requests associated to a communication action. + * \brief Answers the SIMIX simcalls associated to a communication action. * \param action a finished communication action */ void SIMIX_comm_finish(smx_action_t action) { volatile unsigned int destroy_count = 0; - smx_req_t req; + smx_simcall_t simcall; - while ((req = xbt_fifo_shift(action->request_list))) { + while ((simcall = xbt_fifo_shift(action->simcalls))) { - /* If a waitany request is waiting for this action to finish, then remove + /* If a waitany simcall is waiting for this action to finish, then remove it from the other actions in the waitany list. Afterwards, get the - position of the actual action in the waitany request's actions dynar and - return it as the result of the call */ - if (req->call == REQ_COMM_WAITANY) { - SIMIX_waitany_req_remove_from_actions(req); + position of the actual action in the waitany dynar and + 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) - req->comm_waitany.result = xbt_dynar_search(req->comm_waitany.comms, &action); + simcall->comm_waitany.result = xbt_dynar_search(simcall->comm_waitany.comms, &action); } /* If the action is still in a rendez-vous point then remove from it */ @@@ -603,8 -597,8 +602,8 @@@ TRY { THROWF(timeout_error, 0, "Communication timeouted because of sender"); } - CATCH(req->issuer->running_ctx->exception) { - req->issuer->doexception = 1; + CATCH(simcall->issuer->running_ctx->exception) { + simcall->issuer->doexception = 1; } break; @@@ -612,32 -606,32 +611,32 @@@ TRY { THROWF(timeout_error, 0, "Communication timeouted because of receiver"); } - CATCH(req->issuer->running_ctx->exception) { - req->issuer->doexception = 1; + CATCH(simcall->issuer->running_ctx->exception) { + simcall->issuer->doexception = 1; } break; case SIMIX_SRC_HOST_FAILURE: TRY { - if (req->issuer == action->comm.src_proc) + if (simcall->issuer == action->comm.src_proc) THROWF(host_error, 0, "Host failed"); else THROWF(network_error, 0, "Remote peer failed"); } - CATCH(req->issuer->running_ctx->exception) { - req->issuer->doexception = 1; + CATCH(simcall->issuer->running_ctx->exception) { + simcall->issuer->doexception = 1; } break; case SIMIX_DST_HOST_FAILURE: TRY { - if (req->issuer == action->comm.dst_proc) + if (simcall->issuer == action->comm.dst_proc) THROWF(host_error, 0, "Host failed"); else THROWF(network_error, 0, "Remote peer failed"); } - CATCH(req->issuer->running_ctx->exception) { - req->issuer->doexception = 1; + CATCH(simcall->issuer->running_ctx->exception) { + simcall->issuer->doexception = 1; } break; @@@ -647,32 -641,32 +646,32 @@@ action, action->comm.src_proc ? action->comm.src_proc->smx_host->name : NULL, action->comm.dst_proc ? action->comm.dst_proc->smx_host->name : NULL, - req->issuer->name, req->issuer, action->comm.detached); - if (action->comm.src_proc == req->issuer) { + simcall->issuer->name, simcall->issuer, action->comm.detached); + if (action->comm.src_proc == simcall->issuer) { XBT_DEBUG("I'm source"); - } else if (action->comm.dst_proc == req->issuer) { + } else if (action->comm.dst_proc == simcall->issuer) { XBT_DEBUG("I'm dest"); } else { XBT_DEBUG("I'm neither source nor dest"); } THROWF(network_error, 0, "Link failure"); } - CATCH(req->issuer->running_ctx->exception) { - req->issuer->doexception = 1; + CATCH(simcall->issuer->running_ctx->exception) { + simcall->issuer->doexception = 1; } break; case SIMIX_CANCELED: TRY { - if (req->issuer == action->comm.dst_proc) { + if (simcall->issuer == action->comm.dst_proc) { THROWF(cancel_error, 0, "Communication canceled by the sender"); } else { THROWF(cancel_error, 0, "Communication canceled by the receiver"); } } - CATCH(req->issuer->running_ctx->exception) { - req->issuer->doexception = 1; + CATCH(simcall->issuer->running_ctx->exception) { + simcall->issuer->doexception = 1; } break; @@@ -681,18 -675,18 +680,18 @@@ } /* if there is an exception during a waitany or a testany, indicate the position of the failed communication */ - if (req->issuer->doexception) { - if (req->call == REQ_COMM_WAITANY) { - req->issuer->running_ctx->exception.value = xbt_dynar_search(req->comm_waitany.comms, &action); + if (simcall->issuer->doexception) { + if (simcall->call == SIMCALL_COMM_WAITANY) { + simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall->comm_waitany.comms, &action); } - else if (req->call == REQ_COMM_TESTANY) { - req->issuer->running_ctx->exception.value = xbt_dynar_search(req->comm_testany.comms, &action); + else if (simcall->call == SIMCALL_COMM_TESTANY) { + simcall->issuer->running_ctx->exception.value = xbt_dynar_search(simcall->comm_testany.comms, &action); } } - req->issuer->waiting_action = NULL; - xbt_fifo_remove(req->issuer->comms, action); - SIMIX_request_answer(req); + simcall->issuer->waiting_action = NULL; + xbt_fifo_remove(simcall->issuer->comms, action); + SIMIX_simcall_answer(simcall); destroy_count++; } @@@ -741,8 -735,8 +740,8 @@@ void SIMIX_post_comm(smx_action_t actio xbt_fifo_remove(action->comm.dst_proc->comms, action); } - /* if there are requests associated with the action, then answer them */ - if (xbt_fifo_size(action->request_list)) { + /* if there are simcalls associated with the action, then answer them */ + if (xbt_fifo_size(action->simcalls)) { SIMIX_comm_finish(action); } }