From: Martin Quinson Date: Wed, 15 Feb 2017 23:35:50 +0000 (+0100) Subject: kill some useless getter simcalls X-Git-Tag: v3_15~366 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e3d5991eca6de3227dcd3efc36a0f415a45aedf9 kill some useless getter simcalls They were rather misleading since they did not do any simcall, actually. The code around the getters of data in the actors is still somehow magical: smpi_switch_data_segment((static_cast((static_cast(comm->dst_proc->data)->data))->index)); I love this one. Once I'm done, it will become: smpi_switch_data_segment(comm->dst_proc->extension()->index); I pretend that it is clearer. Maybe to me only? :-3 --- diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 4105374820..b2b8b32d0c 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -279,7 +279,6 @@ XBT_PUBLIC(void) simcall_process_resume(smx_actor_t process); /* Getters and Setters */ XBT_PUBLIC(int) simcall_process_count(); -XBT_PUBLIC(void *) simcall_process_get_data(smx_actor_t process); XBT_PUBLIC(void) simcall_process_set_data(smx_actor_t process, void *data); XBT_PUBLIC(void) simcall_process_set_host(smx_actor_t process, sg_host_t dest); XBT_PUBLIC(int) simcall_process_is_suspended(smx_actor_t process); diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index d02ae9c7ae..e5e089a614 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -34,7 +34,7 @@ void MSG_process_cleanup_from_SIMIX(smx_actor_t smx_proc) msg_proc = (simdata_process_t) SIMIX_process_self_get_data(); SIMIX_process_self_set_data(nullptr); } else { - msg_proc = (simdata_process_t) simcall_process_get_data(smx_proc); + msg_proc = (simdata_process_t)smx_proc->data; simcall_process_set_data(smx_proc, nullptr); } @@ -241,7 +241,7 @@ msg_error_t MSG_process_join(msg_process_t process, double timeout){ */ msg_error_t MSG_process_migrate(msg_process_t process, msg_host_t host) { - simdata_process_t simdata = (simdata_process_t) simcall_process_get_data(process); + simdata_process_t simdata = (simdata_process_t)process->data; simdata->m_host = host; msg_host_t now = simdata->m_host; TRACE_msg_process_change_host(process, now, host); @@ -265,7 +265,7 @@ void* MSG_process_get_data(msg_process_t process) xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); /* get from SIMIX the MSG process data, and then the user data */ - simdata_process_t simdata = (simdata_process_t) simcall_process_get_data(process); + simdata_process_t simdata = (simdata_process_t)process->data; if (simdata) return simdata->data; else @@ -281,7 +281,7 @@ msg_error_t MSG_process_set_data(msg_process_t process, void *data) { xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); - simdata_process_t simdata = (simdata_process_t) simcall_process_get_data(process); + simdata_process_t simdata = (simdata_process_t)process->data; simdata->data = data; return MSG_OK; @@ -307,7 +307,7 @@ msg_host_t MSG_process_get_host(msg_process_t process) simdata = (simdata_process_t) SIMIX_process_self_get_data(); } else { - simdata = (simdata_process_t) simcall_process_get_data(process); + simdata = (simdata_process_t)process->data; } return simdata ? simdata->m_host : nullptr; } diff --git a/src/simix/ActorImpl.cpp b/src/simix/ActorImpl.cpp index 7ae8a534db..4aaa713504 100644 --- a/src/simix/ActorImpl.cpp +++ b/src/simix/ActorImpl.cpp @@ -644,7 +644,7 @@ void* SIMIX_process_self_get_data() if (!self) { return nullptr; } - return SIMIX_process_get_data(self); + return self->data; } void SIMIX_process_self_set_data(void *data) @@ -654,11 +654,6 @@ void SIMIX_process_self_set_data(void *data) SIMIX_process_set_data(self, data); } -void* SIMIX_process_get_data(smx_actor_t process) -{ - return process->data; -} - void SIMIX_process_set_data(smx_actor_t process, void *data) { process->data = data; diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index e31313d1d5..add8ca3aca 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -120,7 +120,6 @@ XBT_PRIVATE void SIMIX_process_change_host(smx_actor_t process, sg_host_t dest); XBT_PRIVATE smx_activity_t SIMIX_process_suspend(smx_actor_t process, smx_actor_t issuer); XBT_PRIVATE void SIMIX_process_resume(smx_actor_t process); XBT_PRIVATE int SIMIX_process_get_PID(smx_actor_t self); -XBT_PRIVATE void* SIMIX_process_get_data(smx_actor_t process); XBT_PRIVATE void SIMIX_process_set_data(smx_actor_t process, void *data); XBT_PRIVATE smx_actor_t SIMIX_process_get_by_name(const char* name); XBT_PRIVATE int SIMIX_process_is_suspended(smx_actor_t process); diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index bbc509cc4f..d97e17a34c 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -251,17 +251,6 @@ int simcall_process_count() return simgrid::simix::kernelImmediate(SIMIX_process_count); } -/** - * \ingroup simix_process_management - * \brief Return the user data of a #smx_actor_t. - * \param process a SIMIX process - * \return the user data of this process - */ -void* simcall_process_get_data(smx_actor_t process) -{ - return SIMIX_process_get_data(process); -} - /** * \ingroup simix_process_management * \brief Set the user data of a #smx_actor_t. diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index 47a3374dec..3bdbfe7808 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -133,8 +133,7 @@ void smpi_process_init(int *argc, char ***argv) data->instance_id = instance_id; data->replaying = false; - simdata_process_t simdata = static_cast(simcall_process_get_data(proc)); - simdata->data = data; + static_cast(proc->data)->data = data; if (*argc > 3) { memmove(&(*argv)[0], &(*argv)[2], sizeof(char *) * (*argc - 2)); @@ -227,7 +226,7 @@ int smpi_global_size() smpi_process_data_t smpi_process_data() { - simdata_process_t simdata = static_cast(SIMIX_process_self_get_data()); + simdata_process_t simdata = static_cast(SIMIX_process_self()->data); return static_cast(simdata->data); } @@ -400,8 +399,8 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b ){ XBT_DEBUG("Privatization : We are copying from a zone inside global memory... Saving data to temp buffer !"); - - smpi_switch_data_segment((static_cast((static_cast(SIMIX_process_get_data(comm->src_proc))->data))->index)); + smpi_switch_data_segment( + (static_cast((static_cast(comm->src_proc->data)->data))->index)); tmpbuff = static_cast(xbt_malloc(buff_size)); memcpy(tmpbuff, buff, buff_size); } @@ -409,7 +408,8 @@ void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t b if((smpi_privatize_global_variables) && ((char*)comm->dst_buff >= smpi_start_data_exe) && ((char*)comm->dst_buff < smpi_start_data_exe + smpi_size_data_exe )){ XBT_DEBUG("Privatization : We are copying to a zone inside global memory - Switch data segment"); - smpi_switch_data_segment((static_cast((static_cast(SIMIX_process_get_data(comm->dst_proc))->data))->index)); + smpi_switch_data_segment( + (static_cast((static_cast(comm->dst_proc->data)->data))->index)); } memcpy(comm->dst_buff, tmpbuff, buff_size);