From b9bd3bea7e7a0ad74c2e978c2e8fcb21b370862c Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 9 May 2016 20:45:30 +0200 Subject: [PATCH] kill 4 more getter simcalls --- include/simgrid/simix.h | 9 ---- src/msg/msg_gos.cpp | 8 ++-- src/msg/msg_mailbox.cpp | 4 +- src/simix/libsmx.cpp | 36 -------------- src/simix/popping_accessors.h | 52 -------------------- src/simix/popping_bodies.cpp | 84 --------------------------------- src/simix/popping_enum.h | 4 -- src/simix/popping_generated.cpp | 24 ---------- src/simix/simcalls.in | 4 -- src/simix/smx_network.cpp | 40 ---------------- src/simix/smx_network_private.h | 2 - src/smpi/smpi_base.cpp | 3 +- 12 files changed, 9 insertions(+), 261 deletions(-) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 4b7d95519b..77aeb08b08 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -137,9 +137,6 @@ typedef smx_process_t (*smx_creation_func_t) ( */ typedef struct s_smx_mailbox *smx_mailbox_t; -XBT_PUBLIC(void*) SIMIX_comm_get_src_data(smx_synchro_t synchro); -XBT_PUBLIC(void*) SIMIX_comm_get_dst_data(smx_synchro_t synchro); - /* Process creation/destruction callbacks */ typedef void (*void_pfn_smxprocess_t) (smx_process_t); /* for auto-restart function */ @@ -394,12 +391,6 @@ XBT_PUBLIC(void) simcall_comm_wait(smx_synchro_t comm, double timeout); XBT_PUBLIC(int) simcall_comm_test(smx_synchro_t comm); XBT_PUBLIC(int) simcall_comm_testany(xbt_dynar_t comms); -/* Getters and setters */ -XBT_PUBLIC(void *) simcall_comm_get_src_data(smx_synchro_t comm); -XBT_PUBLIC(void *) simcall_comm_get_dst_data(smx_synchro_t comm); -XBT_PUBLIC(smx_process_t) simcall_comm_get_src_proc(smx_synchro_t comm); -XBT_PUBLIC(smx_process_t) simcall_comm_get_dst_proc(smx_synchro_t comm); - /************************** Tracing handling **********************************/ XBT_PUBLIC(void) simcall_set_category(smx_synchro_t synchro, const char *category); diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index d4f3d7f683..1867677b68 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -733,14 +733,16 @@ msg_task_t MSG_comm_get_task(msg_comm_t comm) * \param buff the data copied * \param buff_size size of the buffer */ -void MSG_comm_copy_data_from_SIMIX(smx_synchro_t comm, void* buff, size_t buff_size) { - // copy the task +void MSG_comm_copy_data_from_SIMIX(smx_synchro_t synchro, void* buff, size_t buff_size) +{ + simgrid::simix::Comm *comm = static_cast(synchro); + SIMIX_comm_copy_pointer_callback(comm, buff, buff_size); // notify the user callback if any if (msg_global->task_copy_callback) { msg_task_t task = (msg_task_t) buff; - msg_global->task_copy_callback(task, simcall_comm_get_src_proc(comm), simcall_comm_get_dst_proc(comm)); + msg_global->task_copy_callback(task, comm->src_proc, comm->dst_proc); } } diff --git a/src/msg/msg_mailbox.cpp b/src/msg/msg_mailbox.cpp index 90d2896b24..1594821770 100644 --- a/src/msg/msg_mailbox.cpp +++ b/src/msg/msg_mailbox.cpp @@ -23,12 +23,12 @@ int MSG_mailbox_is_empty(msg_mailbox_t mailbox) msg_task_t MSG_mailbox_front(msg_mailbox_t mailbox) { - smx_synchro_t comm = simcall_mbox_front(mailbox); + simgrid::simix::Comm* comm = static_cast(simcall_mbox_front(mailbox)); if (!comm) return NULL; - return (msg_task_t) simcall_comm_get_src_data(comm); + return (msg_task_t) comm->src_data; } msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias) diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 7808a117d0..fe211b6c81 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -860,42 +860,6 @@ int simcall_comm_test(smx_synchro_t comm) return simcall_BODY_comm_test(comm); } -/** - * \ingroup simix_comm_management - * - */ -void *simcall_comm_get_src_data(smx_synchro_t comm) -{ - return simcall_BODY_comm_get_src_data(comm); -} - -/** - * \ingroup simix_comm_management - * - */ -void *simcall_comm_get_dst_data(smx_synchro_t comm) -{ - return simcall_BODY_comm_get_dst_data(comm); -} - -/** - * \ingroup simix_comm_management - * - */ -smx_process_t simcall_comm_get_src_proc(smx_synchro_t comm) -{ - return simcall_BODY_comm_get_src_proc(comm); -} - -/** - * \ingroup simix_comm_management - * - */ -smx_process_t simcall_comm_get_dst_proc(smx_synchro_t comm) -{ - return simcall_BODY_comm_get_dst_proc(comm); -} - /** * \ingroup simix_synchro_management * diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index edf29a8195..f59b4b1395 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -771,58 +771,6 @@ static inline void simcall_comm_testany__set__result(smx_simcall_t simcall, int simcall->result.i = result; } -static inline smx_synchro_t simcall_comm_get_src_data__get__comm(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_comm_get_src_data__set__comm(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline void* simcall_comm_get_src_data__get__result(smx_simcall_t simcall){ - return simcall->result.dp; -} -static inline void simcall_comm_get_src_data__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - -static inline smx_synchro_t simcall_comm_get_dst_data__get__comm(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_comm_get_dst_data__set__comm(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline void* simcall_comm_get_dst_data__get__result(smx_simcall_t simcall){ - return simcall->result.dp; -} -static inline void simcall_comm_get_dst_data__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - -static inline smx_synchro_t simcall_comm_get_src_proc__get__comm(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_comm_get_src_proc__set__comm(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline smx_process_t simcall_comm_get_src_proc__get__result(smx_simcall_t simcall){ - return (smx_process_t) simcall->result.dp; -} -static inline void simcall_comm_get_src_proc__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - -static inline smx_synchro_t simcall_comm_get_dst_proc__get__comm(smx_simcall_t simcall) { - return (smx_synchro_t) simcall->args[0].dp; -} -static inline void simcall_comm_get_dst_proc__set__comm(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; -} -static inline smx_process_t simcall_comm_get_dst_proc__get__result(smx_simcall_t simcall){ - return (smx_process_t) simcall->result.dp; -} -static inline void simcall_comm_get_dst_proc__set__result(smx_simcall_t simcall, void* result){ - simcall->result.dp = result; -} - static inline smx_mutex_t simcall_mutex_init__get__result(smx_simcall_t simcall){ return (smx_mutex_t) simcall->result.dp; } diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index 44f5cd503f..04cf2e50db 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -863,90 +863,6 @@ inline static int simcall_BODY_comm_testany(xbt_dynar_t comms) { return (int) self->simcall.result.i; } -inline static void* simcall_BODY_comm_get_src_data(smx_synchro_t comm) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_comm_get_src_data(comm); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_COMM_GET_SRC_DATA; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) comm; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return (void*) self->simcall.result.dp; - } - -inline static void* simcall_BODY_comm_get_dst_data(smx_synchro_t comm) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_comm_get_dst_data(comm); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_COMM_GET_DST_DATA; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) comm; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return (void*) self->simcall.result.dp; - } - -inline static smx_process_t simcall_BODY_comm_get_src_proc(smx_synchro_t comm) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_comm_get_src_proc(comm); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_COMM_GET_SRC_PROC; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) comm; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return (smx_process_t) self->simcall.result.dp; - } - -inline static smx_process_t simcall_BODY_comm_get_dst_proc(smx_synchro_t comm) { - smx_process_t self = SIMIX_process_self(); - - /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_comm_get_dst_proc(comm); - /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - - self->simcall.call = SIMCALL_COMM_GET_DST_PROC; - memset(&self->simcall.result, 0, sizeof(self->simcall.result)); - memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) comm; - if (self != simix_global->maestro_process) { - XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); - SIMIX_process_yield(self); - } else { - SIMIX_simcall_handle(&self->simcall, 0); - } - return (smx_process_t) self->simcall.result.dp; - } - inline static smx_mutex_t simcall_BODY_mutex_init() { smx_process_t self = SIMIX_process_self(); diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index 1228fd0781..42156cebe5 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -55,10 +55,6 @@ typedef enum { SIMCALL_COMM_WAIT, SIMCALL_COMM_TEST, SIMCALL_COMM_TESTANY, - SIMCALL_COMM_GET_SRC_DATA, - SIMCALL_COMM_GET_DST_DATA, - SIMCALL_COMM_GET_SRC_PROC, - SIMCALL_COMM_GET_DST_PROC, SIMCALL_MUTEX_INIT, SIMCALL_MUTEX_LOCK, SIMCALL_MUTEX_TRYLOCK, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 9bc3bb2a78..23d99fd7ba 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -60,10 +60,6 @@ const char* simcall_names[] = { "SIMCALL_COMM_WAIT", "SIMCALL_COMM_TEST", "SIMCALL_COMM_TESTANY", - "SIMCALL_COMM_GET_SRC_DATA", - "SIMCALL_COMM_GET_DST_DATA", - "SIMCALL_COMM_GET_SRC_PROC", - "SIMCALL_COMM_GET_DST_PROC", "SIMCALL_MUTEX_INIT", "SIMCALL_MUTEX_LOCK", "SIMCALL_MUTEX_TRYLOCK", @@ -284,26 +280,6 @@ case SIMCALL_COMM_TESTANY: simcall_HANDLER_comm_testany(simcall , (xbt_dynar_t) simcall->args[0].dp); break; -case SIMCALL_COMM_GET_SRC_DATA: - simcall->result.dp = SIMIX_comm_get_src_data((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_GET_DST_DATA: - simcall->result.dp = SIMIX_comm_get_dst_data((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_GET_SRC_PROC: - simcall->result.dp = SIMIX_comm_get_src_proc((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - -case SIMCALL_COMM_GET_DST_PROC: - simcall->result.dp = SIMIX_comm_get_dst_proc((smx_synchro_t) simcall->args[0].dp); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_MUTEX_INIT: simcall->result.dp = simcall_HANDLER_mutex_init(simcall ); SIMIX_simcall_answer(simcall); diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index f63fa0d852..3dd9ca7cb2 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -88,10 +88,6 @@ Blck H comm_waitany (int) (comms, void*, xbt_dynar_t) Blck H comm_wait (void) (comm, void*, smx_synchro_t) (timeout, double) Blck H comm_test (int) (comm, void*, smx_synchro_t) Blck H comm_testany (int) (comms, void*, xbt_dynar_t) -Func - comm_get_src_data (void*) (comm, void*, smx_synchro_t) -Func - comm_get_dst_data (void*) (comm, void*, smx_synchro_t) -Func - comm_get_src_proc (void*, smx_process_t) (comm, void*, smx_synchro_t) -Func - comm_get_dst_proc (void*, smx_process_t) (comm, void*, smx_synchro_t) Func H mutex_init (void*, smx_mutex_t) Blck H mutex_lock (void) (mutex, void*, smx_mutex_t) diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 6ba9c3b07f..60e790058c 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -775,46 +775,6 @@ void SIMIX_post_comm(smx_synchro_t synchro) } } -/************* synchro Getters **************/ - -/** - * \brief Return the user data associated to the sender of the communication - * \param synchro The communication - * \return the user data - */ -void* SIMIX_comm_get_src_data(smx_synchro_t synchro) -{ - simgrid::simix::Comm *comm = static_cast(synchro); - - return comm->src_data; -} - -/** - * \brief Return the user data associated to the receiver of the communication - * \param synchro The communication - * \return the user data - */ -void* SIMIX_comm_get_dst_data(smx_synchro_t synchro) -{ - simgrid::simix::Comm *comm = static_cast(synchro); - - return comm->dst_data; -} - -smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro) -{ - simgrid::simix::Comm *comm = static_cast(synchro); - - return comm->src_proc; -} - -smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro) -{ - simgrid::simix::Comm *comm = static_cast(synchro); - - return comm->dst_proc; -} - /******************************************************************************/ /* SIMIX_comm_copy_data callbacks */ /******************************************************************************/ diff --git a/src/simix/smx_network_private.h b/src/simix/smx_network_private.h index 53484785aa..8a60c4c427 100644 --- a/src/simix/smx_network_private.h +++ b/src/simix/smx_network_private.h @@ -37,8 +37,6 @@ XBT_PRIVATE void SIMIX_comm_destroy(smx_synchro_t synchro); XBT_PRIVATE smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_t mbox, int type, int src, int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data); XBT_PRIVATE void SIMIX_post_comm(smx_synchro_t synchro); -XBT_PRIVATE smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro); -XBT_PRIVATE smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro); #endif diff --git a/src/smpi/smpi_base.cpp b/src/smpi/smpi_base.cpp index 613e09817e..a8e8409604 100644 --- a/src/smpi/smpi_base.cpp +++ b/src/smpi/smpi_base.cpp @@ -856,7 +856,8 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* } if (request->action){ - MPI_Request req = (MPI_Request)SIMIX_comm_get_src_data(request->action); + simgrid::simix::Comm *sync_comm = static_cast(request->action); + MPI_Request req = (MPI_Request)sync_comm->src_data; *flag = 1; if(status != MPI_STATUS_IGNORE && !(req->flags & PREPARED)) { status->MPI_SOURCE = smpi_group_rank(smpi_comm_group(comm), req->src); -- 2.20.1