Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill 4 more getter simcalls
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 9 May 2016 18:45:30 +0000 (20:45 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 9 May 2016 18:45:30 +0000 (20:45 +0200)
12 files changed:
include/simgrid/simix.h
src/msg/msg_gos.cpp
src/msg/msg_mailbox.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_enum.h
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_network.cpp
src/simix/smx_network_private.h
src/smpi/smpi_base.cpp

index 4b7d955..77aeb08 100644 (file)
@@ -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);
 
index d4f3d7f..1867677 100644 (file)
@@ -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<simgrid::simix::Comm*>(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);
   }
 }
 
index 90d2896..1594821 100644 (file)
@@ -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<simgrid::simix::Comm*>(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)
index 7808a11..fe211b6 100644 (file)
@@ -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
  *
index edf29a8..f59b4b1 100644 (file)
@@ -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;
 }
index 44f5cd5..04cf2e5 100644 (file)
@@ -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();
 
index 1228fd0..42156ce 100644 (file)
@@ -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,
index 9bc3bb2..23d99fd 100644 (file)
@@ -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);
index f63fa0d..3dd9ca7 100644 (file)
@@ -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)
index 6ba9c3b..60e7900 100644 (file)
@@ -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<simgrid::simix::Comm*>(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<simgrid::simix::Comm*>(synchro);
-
-  return comm->dst_data;
-}
-
-smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro)
-{
-  simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
-  return comm->src_proc;
-}
-
-smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro)
-{
-  simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
-  return comm->dst_proc;
-}
-
 /******************************************************************************/
 /*                    SIMIX_comm_copy_data callbacks                       */
 /******************************************************************************/
index 5348478..8a60c4c 100644 (file)
@@ -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
 
index 613e098..a8e8409 100644 (file)
@@ -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<simgrid::simix::Comm*>(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);