Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
prune some useless code in mailboxes
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 21 Apr 2016 19:14:18 +0000 (21:14 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 21 Apr 2016 19:14:18 +0000 (21:14 +0200)
12 files changed:
include/simgrid/simix.h
src/msg/msg_mailbox.cpp
src/msg/msg_private.h
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_global.cpp

index 508348c..db7b2d4 100644 (file)
@@ -366,7 +366,6 @@ XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration);
 /***** Rendez-vous points *****/
 
 XBT_PUBLIC(smx_mailbox_t) simcall_mbox_create(const char *name);
-XBT_PUBLIC(void) simcall_mbox_destroy(smx_mailbox_t mbox);
 XBT_PUBLIC(smx_mailbox_t) simcall_mbox_get_by_name(const char *name);
 XBT_PUBLIC(int) simcall_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host);
 XBT_PUBLIC(smx_synchro_t) simcall_mbox_get_head(smx_mailbox_t mbox);
index 5235ffb..11d04ec 100644 (file)
@@ -16,11 +16,6 @@ msg_mailbox_t MSG_mailbox_new(const char *alias)
   return simcall_mbox_create(alias);
 }
 
-void MSG_mailbox_free(void *mailbox)
-{
-  simcall_mbox_destroy((msg_mailbox_t)mailbox);
-}
-
 int MSG_mailbox_is_empty(msg_mailbox_t mailbox)
 {
   return (NULL == simcall_mbox_get_head(mailbox));
index efe693f..3edff2f 100644 (file)
@@ -148,11 +148,6 @@ XBT_PRIVATE void MSG_post_create_environment(void);
 
 XBT_PRIVATE void MSG_host_add_task(msg_host_t host, msg_task_t task);
 XBT_PRIVATE void MSG_host_del_task(msg_host_t host, msg_task_t task);
-/* @brief MSG_mailbox_free - release a mailbox from the memory.
- * Releases a mailbox from the memory but does not remove it from the dictionary.
- * @param   mailbox  The mailbox to release.
- */
-XBT_PRIVATE void MSG_mailbox_free(void *mailbox);
 
 /********** Tracing **********/
 /* declaration of instrumentation functions from msg_task_instr.c */
index 4406c4e..bf6e99b 100644 (file)
@@ -738,16 +738,6 @@ smx_mailbox_t simcall_mbox_create(const char *name)
   return simcall_BODY_mbox_create(name);
 }
 
