Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SIMIX_network_copy_data() is a mess because it tries to allow passing
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 5 Mar 2010 09:24:02 +0000 (09:24 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 5 Mar 2010 09:24:02 +0000 (09:24 +0000)
arbitrary long memory chuncks in simix_network. It complicates stuff,
and is hopeless anyway since it has not the full gras_datadesc power.
So, let's stop trying that.

When SIMIX_network_send(), don't pass a pointer's address (void**) as
argument src_buf (which is declared void*). It was dereferenced twice
in SIMIX_network_copy_data() anyway.

The current situation is a bit more sane, even if further cleanups is
needed: I guess that the data argument of SIMIX_network_send() become
useless now, and I didn't cleanup my commit: that's full of useless
FIXMEs.

The motivation to this change was that ruby stacks may move to some
other location in the memory on context switch (to extend it). So,
trying to reuse a pointer to a variable living in the stack after a
switch does not work. This commit kills a "invalid read".

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7199 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/msg/msg_mailbox.c
src/simix/smx_network.c

index a4ccc25..c897b6a 100644 (file)
@@ -187,7 +187,7 @@ MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, m_task_t task,
       SIMIX_cond_signal(mailbox->cond);
 
     SIMIX_network_send(mailbox->rdv, t_simdata->message_size, t_simdata->rate,
       SIMIX_cond_signal(mailbox->cond);
 
     SIMIX_network_send(mailbox->rdv, t_simdata->message_size, t_simdata->rate,
-                       timeout, &task, sizeof(void*), &t_simdata->comm, task);
+                       timeout, task, sizeof(void*), &t_simdata->comm, task);
   }
 
   CATCH(e){
   }
 
   CATCH(e){
index 38e22a0..a1bb927 100644 (file)
@@ -350,11 +350,14 @@ void SIMIX_network_copy_data(smx_comm_t comm)
       comm->dst_proc->smx_host->name, comm->dst_buff,
       buff_size);
 #endif
       comm->dst_proc->smx_host->name, comm->dst_buff,
       buff_size);
 #endif
-  if (buff_size == sizeof(void*)) {
-    *(void**)(comm->dst_buff) = *(void**)(comm->src_buff);
-  } else {
+
+  xbt_assert1((buff_size == sizeof(void*)), "Cannot copy %d bytes: must be sizeof(void*)",buff_size);
+  //FIXME: cleanup
+//  if  {
+    *(void**)(comm->dst_buff) = (comm->src_buff);
+/*  } else {
     memcpy(comm->dst_buff, comm->src_buff, buff_size);
     memcpy(comm->dst_buff, comm->src_buff, buff_size);
-  }
+  }*/
 }
 
 /**
 }
 
 /**