-
-/**
- *  \ingroup simix_mbox_management
- *  \brief Destroy a rendez-vous point
- *  \param mbox The rendez-vous point to destroy
- */
-void simcall_mbox_destroy(smx_mailbox_t mbox)
-{
-  simcall_BODY_mbox_destroy(mbox);
-}
 /**
  *  \ingroup simix_mbox_management
  *  \brief Returns a rendez-vous point knowing its name
index 63b0c03..962e9b9 100644 (file)
@@ -445,13 +445,6 @@ static inline void simcall_mbox_create__set__result(smx_simcall_t simcall, void*
     simcall->result.dp = result;
 }
 
-static inline smx_mailbox_t simcall_mbox_destroy__get__mbox(smx_simcall_t simcall) {
-  return (smx_mailbox_t) simcall->args[0].dp;
-}
-static inline void simcall_mbox_destroy__set__mbox(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-
 static inline smx_mailbox_t simcall_mbox_comm_count_by_host__get__mbox(smx_simcall_t simcall) {
   return (smx_mailbox_t) simcall->args[0].dp;
 }
index 88ff816..fe0f6ac 100644 (file)
@@ -654,27 +654,6 @@ inline static smx_mailbox_t simcall_BODY_mbox_create(const char* name) {
     return (smx_mailbox_t) self->simcall.result.dp;
   }
   
-inline static void simcall_BODY_mbox_destroy(smx_mailbox_t mbox) {
-    smx_process_t self = SIMIX_process_self();
-
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_mbox_destroy(mbox);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_MBOX_DESTROY;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) mbox;
-    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);
-    }    
-    
-  }
-  
 inline static unsigned int simcall_BODY_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host) {
     smx_process_t self = SIMIX_process_self();
 
index 8dca2b7..951f227 100644 (file)
@@ -47,7 +47,6 @@ typedef enum {
   SIMCALL_PROCESS_AUTO_RESTART_SET,
   SIMCALL_PROCESS_RESTART,
   SIMCALL_MBOX_CREATE,
-  SIMCALL_MBOX_DESTROY,
   SIMCALL_MBOX_COMM_COUNT_BY_HOST,
   SIMCALL_MBOX_GET_HEAD,
   SIMCALL_MBOX_SET_RECEIVER,
index 0e5b55a..5e59209 100644 (file)
@@ -52,7 +52,6 @@ const char* simcall_names[] = {
   "SIMCALL_PROCESS_AUTO_RESTART_SET",
   "SIMCALL_PROCESS_RESTART",
   "SIMCALL_MBOX_CREATE",
-  "SIMCALL_MBOX_DESTROY",
   "SIMCALL_MBOX_COMM_COUNT_BY_HOST",
   "SIMCALL_MBOX_GET_HEAD",
   "SIMCALL_MBOX_SET_RECEIVER",
@@ -259,11 +258,6 @@ case SIMCALL_MBOX_CREATE:
       SIMIX_simcall_answer(simcall);
       break;  
 
-case SIMCALL_MBOX_DESTROY:
-       SIMIX_mbox_destroy((smx_mailbox_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
 case SIMCALL_MBOX_COMM_COUNT_BY_HOST:
       simcall->result.ui = SIMIX_mbox_comm_count_by_host((smx_mailbox_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp);
       SIMIX_simcall_answer(simcall);
index 07cc862..7da760d 100644 (file)
@@ -79,7 +79,6 @@ Proc - process_auto_restart_set (void) (process, void*, smx_process_t) (auto_res
 Func H process_restart (void*, smx_process_t) (process, void*, smx_process_t)
 
 Func - mbox_create (void*, smx_mailbox_t) (name, const char*)
-Proc - mbox_destroy (void) (mbox, void*, smx_mailbox_t)
 Func - mbox_comm_count_by_host (unsigned int) (mbox, void*, smx_mailbox_t) (host, void*, sg_host_t)
 Func - mbox_get_head (void*, smx_synchro_t) (mbox, void*, smx_mailbox_t)
 Proc - mbox_set_receiver (void) (mbox, void*, smx_mailbox_t) (receiver, void*, smx_process_t)
index b1cf01d..94df88e 100644 (file)
@@ -40,30 +40,23 @@ void SIMIX_mailbox_exit(void)
 
 smx_mailbox_t SIMIX_mbox_create(const char *name)
 {
+  xbt_assert(name, "Mailboxes must have a name");
   /* two processes may have pushed the same mbox_create simcall at the same time */
-  smx_mailbox_t mbox = name ? (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name) : NULL;
+  smx_mailbox_t mbox = (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name);
 
   if (!mbox) {
     mbox = xbt_new0(s_smx_mailbox_t, 1);
-    mbox->name = name ? xbt_strdup(name) : NULL;
+    mbox->name = xbt_strdup(name);
     mbox->comm_fifo = xbt_fifo_new();
     mbox->done_comm_fifo = xbt_fifo_new();
     mbox->permanent_receiver=NULL;
 
     XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
-
-    if (mbox->name)
-      xbt_dict_set(mailboxes, mbox->name, mbox, NULL);
+    xbt_dict_set(mailboxes, mbox->name, mbox, NULL);
   }
   return mbox;
 }
 
-void SIMIX_mbox_destroy(smx_mailbox_t mbox)
-{
-  if (mbox->name)
-    xbt_dict_remove(mailboxes, mbox->name);
-}
-
 void SIMIX_mbox_free(void *data)
 {
   XBT_DEBUG("mbox free %p", data);
index 0484c4b..80adafe 100644 (file)
@@ -24,7 +24,6 @@ typedef struct s_smx_mailbox {
 XBT_PRIVATE void SIMIX_mailbox_exit(void);
 
 XBT_PRIVATE smx_mailbox_t SIMIX_mbox_create(const char *name);
-XBT_PRIVATE void SIMIX_mbox_destroy(smx_mailbox_t mbox);
 XBT_PRIVATE smx_mailbox_t SIMIX_mbox_get_by_name(const char *name);
 XBT_PRIVATE void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_synchro_t comm);
 XBT_PRIVATE int SIMIX_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host);
index a6be249..6ef4b19 100644 (file)
@@ -460,8 +460,6 @@ void smpi_global_destroy(void)
       smpi_comm_destroy(process_data[i]->comm_intra);
     }
     xbt_os_timer_free(process_data[i]->timer);
-    simcall_mbox_destroy(process_data[i]->mailbox);
-    simcall_mbox_destroy(process_data[i]->mailbox_small);
     xbt_mutex_destroy(process_data[i]->mailboxes_mutex);
     xbt_free(process_data[i]);
   }