Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[simix] Use C++ templates for generating the marshaling/unmashaling code
authorGabriel Corona <gabriel.corona@loria.fr>
Wed, 25 May 2016 10:21:46 +0000 (12:21 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Thu, 26 May 2016 09:11:39 +0000 (11:11 +0200)
The idea is to move away from code generation as much as possible.
popping_bodies.cpp file is mostly useless with this modification.

src/mc/mc_base.h
src/mc/mc_state.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_generated.cpp
src/simix/popping_private.h
src/simix/simcalls.py

index fc587fb..9e74d39 100644 (file)
@@ -7,8 +7,13 @@
 #ifndef SIMGRID_MC_BASE_H
 #define SIMGRID_MC_BASE_H
 
+#ifdef __cplusplus
+#include <vector>
+#endif
+
 #include <xbt/base.h>
-#include "src/simix/popping_private.h" // smx_simcall_t
+
+typedef struct s_smx_simcall s_smx_simcall_t, *smx_simcall_t;
 
 #ifdef __cplusplus
 
index 9df85bf..4f467f2 100644 (file)
@@ -181,7 +181,7 @@ static inline smx_simcall_t MC_state_get_request_for_process(
       state->transition.argument, sizeof(remote_comm));
     mc_model_checker->process().read(state->internal_comm, remote(
       static_cast<simgrid::simix::Comm*>(remote_comm)));
-    simcall_comm_wait__set__comm(&state->internal_req, &state->internal_comm);
+    simcall_comm_wait__set__comm(&state->internal_req, state->internal_comm.getBuffer());
     simcall_comm_wait__set__timeout(&state->internal_req, 0);
     break;
   }
@@ -199,7 +199,7 @@ static inline smx_simcall_t MC_state_get_request_for_process(
         static_cast<simgrid::simix::Comm*>(remote_comm)));
     }
 
-    simcall_comm_test__set__comm(&state->internal_req, &state->internal_comm);
+    simcall_comm_test__set__comm(&state->internal_req, state->internal_comm.getBuffer());
     simcall_comm_test__set__result(&state->internal_req, state->transition.argument);
     break;
 
@@ -207,16 +207,16 @@ static inline smx_simcall_t MC_state_get_request_for_process(
     state->internal_req = *req;
     mc_model_checker->process().read_bytes(&state->internal_comm ,
       sizeof(state->internal_comm), remote(simcall_comm_wait__get__comm(req)));
-    simcall_comm_wait__set__comm(&state->executed_req, &state->internal_comm);
-    simcall_comm_wait__set__comm(&state->internal_req, &state->internal_comm);
+    simcall_comm_wait__set__comm(&state->executed_req, state->internal_comm.getBuffer());
+    simcall_comm_wait__set__comm(&state->internal_req, state->internal_comm.getBuffer());
     break;
 
   case SIMCALL_COMM_TEST:
     state->internal_req = *req;
     mc_model_checker->process().read_bytes(&state->internal_comm,
       sizeof(state->internal_comm), remote(simcall_comm_test__get__comm(req)));
-    simcall_comm_test__set__comm(&state->executed_req, &state->internal_comm);
-    simcall_comm_test__set__comm(&state->internal_req, &state->internal_comm);
+    simcall_comm_test__set__comm(&state->executed_req, state->internal_comm.getBuffer());
+    simcall_comm_test__set__comm(&state->internal_req, state->internal_comm.getBuffer());
     break;
 
   default:
index b5fff63..84a2a0f 100644 (file)
  * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
  */
 
-
+#include "src/simix/popping_private.h"
 static inline sg_host_t simcall_vm_suspend__get__ind_vm(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]);
 }
-static inline void simcall_vm_suspend__set__ind_vm(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_vm_suspend__set__ind_vm(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[0], arg);
 }
 
 static inline sg_host_t simcall_vm_resume__get__ind_vm(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]);
 }
-static inline void simcall_vm_resume__set__ind_vm(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_vm_resume__set__ind_vm(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[0], arg);
 }
 
 static inline sg_host_t simcall_vm_shutdown__get__ind_vm(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]);
 }
-static inline void simcall_vm_shutdown__set__ind_vm(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_vm_shutdown__set__ind_vm(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[0], arg);
 }
 
 static inline sg_host_t simcall_vm_save__get__ind_vm(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]);
 }
-static inline void simcall_vm_save__set__ind_vm(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_vm_save__set__ind_vm(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[0], arg);
 }
 
 static inline sg_host_t simcall_vm_restore__get__ind_vm(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]);
 }
-static inline void simcall_vm_restore__set__ind_vm(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_vm_restore__set__ind_vm(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[0], arg);
 }
 
 static inline smx_process_t simcall_process_kill__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_kill__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_kill__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 
 static inline int simcall_process_killall__get__reset_pid(smx_simcall_t simcall) {
-  return  simcall->args[0].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[0]);
 }
 static inline void simcall_process_killall__set__reset_pid(smx_simcall_t simcall, int arg) {
-    simcall->args[0].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[0], arg);
 }
 
 static inline smx_process_t simcall_process_cleanup__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_cleanup__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_cleanup__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 
 static inline smx_process_t simcall_process_suspend__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_suspend__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_suspend__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 
 static inline smx_process_t simcall_process_resume__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_resume__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_resume__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 
 static inline smx_process_t simcall_process_set_host__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_set_host__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_set_host__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline sg_host_t simcall_process_set_host__get__dest(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]);
 }
-static inline void simcall_process_set_host__set__dest(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_process_set_host__set__dest(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[1], arg);
 }
 
 static inline smx_process_t simcall_process_is_suspended__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_is_suspended__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_is_suspended__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline int simcall_process_is_suspended__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_process_is_suspended__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_process_t simcall_process_join__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_join__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_join__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline double simcall_process_join__get__timeout(smx_simcall_t simcall) {
-  return  simcall->args[1].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[1]);
 }
 static inline void simcall_process_join__set__timeout(smx_simcall_t simcall, double arg) {
-    simcall->args[1].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[1], arg);
 }
 static inline int simcall_process_join__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_process_join__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline double simcall_process_sleep__get__duration(smx_simcall_t simcall) {
-  return  simcall->args[0].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[0]);
 }
 static inline void simcall_process_sleep__set__duration(smx_simcall_t simcall, double arg) {
-    simcall->args[0].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[0], arg);
 }
 static inline int simcall_process_sleep__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_process_sleep__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline const char* simcall_execution_start__get__name(smx_simcall_t simcall) {
-  return  simcall->args[0].cc;
+  return simgrid::simix::unmarshal<const char*>(simcall->args[0]);
 }
 static inline void simcall_execution_start__set__name(smx_simcall_t simcall, const char* arg) {
-    simcall->args[0].cc = arg;
+    simgrid::simix::marshal<const char*>(simcall->args[0], arg);
 }
 static inline double simcall_execution_start__get__flops_amount(smx_simcall_t simcall) {
-  return  simcall->args[1].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[1]);
 }
 static inline void simcall_execution_start__set__flops_amount(smx_simcall_t simcall, double arg) {
-    simcall->args[1].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[1], arg);
 }
 static inline double simcall_execution_start__get__priority(smx_simcall_t simcall) {
-  return  simcall->args[2].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[2]);
 }
 static inline void simcall_execution_start__set__priority(smx_simcall_t simcall, double arg) {
-    simcall->args[2].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[2], arg);
 }
 static inline double simcall_execution_start__get__bound(smx_simcall_t simcall) {
-  return  simcall->args[3].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[3]);
 }
 static inline void simcall_execution_start__set__bound(smx_simcall_t simcall, double arg) {
-    simcall->args[3].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[3], arg);
 }
 static inline unsigned long simcall_execution_start__get__affinity_mask(smx_simcall_t simcall) {
-  return  simcall->args[4].ul;
+  return simgrid::simix::unmarshal<unsigned long>(simcall->args[4]);
 }
 static inline void simcall_execution_start__set__affinity_mask(smx_simcall_t simcall, unsigned long arg) {
-    simcall->args[4].ul = arg;
+    simgrid::simix::marshal<unsigned long>(simcall->args[4], arg);
 }
 static inline smx_synchro_t simcall_execution_start__get__result(smx_simcall_t simcall){
-    return (smx_synchro_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_synchro_t>(simcall->result);
 }
-static inline void simcall_execution_start__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_execution_start__set__result(smx_simcall_t simcall, smx_synchro_t result){
+    simgrid::simix::marshal<smx_synchro_t>(simcall->result, result);
 }
 
 static inline const char* simcall_execution_parallel_start__get__name(smx_simcall_t simcall) {
-  return  simcall->args[0].cc;
+  return simgrid::simix::unmarshal<const char*>(simcall->args[0]);
 }
 static inline void simcall_execution_parallel_start__set__name(smx_simcall_t simcall, const char* arg) {
-    simcall->args[0].cc = arg;
+    simgrid::simix::marshal<const char*>(simcall->args[0], arg);
 }
 static inline int simcall_execution_parallel_start__get__host_nb(smx_simcall_t simcall) {
-  return  simcall->args[1].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[1]);
 }
 static inline void simcall_execution_parallel_start__set__host_nb(smx_simcall_t simcall, int arg) {
-    simcall->args[1].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[1], arg);
 }
 static inline sg_host_t* simcall_execution_parallel_start__get__host_list(smx_simcall_t simcall) {
-  return (sg_host_t*) simcall->args[2].dp;
+  return simgrid::simix::unmarshal<sg_host_t*>(simcall->args[2]);
 }
-static inline void simcall_execution_parallel_start__set__host_list(smx_simcall_t simcall, void* arg) {
-    simcall->args[2].dp = arg;
+static inline void simcall_execution_parallel_start__set__host_list(smx_simcall_t simcall, sg_host_t* arg) {
+    simgrid::simix::marshal<sg_host_t*>(simcall->args[2], arg);
 }
 static inline double* simcall_execution_parallel_start__get__flops_amount(smx_simcall_t simcall) {
-  return (double*) simcall->args[3].dp;
+  return simgrid::simix::unmarshal<double*>(simcall->args[3]);
 }
-static inline void simcall_execution_parallel_start__set__flops_amount(smx_simcall_t simcall, void* arg) {
-    simcall->args[3].dp = arg;
+static inline void simcall_execution_parallel_start__set__flops_amount(smx_simcall_t simcall, double* arg) {
+    simgrid::simix::marshal<double*>(simcall->args[3], arg);
 }
 static inline double* simcall_execution_parallel_start__get__bytes_amount(smx_simcall_t simcall) {
-  return (double*) simcall->args[4].dp;
+  return simgrid::simix::unmarshal<double*>(simcall->args[4]);
 }
-static inline void simcall_execution_parallel_start__set__bytes_amount(smx_simcall_t simcall, void* arg) {
-    simcall->args[4].dp = arg;
+static inline void simcall_execution_parallel_start__set__bytes_amount(smx_simcall_t simcall, double* arg) {
+    simgrid::simix::marshal<double*>(simcall->args[4], arg);
 }
 static inline double simcall_execution_parallel_start__get__amount(smx_simcall_t simcall) {
-  return  simcall->args[5].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[5]);
 }
 static inline void simcall_execution_parallel_start__set__amount(smx_simcall_t simcall, double arg) {
-    simcall->args[5].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[5], arg);
 }
 static inline double simcall_execution_parallel_start__get__rate(smx_simcall_t simcall) {
-  return  simcall->args[6].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[6]);
 }
 static inline void simcall_execution_parallel_start__set__rate(smx_simcall_t simcall, double arg) {
-    simcall->args[6].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[6], arg);
 }
 static inline smx_synchro_t simcall_execution_parallel_start__get__result(smx_simcall_t simcall){
-    return (smx_synchro_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_synchro_t>(simcall->result);
 }
-static inline void simcall_execution_parallel_start__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_execution_parallel_start__set__result(smx_simcall_t simcall, smx_synchro_t result){
+    simgrid::simix::marshal<smx_synchro_t>(simcall->result, result);
 }
 
 static inline smx_synchro_t simcall_execution_cancel__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]);
 }
-static inline void simcall_execution_cancel__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_execution_cancel__set__execution(smx_simcall_t simcall, smx_synchro_t arg) {
+    simgrid::simix::marshal<smx_synchro_t>(simcall->args[0], arg);
 }
 
 static inline smx_synchro_t simcall_execution_set_priority__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]);
 }
-static inline void simcall_execution_set_priority__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_execution_set_priority__set__execution(smx_simcall_t simcall, smx_synchro_t arg) {
+    simgrid::simix::marshal<smx_synchro_t>(simcall->args[0], arg);
 }
 static inline double simcall_execution_set_priority__get__priority(smx_simcall_t simcall) {
-  return  simcall->args[1].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[1]);
 }
 static inline void simcall_execution_set_priority__set__priority(smx_simcall_t simcall, double arg) {
-    simcall->args[1].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[1], arg);
 }
 
 static inline smx_synchro_t simcall_execution_set_bound__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]);
 }
-static inline void simcall_execution_set_bound__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_execution_set_bound__set__execution(smx_simcall_t simcall, smx_synchro_t arg) {
+    simgrid::simix::marshal<smx_synchro_t>(simcall->args[0], arg);
 }
 static inline double simcall_execution_set_bound__get__bound(smx_simcall_t simcall) {
-  return  simcall->args[1].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[1]);
 }
 static inline void simcall_execution_set_bound__set__bound(smx_simcall_t simcall, double arg) {
-    simcall->args[1].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[1], arg);
 }
 
 static inline smx_synchro_t simcall_execution_set_affinity__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]);
 }
-static inline void simcall_execution_set_affinity__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_execution_set_affinity__set__execution(smx_simcall_t simcall, smx_synchro_t arg) {
+    simgrid::simix::marshal<smx_synchro_t>(simcall->args[0], arg);
 }
 static inline sg_host_t simcall_execution_set_affinity__get__ws(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]);
 }
-static inline void simcall_execution_set_affinity__set__ws(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_execution_set_affinity__set__ws(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[1], arg);
 }
 static inline unsigned long simcall_execution_set_affinity__get__mask(smx_simcall_t simcall) {
-  return  simcall->args[2].ul;
+  return simgrid::simix::unmarshal<unsigned long>(simcall->args[2]);
 }
 static inline void simcall_execution_set_affinity__set__mask(smx_simcall_t simcall, unsigned long arg) {
-    simcall->args[2].ul = arg;
+    simgrid::simix::marshal<unsigned long>(simcall->args[2], arg);
 }
 
 static inline smx_synchro_t simcall_execution_wait__get__execution(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]);
 }
-static inline void simcall_execution_wait__set__execution(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_execution_wait__set__execution(smx_simcall_t simcall, smx_synchro_t arg) {
+    simgrid::simix::marshal<smx_synchro_t>(simcall->args[0], arg);
 }
 static inline int simcall_execution_wait__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_execution_wait__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_process_t simcall_process_on_exit__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_on_exit__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_on_exit__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline int_f_pvoid_pvoid_t simcall_process_on_exit__get__fun(smx_simcall_t simcall) {
-  return (int_f_pvoid_pvoid_t) simcall->args[1].fp;
+  return simgrid::simix::unmarshal<int_f_pvoid_pvoid_t>(simcall->args[1]);
 }
-static inline void simcall_process_on_exit__set__fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[1].fp = arg;
+static inline void simcall_process_on_exit__set__fun(smx_simcall_t simcall, int_f_pvoid_pvoid_t arg) {
+    simgrid::simix::marshal<int_f_pvoid_pvoid_t>(simcall->args[1], arg);
 }
 static inline void* simcall_process_on_exit__get__data(smx_simcall_t simcall) {
-  return  simcall->args[2].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[2]);
 }
 static inline void simcall_process_on_exit__set__data(smx_simcall_t simcall, void* arg) {
-    simcall->args[2].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[2], arg);
 }
 
 static inline smx_process_t simcall_process_auto_restart_set__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_auto_restart_set__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_auto_restart_set__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline int simcall_process_auto_restart_set__get__auto_restart(smx_simcall_t simcall) {
-  return  simcall->args[1].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[1]);
 }
 static inline void simcall_process_auto_restart_set__set__auto_restart(smx_simcall_t simcall, int arg) {
-    simcall->args[1].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[1], arg);
 }
 
 static inline smx_process_t simcall_process_restart__get__process(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_process_restart__set__process(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_process_restart__set__process(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline smx_process_t simcall_process_restart__get__result(smx_simcall_t simcall){
-    return (smx_process_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_process_t>(simcall->result);
 }
-static inline void simcall_process_restart__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_process_restart__set__result(smx_simcall_t simcall, smx_process_t result){
+    simgrid::simix::marshal<smx_process_t>(simcall->result, result);
 }
 
 static inline const char* simcall_mbox_create__get__name(smx_simcall_t simcall) {
-  return  simcall->args[0].cc;
+  return simgrid::simix::unmarshal<const char*>(simcall->args[0]);
 }
 static inline void simcall_mbox_create__set__name(smx_simcall_t simcall, const char* arg) {
-    simcall->args[0].cc = arg;
+    simgrid::simix::marshal<const char*>(simcall->args[0], arg);
 }
 static inline smx_mailbox_t simcall_mbox_create__get__result(smx_simcall_t simcall){
-    return (smx_mailbox_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_mailbox_t>(simcall->result);
 }
-static inline void simcall_mbox_create__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_mbox_create__set__result(smx_simcall_t simcall, smx_mailbox_t result){
+    simgrid::simix::marshal<smx_mailbox_t>(simcall->result, result);
 }
 
 static inline smx_mailbox_t simcall_mbox_set_receiver__get__mbox(smx_simcall_t simcall) {
-  return (smx_mailbox_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]);
 }
-static inline void simcall_mbox_set_receiver__set__mbox(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_mbox_set_receiver__set__mbox(smx_simcall_t simcall, smx_mailbox_t arg) {
+    simgrid::simix::marshal<smx_mailbox_t>(simcall->args[0], arg);
 }
 static inline smx_process_t simcall_mbox_set_receiver__get__receiver(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[1]);
 }
-static inline void simcall_mbox_set_receiver__set__receiver(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_mbox_set_receiver__set__receiver(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[1], arg);
 }
 
 static inline smx_mailbox_t simcall_comm_iprobe__get__mbox(smx_simcall_t simcall) {
-  return (smx_mailbox_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]);
 }
-static inline void simcall_comm_iprobe__set__mbox(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_comm_iprobe__set__mbox(smx_simcall_t simcall, smx_mailbox_t arg) {
+    simgrid::simix::marshal<smx_mailbox_t>(simcall->args[0], arg);
 }
 static inline int simcall_comm_iprobe__get__type(smx_simcall_t simcall) {
-  return  simcall->args[1].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[1]);
 }
 static inline void simcall_comm_iprobe__set__type(smx_simcall_t simcall, int arg) {
-    simcall->args[1].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[1], arg);
 }
 static inline int simcall_comm_iprobe__get__src(smx_simcall_t simcall) {
-  return  simcall->args[2].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[2]);
 }
 static inline void simcall_comm_iprobe__set__src(smx_simcall_t simcall, int arg) {
-    simcall->args[2].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[2], arg);
 }
 static inline int simcall_comm_iprobe__get__tag(smx_simcall_t simcall) {
-  return  simcall->args[3].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[3]);
 }
 static inline void simcall_comm_iprobe__set__tag(smx_simcall_t simcall, int arg) {
-    simcall->args[3].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[3], arg);
 }
 static inline simix_match_func_t simcall_comm_iprobe__get__match_fun(smx_simcall_t simcall) {
-  return (simix_match_func_t) simcall->args[4].fp;
+  return simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[4]);
 }
-static inline void simcall_comm_iprobe__set__match_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[4].fp = arg;
+static inline void simcall_comm_iprobe__set__match_fun(smx_simcall_t simcall, simix_match_func_t arg) {
+    simgrid::simix::marshal<simix_match_func_t>(simcall->args[4], arg);
 }
 static inline void* simcall_comm_iprobe__get__data(smx_simcall_t simcall) {
-  return  simcall->args[5].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[5]);
 }
 static inline void simcall_comm_iprobe__set__data(smx_simcall_t simcall, void* arg) {
-    simcall->args[5].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[5], arg);
 }
 static inline smx_synchro_t simcall_comm_iprobe__get__result(smx_simcall_t simcall){
-    return (smx_synchro_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_synchro_t>(simcall->result);
 }
-static inline void simcall_comm_iprobe__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_comm_iprobe__set__result(smx_simcall_t simcall, smx_synchro_t result){
+    simgrid::simix::marshal<smx_synchro_t>(simcall->result, result);
 }
 
 static inline smx_process_t simcall_comm_send__get__sender(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_comm_send__set__sender(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_comm_send__set__sender(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline smx_mailbox_t simcall_comm_send__get__mbox(smx_simcall_t simcall) {
-  return (smx_mailbox_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]);
 }
-static inline void simcall_comm_send__set__mbox(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_comm_send__set__mbox(smx_simcall_t simcall, smx_mailbox_t arg) {
+    simgrid::simix::marshal<smx_mailbox_t>(simcall->args[1], arg);
 }
 static inline double simcall_comm_send__get__task_size(smx_simcall_t simcall) {
-  return  simcall->args[2].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[2]);
 }
 static inline void simcall_comm_send__set__task_size(smx_simcall_t simcall, double arg) {
-    simcall->args[2].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[2], arg);
 }
 static inline double simcall_comm_send__get__rate(smx_simcall_t simcall) {
-  return  simcall->args[3].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[3]);
 }
 static inline void simcall_comm_send__set__rate(smx_simcall_t simcall, double arg) {
-    simcall->args[3].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[3], arg);
 }
 static inline void* simcall_comm_send__get__src_buff(smx_simcall_t simcall) {
-  return  simcall->args[4].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[4]);
 }
 static inline void simcall_comm_send__set__src_buff(smx_simcall_t simcall, void* arg) {
-    simcall->args[4].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[4], arg);
 }
 static inline size_t simcall_comm_send__get__src_buff_size(smx_simcall_t simcall) {
-  return  simcall->args[5].sz;
+  return simgrid::simix::unmarshal<size_t>(simcall->args[5]);
 }
 static inline void simcall_comm_send__set__src_buff_size(smx_simcall_t simcall, size_t arg) {
-    simcall->args[5].sz = arg;
+    simgrid::simix::marshal<size_t>(simcall->args[5], arg);
 }
 static inline simix_match_func_t simcall_comm_send__get__match_fun(smx_simcall_t simcall) {
-  return (simix_match_func_t) simcall->args[6].fp;
+  return simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]);
 }
-static inline void simcall_comm_send__set__match_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[6].fp = arg;
+static inline void simcall_comm_send__set__match_fun(smx_simcall_t simcall, simix_match_func_t arg) {
+    simgrid::simix::marshal<simix_match_func_t>(simcall->args[6], arg);
 }
 static inline simix_copy_data_func_t simcall_comm_send__get__copy_data_fun(smx_simcall_t simcall) {
-  return (simix_copy_data_func_t) simcall->args[7].fp;
+  return simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[7]);
 }
-static inline void simcall_comm_send__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[7].fp = arg;
+static inline void simcall_comm_send__set__copy_data_fun(smx_simcall_t simcall, simix_copy_data_func_t arg) {
+    simgrid::simix::marshal<simix_copy_data_func_t>(simcall->args[7], arg);
 }
 static inline void* simcall_comm_send__get__data(smx_simcall_t simcall) {
-  return  simcall->args[8].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[8]);
 }
 static inline void simcall_comm_send__set__data(smx_simcall_t simcall, void* arg) {
-    simcall->args[8].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[8], arg);
 }
 static inline double simcall_comm_send__get__timeout(smx_simcall_t simcall) {
-  return  simcall->args[9].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[9]);
 }
 static inline void simcall_comm_send__set__timeout(smx_simcall_t simcall, double arg) {
-    simcall->args[9].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[9], arg);
 }
 
 static inline smx_process_t simcall_comm_isend__get__sender(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_comm_isend__set__sender(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_comm_isend__set__sender(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline smx_mailbox_t simcall_comm_isend__get__mbox(smx_simcall_t simcall) {
-  return (smx_mailbox_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]);
 }
-static inline void simcall_comm_isend__set__mbox(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_comm_isend__set__mbox(smx_simcall_t simcall, smx_mailbox_t arg) {
+    simgrid::simix::marshal<smx_mailbox_t>(simcall->args[1], arg);
 }
 static inline double simcall_comm_isend__get__task_size(smx_simcall_t simcall) {
-  return  simcall->args[2].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[2]);
 }
 static inline void simcall_comm_isend__set__task_size(smx_simcall_t simcall, double arg) {
-    simcall->args[2].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[2], arg);
 }
 static inline double simcall_comm_isend__get__rate(smx_simcall_t simcall) {
-  return  simcall->args[3].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[3]);
 }
 static inline void simcall_comm_isend__set__rate(smx_simcall_t simcall, double arg) {
-    simcall->args[3].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[3], arg);
 }
 static inline void* simcall_comm_isend__get__src_buff(smx_simcall_t simcall) {
-  return  simcall->args[4].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[4]);
 }
 static inline void simcall_comm_isend__set__src_buff(smx_simcall_t simcall, void* arg) {
-    simcall->args[4].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[4], arg);
 }
 static inline size_t simcall_comm_isend__get__src_buff_size(smx_simcall_t simcall) {
-  return  simcall->args[5].sz;
+  return simgrid::simix::unmarshal<size_t>(simcall->args[5]);
 }
 static inline void simcall_comm_isend__set__src_buff_size(smx_simcall_t simcall, size_t arg) {
-    simcall->args[5].sz = arg;
+    simgrid::simix::marshal<size_t>(simcall->args[5], arg);
 }
 static inline simix_match_func_t simcall_comm_isend__get__match_fun(smx_simcall_t simcall) {
-  return (simix_match_func_t) simcall->args[6].fp;
+  return simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]);
 }
-static inline void simcall_comm_isend__set__match_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[6].fp = arg;
+static inline void simcall_comm_isend__set__match_fun(smx_simcall_t simcall, simix_match_func_t arg) {
+    simgrid::simix::marshal<simix_match_func_t>(simcall->args[6], arg);
 }
 static inline simix_clean_func_t simcall_comm_isend__get__clean_fun(smx_simcall_t simcall) {
-  return (simix_clean_func_t) simcall->args[7].fp;
+  return simgrid::simix::unmarshal<simix_clean_func_t>(simcall->args[7]);
 }
-static inline void simcall_comm_isend__set__clean_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[7].fp = arg;
+static inline void simcall_comm_isend__set__clean_fun(smx_simcall_t simcall, simix_clean_func_t arg) {
+    simgrid::simix::marshal<simix_clean_func_t>(simcall->args[7], arg);
 }
 static inline simix_copy_data_func_t simcall_comm_isend__get__copy_data_fun(smx_simcall_t simcall) {
-  return (simix_copy_data_func_t) simcall->args[8].fp;
+  return simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[8]);
 }
-static inline void simcall_comm_isend__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[8].fp = arg;
+static inline void simcall_comm_isend__set__copy_data_fun(smx_simcall_t simcall, simix_copy_data_func_t arg) {
+    simgrid::simix::marshal<simix_copy_data_func_t>(simcall->args[8], arg);
 }
 static inline void* simcall_comm_isend__get__data(smx_simcall_t simcall) {
-  return  simcall->args[9].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[9]);
 }
 static inline void simcall_comm_isend__set__data(smx_simcall_t simcall, void* arg) {
-    simcall->args[9].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[9], arg);
 }
 static inline int simcall_comm_isend__get__detached(smx_simcall_t simcall) {
-  return  simcall->args[10].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[10]);
 }
 static inline void simcall_comm_isend__set__detached(smx_simcall_t simcall, int arg) {
-    simcall->args[10].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[10], arg);
 }
 static inline smx_synchro_t simcall_comm_isend__get__result(smx_simcall_t simcall){
-    return (smx_synchro_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_synchro_t>(simcall->result);
 }
-static inline void simcall_comm_isend__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_comm_isend__set__result(smx_simcall_t simcall, smx_synchro_t result){
+    simgrid::simix::marshal<smx_synchro_t>(simcall->result, result);
 }
 
 static inline smx_process_t simcall_comm_recv__get__receiver(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_comm_recv__set__receiver(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_comm_recv__set__receiver(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline smx_mailbox_t simcall_comm_recv__get__mbox(smx_simcall_t simcall) {
-  return (smx_mailbox_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]);
 }
-static inline void simcall_comm_recv__set__mbox(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_comm_recv__set__mbox(smx_simcall_t simcall, smx_mailbox_t arg) {
+    simgrid::simix::marshal<smx_mailbox_t>(simcall->args[1], arg);
 }
 static inline void* simcall_comm_recv__get__dst_buff(smx_simcall_t simcall) {
-  return  simcall->args[2].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[2]);
 }
 static inline void simcall_comm_recv__set__dst_buff(smx_simcall_t simcall, void* arg) {
-    simcall->args[2].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[2], arg);
 }
 static inline size_t* simcall_comm_recv__get__dst_buff_size(smx_simcall_t simcall) {
-  return (size_t*) simcall->args[3].dp;
+  return simgrid::simix::unmarshal<size_t*>(simcall->args[3]);
 }
-static inline void simcall_comm_recv__set__dst_buff_size(smx_simcall_t simcall, void* arg) {
-    simcall->args[3].dp = arg;
+static inline void simcall_comm_recv__set__dst_buff_size(smx_simcall_t simcall, size_t* arg) {
+    simgrid::simix::marshal<size_t*>(simcall->args[3], arg);
 }
 static inline simix_match_func_t simcall_comm_recv__get__match_fun(smx_simcall_t simcall) {
-  return (simix_match_func_t) simcall->args[4].fp;
+  return simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[4]);
 }
-static inline void simcall_comm_recv__set__match_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[4].fp = arg;
+static inline void simcall_comm_recv__set__match_fun(smx_simcall_t simcall, simix_match_func_t arg) {
+    simgrid::simix::marshal<simix_match_func_t>(simcall->args[4], arg);
 }
 static inline simix_copy_data_func_t simcall_comm_recv__get__copy_data_fun(smx_simcall_t simcall) {
-  return (simix_copy_data_func_t) simcall->args[5].fp;
+  return simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[5]);
 }
-static inline void simcall_comm_recv__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[5].fp = arg;
+static inline void simcall_comm_recv__set__copy_data_fun(smx_simcall_t simcall, simix_copy_data_func_t arg) {
+    simgrid::simix::marshal<simix_copy_data_func_t>(simcall->args[5], arg);
 }
 static inline void* simcall_comm_recv__get__data(smx_simcall_t simcall) {
-  return  simcall->args[6].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[6]);
 }
 static inline void simcall_comm_recv__set__data(smx_simcall_t simcall, void* arg) {
-    simcall->args[6].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[6], arg);
 }
 static inline double simcall_comm_recv__get__timeout(smx_simcall_t simcall) {
-  return  simcall->args[7].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[7]);
 }
 static inline void simcall_comm_recv__set__timeout(smx_simcall_t simcall, double arg) {
-    simcall->args[7].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[7], arg);
 }
 static inline double simcall_comm_recv__get__rate(smx_simcall_t simcall) {
-  return  simcall->args[8].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[8]);
 }
 static inline void simcall_comm_recv__set__rate(smx_simcall_t simcall, double arg) {
-    simcall->args[8].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[8], arg);
 }
 
 static inline smx_process_t simcall_comm_irecv__get__receiver(smx_simcall_t simcall) {
-  return (smx_process_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]);
 }
-static inline void simcall_comm_irecv__set__receiver(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_comm_irecv__set__receiver(smx_simcall_t simcall, smx_process_t arg) {
+    simgrid::simix::marshal<smx_process_t>(simcall->args[0], arg);
 }
 static inline smx_mailbox_t simcall_comm_irecv__get__mbox(smx_simcall_t simcall) {
-  return (smx_mailbox_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]);
 }
-static inline void simcall_comm_irecv__set__mbox(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_comm_irecv__set__mbox(smx_simcall_t simcall, smx_mailbox_t arg) {
+    simgrid::simix::marshal<smx_mailbox_t>(simcall->args[1], arg);
 }
 static inline void* simcall_comm_irecv__get__dst_buff(smx_simcall_t simcall) {
-  return  simcall->args[2].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[2]);
 }
 static inline void simcall_comm_irecv__set__dst_buff(smx_simcall_t simcall, void* arg) {
-    simcall->args[2].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[2], arg);
 }
 static inline size_t* simcall_comm_irecv__get__dst_buff_size(smx_simcall_t simcall) {
-  return (size_t*) simcall->args[3].dp;
+  return simgrid::simix::unmarshal<size_t*>(simcall->args[3]);
 }
-static inline void simcall_comm_irecv__set__dst_buff_size(smx_simcall_t simcall, void* arg) {
-    simcall->args[3].dp = arg;
+static inline void simcall_comm_irecv__set__dst_buff_size(smx_simcall_t simcall, size_t* arg) {
+    simgrid::simix::marshal<size_t*>(simcall->args[3], arg);
 }
 static inline simix_match_func_t simcall_comm_irecv__get__match_fun(smx_simcall_t simcall) {
-  return (simix_match_func_t) simcall->args[4].fp;
+  return simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[4]);
 }
-static inline void simcall_comm_irecv__set__match_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[4].fp = arg;
+static inline void simcall_comm_irecv__set__match_fun(smx_simcall_t simcall, simix_match_func_t arg) {
+    simgrid::simix::marshal<simix_match_func_t>(simcall->args[4], arg);
 }
 static inline simix_copy_data_func_t simcall_comm_irecv__get__copy_data_fun(smx_simcall_t simcall) {
-  return (simix_copy_data_func_t) simcall->args[5].fp;
+  return simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[5]);
 }
-static inline void simcall_comm_irecv__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) {
-    simcall->args[5].fp = arg;
+static inline void simcall_comm_irecv__set__copy_data_fun(smx_simcall_t simcall, simix_copy_data_func_t arg) {
+    simgrid::simix::marshal<simix_copy_data_func_t>(simcall->args[5], arg);
 }
 static inline void* simcall_comm_irecv__get__data(smx_simcall_t simcall) {
-  return  simcall->args[6].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[6]);
 }
 static inline void simcall_comm_irecv__set__data(smx_simcall_t simcall, void* arg) {
-    simcall->args[6].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[6], arg);
 }
 static inline double simcall_comm_irecv__get__rate(smx_simcall_t simcall) {
-  return  simcall->args[7].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[7]);
 }
 static inline void simcall_comm_irecv__set__rate(smx_simcall_t simcall, double arg) {
-    simcall->args[7].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[7], arg);
 }
 static inline smx_synchro_t simcall_comm_irecv__get__result(smx_simcall_t simcall){
-    return (smx_synchro_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_synchro_t>(simcall->result);
 }
-static inline void simcall_comm_irecv__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_comm_irecv__set__result(smx_simcall_t simcall, smx_synchro_t result){
+    simgrid::simix::marshal<smx_synchro_t>(simcall->result, result);
 }
 
 static inline xbt_dynar_t simcall_comm_waitany__get__comms(smx_simcall_t simcall) {
-  return (xbt_dynar_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<xbt_dynar_t>(simcall->args[0]);
 }
-static inline void simcall_comm_waitany__set__comms(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_comm_waitany__set__comms(smx_simcall_t simcall, xbt_dynar_t arg) {
+    simgrid::simix::marshal<xbt_dynar_t>(simcall->args[0], arg);
 }
 static inline int simcall_comm_waitany__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_comm_waitany__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_synchro_t simcall_comm_wait__get__comm(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]);
 }
-static inline void simcall_comm_wait__set__comm(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_comm_wait__set__comm(smx_simcall_t simcall, smx_synchro_t arg) {
+    simgrid::simix::marshal<smx_synchro_t>(simcall->args[0], arg);
 }
 static inline double simcall_comm_wait__get__timeout(smx_simcall_t simcall) {
-  return  simcall->args[1].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[1]);
 }
 static inline void simcall_comm_wait__set__timeout(smx_simcall_t simcall, double arg) {
-    simcall->args[1].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[1], arg);
 }
 
 static inline smx_synchro_t simcall_comm_test__get__comm(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]);
 }
-static inline void simcall_comm_test__set__comm(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_comm_test__set__comm(smx_simcall_t simcall, smx_synchro_t arg) {
+    simgrid::simix::marshal<smx_synchro_t>(simcall->args[0], arg);
 }
 static inline int simcall_comm_test__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_comm_test__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline xbt_dynar_t simcall_comm_testany__get__comms(smx_simcall_t simcall) {
-  return (xbt_dynar_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<xbt_dynar_t>(simcall->args[0]);
 }
-static inline void simcall_comm_testany__set__comms(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_comm_testany__set__comms(smx_simcall_t simcall, xbt_dynar_t arg) {
+    simgrid::simix::marshal<xbt_dynar_t>(simcall->args[0], arg);
 }
 static inline int simcall_comm_testany__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_comm_testany__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_mutex_t simcall_mutex_init__get__result(smx_simcall_t simcall){
-    return (smx_mutex_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_mutex_t>(simcall->result);
 }
-static inline void simcall_mutex_init__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_mutex_init__set__result(smx_simcall_t simcall, smx_mutex_t result){
+    simgrid::simix::marshal<smx_mutex_t>(simcall->result, result);
 }
 
 static inline smx_mutex_t simcall_mutex_lock__get__mutex(smx_simcall_t simcall) {
-  return (smx_mutex_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]);
 }
-static inline void simcall_mutex_lock__set__mutex(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_mutex_lock__set__mutex(smx_simcall_t simcall, smx_mutex_t arg) {
+    simgrid::simix::marshal<smx_mutex_t>(simcall->args[0], arg);
 }
 
 static inline smx_mutex_t simcall_mutex_trylock__get__mutex(smx_simcall_t simcall) {
-  return (smx_mutex_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]);
 }
-static inline void simcall_mutex_trylock__set__mutex(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_mutex_trylock__set__mutex(smx_simcall_t simcall, smx_mutex_t arg) {
+    simgrid::simix::marshal<smx_mutex_t>(simcall->args[0], arg);
 }
 static inline int simcall_mutex_trylock__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_mutex_trylock__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_mutex_t simcall_mutex_unlock__get__mutex(smx_simcall_t simcall) {
-  return (smx_mutex_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]);
 }
-static inline void simcall_mutex_unlock__set__mutex(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_mutex_unlock__set__mutex(smx_simcall_t simcall, smx_mutex_t arg) {
+    simgrid::simix::marshal<smx_mutex_t>(simcall->args[0], arg);
 }
 
 static inline smx_cond_t simcall_cond_init__get__result(smx_simcall_t simcall){
-    return (smx_cond_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_cond_t>(simcall->result);
 }
-static inline void simcall_cond_init__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_cond_init__set__result(smx_simcall_t simcall, smx_cond_t result){
+    simgrid::simix::marshal<smx_cond_t>(simcall->result, result);
 }
 
 static inline smx_cond_t simcall_cond_signal__get__cond(smx_simcall_t simcall) {
-  return (smx_cond_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]);
 }
-static inline void simcall_cond_signal__set__cond(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_cond_signal__set__cond(smx_simcall_t simcall, smx_cond_t arg) {
+    simgrid::simix::marshal<smx_cond_t>(simcall->args[0], arg);
 }
 
 static inline smx_cond_t simcall_cond_wait__get__cond(smx_simcall_t simcall) {
-  return (smx_cond_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]);
 }
-static inline void simcall_cond_wait__set__cond(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_cond_wait__set__cond(smx_simcall_t simcall, smx_cond_t arg) {
+    simgrid::simix::marshal<smx_cond_t>(simcall->args[0], arg);
 }
 static inline smx_mutex_t simcall_cond_wait__get__mutex(smx_simcall_t simcall) {
-  return (smx_mutex_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[1]);
 }
-static inline void simcall_cond_wait__set__mutex(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_cond_wait__set__mutex(smx_simcall_t simcall, smx_mutex_t arg) {
+    simgrid::simix::marshal<smx_mutex_t>(simcall->args[1], arg);
 }
 
 static inline smx_cond_t simcall_cond_wait_timeout__get__cond(smx_simcall_t simcall) {
-  return (smx_cond_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]);
 }
-static inline void simcall_cond_wait_timeout__set__cond(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_cond_wait_timeout__set__cond(smx_simcall_t simcall, smx_cond_t arg) {
+    simgrid::simix::marshal<smx_cond_t>(simcall->args[0], arg);
 }
 static inline smx_mutex_t simcall_cond_wait_timeout__get__mutex(smx_simcall_t simcall) {
-  return (smx_mutex_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[1]);
 }
-static inline void simcall_cond_wait_timeout__set__mutex(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_cond_wait_timeout__set__mutex(smx_simcall_t simcall, smx_mutex_t arg) {
+    simgrid::simix::marshal<smx_mutex_t>(simcall->args[1], arg);
 }
 static inline double simcall_cond_wait_timeout__get__timeout(smx_simcall_t simcall) {
-  return  simcall->args[2].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[2]);
 }
 static inline void simcall_cond_wait_timeout__set__timeout(smx_simcall_t simcall, double arg) {
-    simcall->args[2].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[2], arg);
 }
 
 static inline smx_cond_t simcall_cond_broadcast__get__cond(smx_simcall_t simcall) {
-  return (smx_cond_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]);
 }
-static inline void simcall_cond_broadcast__set__cond(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_cond_broadcast__set__cond(smx_simcall_t simcall, smx_cond_t arg) {
+    simgrid::simix::marshal<smx_cond_t>(simcall->args[0], arg);
 }
 
 static inline unsigned int simcall_sem_init__get__capacity(smx_simcall_t simcall) {
-  return  simcall->args[0].ui;
+  return simgrid::simix::unmarshal<unsigned int>(simcall->args[0]);
 }
 static inline void simcall_sem_init__set__capacity(smx_simcall_t simcall, unsigned int arg) {
-    simcall->args[0].ui = arg;
+    simgrid::simix::marshal<unsigned int>(simcall->args[0], arg);
 }
 static inline smx_sem_t simcall_sem_init__get__result(smx_simcall_t simcall){
-    return (smx_sem_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_sem_t>(simcall->result);
 }
-static inline void simcall_sem_init__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_sem_init__set__result(smx_simcall_t simcall, smx_sem_t result){
+    simgrid::simix::marshal<smx_sem_t>(simcall->result, result);
 }
 
 static inline smx_sem_t simcall_sem_release__get__sem(smx_simcall_t simcall) {
-  return (smx_sem_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]);
 }
-static inline void simcall_sem_release__set__sem(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_sem_release__set__sem(smx_simcall_t simcall, smx_sem_t arg) {
+    simgrid::simix::marshal<smx_sem_t>(simcall->args[0], arg);
 }
 
 static inline smx_sem_t simcall_sem_would_block__get__sem(smx_simcall_t simcall) {
-  return (smx_sem_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]);
 }
-static inline void simcall_sem_would_block__set__sem(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_sem_would_block__set__sem(smx_simcall_t simcall, smx_sem_t arg) {
+    simgrid::simix::marshal<smx_sem_t>(simcall->args[0], arg);
 }
 static inline int simcall_sem_would_block__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_sem_would_block__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_sem_t simcall_sem_acquire__get__sem(smx_simcall_t simcall) {
-  return (smx_sem_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]);
 }
-static inline void simcall_sem_acquire__set__sem(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_sem_acquire__set__sem(smx_simcall_t simcall, smx_sem_t arg) {
+    simgrid::simix::marshal<smx_sem_t>(simcall->args[0], arg);
 }
 
 static inline smx_sem_t simcall_sem_acquire_timeout__get__sem(smx_simcall_t simcall) {
-  return (smx_sem_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]);
 }
-static inline void simcall_sem_acquire_timeout__set__sem(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_sem_acquire_timeout__set__sem(smx_simcall_t simcall, smx_sem_t arg) {
+    simgrid::simix::marshal<smx_sem_t>(simcall->args[0], arg);
 }
 static inline double simcall_sem_acquire_timeout__get__timeout(smx_simcall_t simcall) {
-  return  simcall->args[1].d;
+  return simgrid::simix::unmarshal<double>(simcall->args[1]);
 }
 static inline void simcall_sem_acquire_timeout__set__timeout(smx_simcall_t simcall, double arg) {
-    simcall->args[1].d = arg;
+    simgrid::simix::marshal<double>(simcall->args[1], arg);
 }
 
 static inline smx_sem_t simcall_sem_get_capacity__get__sem(smx_simcall_t simcall) {
-  return (smx_sem_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]);
 }
-static inline void simcall_sem_get_capacity__set__sem(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_sem_get_capacity__set__sem(smx_simcall_t simcall, smx_sem_t arg) {
+    simgrid::simix::marshal<smx_sem_t>(simcall->args[0], arg);
 }
 static inline int simcall_sem_get_capacity__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_sem_get_capacity__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_file_t simcall_file_read__get__fd(smx_simcall_t simcall) {
-  return (smx_file_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
 }
-static inline void simcall_file_read__set__fd(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_file_read__set__fd(smx_simcall_t simcall, smx_file_t arg) {
+    simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
 }
 static inline sg_size_t simcall_file_read__get__size(smx_simcall_t simcall) {
-  return  simcall->args[1].sgsz;
+  return simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]);
 }
 static inline void simcall_file_read__set__size(smx_simcall_t simcall, sg_size_t arg) {
-    simcall->args[1].sgsz = arg;
+    simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
 static inline sg_host_t simcall_file_read__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[2].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]);
 }
-static inline void simcall_file_read__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[2].dp = arg;
+static inline void simcall_file_read__set__host(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[2], arg);
 }
 static inline sg_size_t simcall_file_read__get__result(smx_simcall_t simcall){
-    return  simcall->result.sgsz;
+    return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
 static inline void simcall_file_read__set__result(smx_simcall_t simcall, sg_size_t result){
-    simcall->result.sgsz = result;
+    simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
 
 static inline smx_file_t simcall_file_write__get__fd(smx_simcall_t simcall) {
-  return (smx_file_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
 }
-static inline void simcall_file_write__set__fd(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_file_write__set__fd(smx_simcall_t simcall, smx_file_t arg) {
+    simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
 }
 static inline sg_size_t simcall_file_write__get__size(smx_simcall_t simcall) {
-  return  simcall->args[1].sgsz;
+  return simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]);
 }
 static inline void simcall_file_write__set__size(smx_simcall_t simcall, sg_size_t arg) {
-    simcall->args[1].sgsz = arg;
+    simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
 static inline sg_host_t simcall_file_write__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[2].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]);
 }
-static inline void simcall_file_write__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[2].dp = arg;
+static inline void simcall_file_write__set__host(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[2], arg);
 }
 static inline sg_size_t simcall_file_write__get__result(smx_simcall_t simcall){
-    return  simcall->result.sgsz;
+    return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
 static inline void simcall_file_write__set__result(smx_simcall_t simcall, sg_size_t result){
-    simcall->result.sgsz = result;
+    simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
 
 static inline const char* simcall_file_open__get__fullpath(smx_simcall_t simcall) {
-  return  simcall->args[0].cc;
+  return simgrid::simix::unmarshal<const char*>(simcall->args[0]);
 }
 static inline void simcall_file_open__set__fullpath(smx_simcall_t simcall, const char* arg) {
-    simcall->args[0].cc = arg;
+    simgrid::simix::marshal<const char*>(simcall->args[0], arg);
 }
 static inline sg_host_t simcall_file_open__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]);
 }
-static inline void simcall_file_open__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_file_open__set__host(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[1], arg);
 }
 static inline smx_file_t simcall_file_open__get__result(smx_simcall_t simcall){
-    return (smx_file_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<smx_file_t>(simcall->result);
 }
-static inline void simcall_file_open__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_file_open__set__result(smx_simcall_t simcall, smx_file_t result){
+    simgrid::simix::marshal<smx_file_t>(simcall->result, result);
 }
 
 static inline smx_file_t simcall_file_close__get__fd(smx_simcall_t simcall) {
-  return (smx_file_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
 }
-static inline void simcall_file_close__set__fd(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_file_close__set__fd(smx_simcall_t simcall, smx_file_t arg) {
+    simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
 }
 static inline sg_host_t simcall_file_close__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]);
 }
-static inline void simcall_file_close__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_file_close__set__host(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[1], arg);
 }
 static inline int simcall_file_close__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_file_close__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_file_t simcall_file_unlink__get__fd(smx_simcall_t simcall) {
-  return (smx_file_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
 }
-static inline void simcall_file_unlink__set__fd(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_file_unlink__set__fd(smx_simcall_t simcall, smx_file_t arg) {
+    simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
 }
 static inline sg_host_t simcall_file_unlink__get__host(smx_simcall_t simcall) {
-  return (sg_host_t) simcall->args[1].dp;
+  return simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]);
 }
-static inline void simcall_file_unlink__set__host(smx_simcall_t simcall, void* arg) {
-    simcall->args[1].dp = arg;
+static inline void simcall_file_unlink__set__host(smx_simcall_t simcall, sg_host_t arg) {
+    simgrid::simix::marshal<sg_host_t>(simcall->args[1], arg);
 }
 static inline int simcall_file_unlink__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_file_unlink__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_file_t simcall_file_get_size__get__fd(smx_simcall_t simcall) {
-  return (smx_file_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
 }
-static inline void simcall_file_get_size__set__fd(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_file_get_size__set__fd(smx_simcall_t simcall, smx_file_t arg) {
+    simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
 }
 static inline sg_size_t simcall_file_get_size__get__result(smx_simcall_t simcall){
-    return  simcall->result.sgsz;
+    return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
 static inline void simcall_file_get_size__set__result(smx_simcall_t simcall, sg_size_t result){
-    simcall->result.sgsz = result;
+    simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
 
 static inline smx_file_t simcall_file_tell__get__fd(smx_simcall_t simcall) {
-  return (smx_file_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
 }
-static inline void simcall_file_tell__set__fd(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_file_tell__set__fd(smx_simcall_t simcall, smx_file_t arg) {
+    simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
 }
 static inline sg_size_t simcall_file_tell__get__result(smx_simcall_t simcall){
-    return  simcall->result.sgsz;
+    return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
 static inline void simcall_file_tell__set__result(smx_simcall_t simcall, sg_size_t result){
-    simcall->result.sgsz = result;
+    simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
 
 static inline smx_file_t simcall_file_seek__get__fd(smx_simcall_t simcall) {
-  return (smx_file_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
 }
-static inline void simcall_file_seek__set__fd(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_file_seek__set__fd(smx_simcall_t simcall, smx_file_t arg) {
+    simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
 }
 static inline sg_offset_t simcall_file_seek__get__offset(smx_simcall_t simcall) {
-  return  simcall->args[1].sgoff;
+  return simgrid::simix::unmarshal<sg_offset_t>(simcall->args[1]);
 }
 static inline void simcall_file_seek__set__offset(smx_simcall_t simcall, sg_offset_t arg) {
-    simcall->args[1].sgoff = arg;
+    simgrid::simix::marshal<sg_offset_t>(simcall->args[1], arg);
 }
 static inline int simcall_file_seek__get__origin(smx_simcall_t simcall) {
-  return  simcall->args[2].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[2]);
 }
 static inline void simcall_file_seek__set__origin(smx_simcall_t simcall, int arg) {
-    simcall->args[2].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[2], arg);
 }
 static inline int simcall_file_seek__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_file_seek__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_file_t simcall_file_get_info__get__fd(smx_simcall_t simcall) {
-  return (smx_file_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
 }
-static inline void simcall_file_get_info__set__fd(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_file_get_info__set__fd(smx_simcall_t simcall, smx_file_t arg) {
+    simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
 }
 static inline xbt_dynar_t simcall_file_get_info__get__result(smx_simcall_t simcall){
-    return (xbt_dynar_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<xbt_dynar_t>(simcall->result);
 }
-static inline void simcall_file_get_info__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_file_get_info__set__result(smx_simcall_t simcall, xbt_dynar_t result){
+    simgrid::simix::marshal<xbt_dynar_t>(simcall->result, result);
 }
 
 static inline smx_file_t simcall_file_move__get__fd(smx_simcall_t simcall) {
-  return (smx_file_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]);
 }
-static inline void simcall_file_move__set__fd(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_file_move__set__fd(smx_simcall_t simcall, smx_file_t arg) {
+    simgrid::simix::marshal<smx_file_t>(simcall->args[0], arg);
 }
 static inline const char* simcall_file_move__get__fullpath(smx_simcall_t simcall) {
-  return  simcall->args[1].cc;
+  return simgrid::simix::unmarshal<const char*>(simcall->args[1]);
 }
 static inline void simcall_file_move__set__fullpath(smx_simcall_t simcall, const char* arg) {
-    simcall->args[1].cc = arg;
+    simgrid::simix::marshal<const char*>(simcall->args[1], arg);
 }
 static inline int simcall_file_move__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_file_move__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_storage_t simcall_storage_get_free_size__get__storage(smx_simcall_t simcall) {
-  return (smx_storage_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_storage_t>(simcall->args[0]);
 }
-static inline void simcall_storage_get_free_size__set__storage(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_storage_get_free_size__set__storage(smx_simcall_t simcall, smx_storage_t arg) {
+    simgrid::simix::marshal<smx_storage_t>(simcall->args[0], arg);
 }
 static inline sg_size_t simcall_storage_get_free_size__get__result(smx_simcall_t simcall){
-    return  simcall->result.sgsz;
+    return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
 static inline void simcall_storage_get_free_size__set__result(smx_simcall_t simcall, sg_size_t result){
-    simcall->result.sgsz = result;
+    simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
 
 static inline smx_storage_t simcall_storage_get_used_size__get__name(smx_simcall_t simcall) {
-  return (smx_storage_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_storage_t>(simcall->args[0]);
 }
-static inline void simcall_storage_get_used_size__set__name(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_storage_get_used_size__set__name(smx_simcall_t simcall, smx_storage_t arg) {
+    simgrid::simix::marshal<smx_storage_t>(simcall->args[0], arg);
 }
 static inline sg_size_t simcall_storage_get_used_size__get__result(smx_simcall_t simcall){
-    return  simcall->result.sgsz;
+    return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
 static inline void simcall_storage_get_used_size__set__result(smx_simcall_t simcall, sg_size_t result){
-    simcall->result.sgsz = result;
+    simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
 
 static inline smx_storage_t simcall_storage_get_properties__get__storage(smx_simcall_t simcall) {
-  return (smx_storage_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_storage_t>(simcall->args[0]);
 }
-static inline void simcall_storage_get_properties__set__storage(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_storage_get_properties__set__storage(smx_simcall_t simcall, smx_storage_t arg) {
+    simgrid::simix::marshal<smx_storage_t>(simcall->args[0], arg);
 }
 static inline xbt_dict_t simcall_storage_get_properties__get__result(smx_simcall_t simcall){
-    return (xbt_dict_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<xbt_dict_t>(simcall->result);
 }
-static inline void simcall_storage_get_properties__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_storage_get_properties__set__result(smx_simcall_t simcall, xbt_dict_t result){
+    simgrid::simix::marshal<xbt_dict_t>(simcall->result, result);
 }
 
 static inline smx_storage_t simcall_storage_get_content__get__storage(smx_simcall_t simcall) {
-  return (smx_storage_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_storage_t>(simcall->args[0]);
 }
-static inline void simcall_storage_get_content__set__storage(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_storage_get_content__set__storage(smx_simcall_t simcall, smx_storage_t arg) {
+    simgrid::simix::marshal<smx_storage_t>(simcall->args[0], arg);
 }
 static inline xbt_dict_t simcall_storage_get_content__get__result(smx_simcall_t simcall){
-    return (xbt_dict_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<xbt_dict_t>(simcall->result);
 }
-static inline void simcall_storage_get_content__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_storage_get_content__set__result(smx_simcall_t simcall, xbt_dict_t result){
+    simgrid::simix::marshal<xbt_dict_t>(simcall->result, result);
 }
 
 static inline const char* simcall_asr_get_properties__get__name(smx_simcall_t simcall) {
-  return  simcall->args[0].cc;
+  return simgrid::simix::unmarshal<const char*>(simcall->args[0]);
 }
 static inline void simcall_asr_get_properties__set__name(smx_simcall_t simcall, const char* arg) {
-    simcall->args[0].cc = arg;
+    simgrid::simix::marshal<const char*>(simcall->args[0], arg);
 }
 static inline xbt_dict_t simcall_asr_get_properties__get__result(smx_simcall_t simcall){
-    return (xbt_dict_t) simcall->result.dp;
+    return simgrid::simix::unmarshal<xbt_dict_t>(simcall->result);
 }
-static inline void simcall_asr_get_properties__set__result(smx_simcall_t simcall, void* result){
-    simcall->result.dp = result;
+static inline void simcall_asr_get_properties__set__result(smx_simcall_t simcall, xbt_dict_t result){
+    simgrid::simix::marshal<xbt_dict_t>(simcall->result, result);
 }
 
 static inline int simcall_mc_random__get__min(smx_simcall_t simcall) {
-  return  simcall->args[0].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[0]);
 }
 static inline void simcall_mc_random__set__min(smx_simcall_t simcall, int arg) {
-    simcall->args[0].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[0], arg);
 }
 static inline int simcall_mc_random__get__max(smx_simcall_t simcall) {
-  return  simcall->args[1].i;
+  return simgrid::simix::unmarshal<int>(simcall->args[1]);
 }
 static inline void simcall_mc_random__set__max(smx_simcall_t simcall, int arg) {
-    simcall->args[1].i = arg;
+    simgrid::simix::marshal<int>(simcall->args[1], arg);
 }
 static inline int simcall_mc_random__get__result(smx_simcall_t simcall){
-    return  simcall->result.i;
+    return simgrid::simix::unmarshal<int>(simcall->result);
 }
 static inline void simcall_mc_random__set__result(smx_simcall_t simcall, int result){
-    simcall->result.i = result;
+    simgrid::simix::marshal<int>(simcall->result, result);
 }
 
 static inline smx_synchro_t simcall_set_category__get__synchro(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
+  return simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]);
 }
-static inline void simcall_set_category__set__synchro(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_set_category__set__synchro(smx_simcall_t simcall, smx_synchro_t arg) {
+    simgrid::simix::marshal<smx_synchro_t>(simcall->args[0], arg);
 }
 static inline const char* simcall_set_category__get__category(smx_simcall_t simcall) {
-  return  simcall->args[1].cc;
+  return simgrid::simix::unmarshal<const char*>(simcall->args[1]);
 }
 static inline void simcall_set_category__set__category(smx_simcall_t simcall, const char* arg) {
-    simcall->args[1].cc = arg;
+    simgrid::simix::marshal<const char*>(simcall->args[1], arg);
 }
 
 static inline void* simcall_run_kernel__get__code(smx_simcall_t simcall) {
-  return  simcall->args[0].dp;
+  return simgrid::simix::unmarshal<void*>(simcall->args[0]);
 }
 static inline void simcall_run_kernel__set__code(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+    simgrid::simix::marshal<void*>(simcall->args[0], arg);
 }
 
 /* The prototype of all simcall handlers, automatically generated for you */
index 9494181..5a5ef80 100644 (file)
 #include "xbt/ex.h"
 #include <simgrid/simix.hpp>
 /** @cond */ // Please Doxygen, don't look at this
+
+template<class R, class... T>
+inline static R simcall(e_smx_simcall_t call, T const&... t)
+{
+  smx_process_t self = SIMIX_process_self();
+  simgrid::simix::marshal(&self->simcall, call, t...);
+  if (self != simix_global->maestro_process) {
+    XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
+              SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
+    SIMIX_process_yield(self);
+  } else {
+    SIMIX_simcall_handle(&self->simcall, 0);
+  }
+  return simgrid::simix::unmarshal<R>(self->simcall.result);
+}
   
 inline static void simcall_BODY_vm_suspend(sg_host_t ind_vm) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_suspend(&self->simcall, ind_vm);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_VM_SUSPEND;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_vm_suspend(&SIMIX_process_self()->simcall, ind_vm);
+    return simcall<void, sg_host_t>(SIMCALL_VM_SUSPEND, ind_vm);
   }
   
 inline static void simcall_BODY_vm_resume(sg_host_t ind_vm) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_resume(&self->simcall, ind_vm);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_VM_RESUME;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_vm_resume(&SIMIX_process_self()->simcall, ind_vm);
+    return simcall<void, sg_host_t>(SIMCALL_VM_RESUME, ind_vm);
   }
   
 inline static void simcall_BODY_vm_shutdown(sg_host_t ind_vm) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_shutdown(&self->simcall, ind_vm);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_VM_SHUTDOWN;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_vm_shutdown(&SIMIX_process_self()->simcall, ind_vm);
+    return simcall<void, sg_host_t>(SIMCALL_VM_SHUTDOWN, ind_vm);
   }
   
 inline static void simcall_BODY_vm_save(sg_host_t ind_vm) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_save(&self->simcall, ind_vm);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_VM_SAVE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_vm_save(&SIMIX_process_self()->simcall, ind_vm);
+    return simcall<void, sg_host_t>(SIMCALL_VM_SAVE, ind_vm);
   }
   
 inline static void simcall_BODY_vm_restore(sg_host_t ind_vm) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_vm_restore(&self->simcall, ind_vm);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_VM_RESTORE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) ind_vm;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_vm_restore(&SIMIX_process_self()->simcall, ind_vm);
+    return simcall<void, sg_host_t>(SIMCALL_VM_RESTORE, ind_vm);
   }
   
 inline static void simcall_BODY_process_kill(smx_process_t process) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_kill(&self->simcall, process);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_KILL;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_process_kill(&SIMIX_process_self()->simcall, process);
+    return simcall<void, smx_process_t>(SIMCALL_PROCESS_KILL, process);
   }
   
 inline static void simcall_BODY_process_killall(int reset_pid) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_killall(&self->simcall, reset_pid);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_KILLALL;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].i = (int) reset_pid;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall, reset_pid);
+    return simcall<void, int>(SIMCALL_PROCESS_KILLALL, reset_pid);
   }
   
 inline static void simcall_BODY_process_cleanup(smx_process_t process) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_process_cleanup(process);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_CLEANUP;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_process_t>(SIMCALL_PROCESS_CLEANUP, process);
   }
   
 inline static void simcall_BODY_process_suspend(smx_process_t process) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_suspend(&self->simcall, process);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_SUSPEND;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_process_suspend(&SIMIX_process_self()->simcall, process);
+    return simcall<void, smx_process_t>(SIMCALL_PROCESS_SUSPEND, process);
   }
   
 inline static void simcall_BODY_process_resume(smx_process_t process) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_resume(&self->simcall, process);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_RESUME;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_process_resume(&SIMIX_process_self()->simcall, process);
+    return simcall<void, smx_process_t>(SIMCALL_PROCESS_RESUME, process);
   }
   
 inline static void simcall_BODY_process_set_host(smx_process_t process, sg_host_t dest) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_set_host(&self->simcall, process, dest);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_SET_HOST;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    self->simcall.args[1].dp = (void*) dest;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_process_set_host(&SIMIX_process_self()->simcall, process, dest);
+    return simcall<void, smx_process_t, sg_host_t>(SIMCALL_PROCESS_SET_HOST, process, dest);
   }
   
 inline static int simcall_BODY_process_is_suspended(smx_process_t process) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_process_is_suspended(process);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_IS_SUSPENDED;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    return simcall<int, smx_process_t>(SIMCALL_PROCESS_IS_SUSPENDED, process);
   }
   
 inline static int simcall_BODY_process_join(smx_process_t process, double timeout) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_join(&self->simcall, process, timeout);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_JOIN;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    self->simcall.args[1].d = (double) timeout;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_process_join(&SIMIX_process_self()->simcall, process, timeout);
+    return simcall<int, smx_process_t, double>(SIMCALL_PROCESS_JOIN, process, timeout);
   }
   
 inline static int simcall_BODY_process_sleep(double duration) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_sleep(&self->simcall, duration);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_SLEEP;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].d = (double) duration;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_process_sleep(&SIMIX_process_self()->simcall, duration);
+    return simcall<int, double>(SIMCALL_PROCESS_SLEEP, duration);
   }
   
 inline static smx_synchro_t simcall_BODY_execution_start(const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_execution_start(&self->simcall, name, flops_amount, priority, bound, affinity_mask);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_EXECUTION_START;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].cc = (const char*) name;
-    self->simcall.args[1].d = (double) flops_amount;
-    self->simcall.args[2].d = (double) priority;
-    self->simcall.args[3].d = (double) bound;
-    self->simcall.args[4].ul = (unsigned long) affinity_mask;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_synchro_t) self->simcall.result.dp;
+    if (0) simcall_HANDLER_execution_start(&SIMIX_process_self()->simcall, name, flops_amount, priority, bound, affinity_mask);
+    return simcall<smx_synchro_t, const char*, double, double, double, unsigned long>(SIMCALL_EXECUTION_START, name, flops_amount, priority, bound, affinity_mask);
   }
   
 inline static smx_synchro_t simcall_BODY_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_execution_parallel_start(name, host_nb, host_list, flops_amount, bytes_amount, amount, rate);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_EXECUTION_PARALLEL_START;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].cc = (const char*) name;
-    self->simcall.args[1].i = (int) host_nb;
-    self->simcall.args[2].dp = (void*) host_list;
-    self->simcall.args[3].dp = (void*) flops_amount;
-    self->simcall.args[4].dp = (void*) bytes_amount;
-    self->simcall.args[5].d = (double) amount;
-    self->simcall.args[6].d = (double) rate;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_synchro_t) self->simcall.result.dp;
+    return simcall<smx_synchro_t, const char*, int, sg_host_t*, double*, double*, double, double>(SIMCALL_EXECUTION_PARALLEL_START, name, host_nb, host_list, flops_amount, bytes_amount, amount, rate);
   }
   
 inline static void simcall_BODY_execution_cancel(smx_synchro_t execution) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_execution_cancel(execution);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_EXECUTION_CANCEL;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_synchro_t>(SIMCALL_EXECUTION_CANCEL, execution);
   }
   
 inline static void simcall_BODY_execution_set_priority(smx_synchro_t execution, double priority) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_execution_set_priority(execution, priority);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_EXECUTION_SET_PRIORITY;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
-    self->simcall.args[1].d = (double) priority;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_synchro_t, double>(SIMCALL_EXECUTION_SET_PRIORITY, execution, priority);
   }
   
 inline static void simcall_BODY_execution_set_bound(smx_synchro_t execution, double bound) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_execution_set_bound(execution, bound);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_EXECUTION_SET_BOUND;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
-    self->simcall.args[1].d = (double) bound;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_synchro_t, double>(SIMCALL_EXECUTION_SET_BOUND, execution, bound);
   }
   
 inline static void simcall_BODY_execution_set_affinity(smx_synchro_t execution, sg_host_t ws, unsigned long mask) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_execution_set_affinity(execution, ws, mask);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_EXECUTION_SET_AFFINITY;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
-    self->simcall.args[1].dp = (void*) ws;
-    self->simcall.args[2].ul = (unsigned long) mask;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_synchro_t, sg_host_t, unsigned long>(SIMCALL_EXECUTION_SET_AFFINITY, execution, ws, mask);
   }
   
 inline static int simcall_BODY_execution_wait(smx_synchro_t execution) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_execution_wait(&self->simcall, execution);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_EXECUTION_WAIT;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) execution;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_execution_wait(&SIMIX_process_self()->simcall, execution);
+    return simcall<int, smx_synchro_t>(SIMCALL_EXECUTION_WAIT, execution);
   }
   
 inline static void simcall_BODY_process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void* data) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_process_on_exit(process, fun, data);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_ON_EXIT;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    self->simcall.args[1].fp = (FPtr) fun;
-    self->simcall.args[2].dp = (void*) data;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_process_t, int_f_pvoid_pvoid_t, void*>(SIMCALL_PROCESS_ON_EXIT, process, fun, data);
   }
   
 inline static void simcall_BODY_process_auto_restart_set(smx_process_t process, int auto_restart) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_process_auto_restart_set(process, auto_restart);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_AUTO_RESTART_SET;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    self->simcall.args[1].i = (int) auto_restart;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_process_t, int>(SIMCALL_PROCESS_AUTO_RESTART_SET, process, auto_restart);
   }
   
 inline static smx_process_t simcall_BODY_process_restart(smx_process_t process) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_restart(&self->simcall, process);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_PROCESS_RESTART;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) process;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                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;
+    if (0) simcall_HANDLER_process_restart(&SIMIX_process_self()->simcall, process);
+    return simcall<smx_process_t, smx_process_t>(SIMCALL_PROCESS_RESTART, process);
   }
   
 inline static smx_mailbox_t simcall_BODY_mbox_create(const char* name) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_mbox_create(name);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_MBOX_CREATE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].cc = (const char*) name;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_mailbox_t) self->simcall.result.dp;
+    return simcall<smx_mailbox_t, const char*>(SIMCALL_MBOX_CREATE, name);
   }
   
 inline static void simcall_BODY_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t receiver) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_mbox_set_receiver(mbox, receiver);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_MBOX_SET_RECEIVER;
-    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;
-    self->simcall.args[1].dp = (void*) receiver;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_mailbox_t, smx_process_t>(SIMCALL_MBOX_SET_RECEIVER, mbox, receiver);
   }
   
 inline static smx_synchro_t simcall_BODY_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag, simix_match_func_t match_fun, void* data) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_comm_iprobe(&self->simcall, mbox, type, src, tag, match_fun, data);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_IPROBE;
-    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;
-    self->simcall.args[1].i = (int) type;
-    self->simcall.args[2].i = (int) src;
-    self->simcall.args[3].i = (int) tag;
-    self->simcall.args[4].fp = (FPtr) match_fun;
-    self->simcall.args[5].dp = (void*) data;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_synchro_t) self->simcall.result.dp;
+    if (0) simcall_HANDLER_comm_iprobe(&SIMIX_process_self()->simcall, mbox, type, src, tag, match_fun, data);
+    return simcall<smx_synchro_t, smx_mailbox_t, int, int, int, simix_match_func_t, void*>(SIMCALL_COMM_IPROBE, mbox, type, src, tag, match_fun, data);
   }
   
 inline static void simcall_BODY_comm_send(smx_process_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_comm_send(&self->simcall, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_SEND;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) sender;
-    self->simcall.args[1].dp = (void*) mbox;
-    self->simcall.args[2].d = (double) task_size;
-    self->simcall.args[3].d = (double) rate;
-    self->simcall.args[4].dp = (void*) src_buff;
-    self->simcall.args[5].sz = (size_t) src_buff_size;
-    self->simcall.args[6].fp = (FPtr) match_fun;
-    self->simcall.args[7].fp = (FPtr) copy_data_fun;
-    self->simcall.args[8].dp = (void*) data;
-    self->simcall.args[9].d = (double) timeout;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_comm_send(&SIMIX_process_self()->simcall, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
+    return simcall<void, smx_process_t, smx_mailbox_t, double, double, void*, size_t, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_SEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout);
   }
   
 inline static smx_synchro_t simcall_BODY_comm_isend(smx_process_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_comm_isend(&self->simcall, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_ISEND;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) sender;
-    self->simcall.args[1].dp = (void*) mbox;
-    self->simcall.args[2].d = (double) task_size;
-    self->simcall.args[3].d = (double) rate;
-    self->simcall.args[4].dp = (void*) src_buff;
-    self->simcall.args[5].sz = (size_t) src_buff_size;
-    self->simcall.args[6].fp = (FPtr) match_fun;
-    self->simcall.args[7].fp = (FPtr) clean_fun;
-    self->simcall.args[8].fp = (FPtr) copy_data_fun;
-    self->simcall.args[9].dp = (void*) data;
-    self->simcall.args[10].i = (int) detached;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_synchro_t) self->simcall.result.dp;
+    if (0) simcall_HANDLER_comm_isend(&SIMIX_process_self()->simcall, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
+    return simcall<smx_synchro_t, smx_process_t, smx_mailbox_t, double, double, void*, size_t, simix_match_func_t, simix_clean_func_t, simix_copy_data_func_t, void*, int>(SIMCALL_COMM_ISEND, sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached);
   }
   
 inline static void simcall_BODY_comm_recv(smx_process_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_comm_recv(&self->simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_RECV;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) receiver;
-    self->simcall.args[1].dp = (void*) mbox;
-    self->simcall.args[2].dp = (void*) dst_buff;
-    self->simcall.args[3].dp = (void*) dst_buff_size;
-    self->simcall.args[4].fp = (FPtr) match_fun;
-    self->simcall.args[5].fp = (FPtr) copy_data_fun;
-    self->simcall.args[6].dp = (void*) data;
-    self->simcall.args[7].d = (double) timeout;
-    self->simcall.args[8].d = (double) rate;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_comm_recv(&SIMIX_process_self()->simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
+    return simcall<void, smx_process_t, smx_mailbox_t, void*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double, double>(SIMCALL_COMM_RECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate);
   }
   
 inline static smx_synchro_t simcall_BODY_comm_irecv(smx_process_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_comm_irecv(&self->simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_IRECV;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) receiver;
-    self->simcall.args[1].dp = (void*) mbox;
-    self->simcall.args[2].dp = (void*) dst_buff;
-    self->simcall.args[3].dp = (void*) dst_buff_size;
-    self->simcall.args[4].fp = (FPtr) match_fun;
-    self->simcall.args[5].fp = (FPtr) copy_data_fun;
-    self->simcall.args[6].dp = (void*) data;
-    self->simcall.args[7].d = (double) rate;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_synchro_t) self->simcall.result.dp;
+    if (0) simcall_HANDLER_comm_irecv(&SIMIX_process_self()->simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
+    return simcall<smx_synchro_t, smx_process_t, smx_mailbox_t, void*, size_t*, simix_match_func_t, simix_copy_data_func_t, void*, double>(SIMCALL_COMM_IRECV, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
   }
   
 inline static int simcall_BODY_comm_waitany(xbt_dynar_t comms) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_comm_waitany(&self->simcall, comms);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_WAITANY;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) comms;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_comm_waitany(&SIMIX_process_self()->simcall, comms);
+    return simcall<int, xbt_dynar_t>(SIMCALL_COMM_WAITANY, comms);
   }
   
 inline static void simcall_BODY_comm_wait(smx_synchro_t comm, double timeout) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_comm_wait(&self->simcall, comm, timeout);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_WAIT;
-    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;
-    self->simcall.args[1].d = (double) timeout;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_comm_wait(&SIMIX_process_self()->simcall, comm, timeout);
+    return simcall<void, smx_synchro_t, double>(SIMCALL_COMM_WAIT, comm, timeout);
   }
   
 inline static int simcall_BODY_comm_test(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) simcall_HANDLER_comm_test(&self->simcall, comm);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_TEST;
-    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.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_comm_test(&SIMIX_process_self()->simcall, comm);
+    return simcall<int, smx_synchro_t>(SIMCALL_COMM_TEST, comm);
   }
   
 inline static int simcall_BODY_comm_testany(xbt_dynar_t comms) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_comm_testany(&self->simcall, comms);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_TESTANY;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) comms;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_comm_testany(&SIMIX_process_self()->simcall, comms);
+    return simcall<int, xbt_dynar_t>(SIMCALL_COMM_TESTANY, comms);
   }
   
 inline static smx_mutex_t simcall_BODY_mutex_init() {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_mutex_init(&self->simcall);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_MUTEX_INIT;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_mutex_t) self->simcall.result.dp;
+    if (0) simcall_HANDLER_mutex_init(&SIMIX_process_self()->simcall);
+    return simcall<smx_mutex_t>(SIMCALL_MUTEX_INIT);
   }
   
 inline static void simcall_BODY_mutex_lock(smx_mutex_t mutex) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_mutex_lock(&self->simcall, mutex);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_MUTEX_LOCK;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) mutex;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_mutex_lock(&SIMIX_process_self()->simcall, mutex);
+    return simcall<void, smx_mutex_t>(SIMCALL_MUTEX_LOCK, mutex);
   }
   
 inline static int simcall_BODY_mutex_trylock(smx_mutex_t mutex) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_mutex_trylock(&self->simcall, mutex);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_MUTEX_TRYLOCK;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) mutex;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_mutex_trylock(&SIMIX_process_self()->simcall, mutex);
+    return simcall<int, smx_mutex_t>(SIMCALL_MUTEX_TRYLOCK, mutex);
   }
   
 inline static void simcall_BODY_mutex_unlock(smx_mutex_t mutex) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_mutex_unlock(&self->simcall, mutex);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_MUTEX_UNLOCK;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) mutex;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_mutex_unlock(&SIMIX_process_self()->simcall, mutex);
+    return simcall<void, smx_mutex_t>(SIMCALL_MUTEX_UNLOCK, mutex);
   }
   
 inline static smx_cond_t simcall_BODY_cond_init() {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_cond_init();
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COND_INIT;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_cond_t) self->simcall.result.dp;
+    return simcall<smx_cond_t>(SIMCALL_COND_INIT);
   }
   
 inline static void simcall_BODY_cond_signal(smx_cond_t cond) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_cond_signal(cond);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COND_SIGNAL;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) cond;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_cond_t>(SIMCALL_COND_SIGNAL, cond);
   }
   
 inline static void simcall_BODY_cond_wait(smx_cond_t cond, smx_mutex_t mutex) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_cond_wait(&self->simcall, cond, mutex);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COND_WAIT;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) cond;
-    self->simcall.args[1].dp = (void*) mutex;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_cond_wait(&SIMIX_process_self()->simcall, cond, mutex);
+    return simcall<void, smx_cond_t, smx_mutex_t>(SIMCALL_COND_WAIT, cond, mutex);
   }
   
 inline static void simcall_BODY_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_cond_wait_timeout(&self->simcall, cond, mutex, timeout);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COND_WAIT_TIMEOUT;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) cond;
-    self->simcall.args[1].dp = (void*) mutex;
-    self->simcall.args[2].d = (double) timeout;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_cond_wait_timeout(&SIMIX_process_self()->simcall, cond, mutex, timeout);
+    return simcall<void, smx_cond_t, smx_mutex_t, double>(SIMCALL_COND_WAIT_TIMEOUT, cond, mutex, timeout);
   }
   
 inline static void simcall_BODY_cond_broadcast(smx_cond_t cond) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_cond_broadcast(cond);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COND_BROADCAST;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) cond;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_cond_t>(SIMCALL_COND_BROADCAST, cond);
   }
   
 inline static smx_sem_t simcall_BODY_sem_init(unsigned int capacity) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_sem_init(capacity);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_SEM_INIT;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].ui = (unsigned int) capacity;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_sem_t) self->simcall.result.dp;
+    return simcall<smx_sem_t, unsigned int>(SIMCALL_SEM_INIT, capacity);
   }
   
 inline static void simcall_BODY_sem_release(smx_sem_t sem) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_sem_release(&self->simcall, sem);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_SEM_RELEASE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) sem;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_sem_release(&SIMIX_process_self()->simcall, sem);
+    return simcall<void, smx_sem_t>(SIMCALL_SEM_RELEASE, sem);
   }
   
 inline static int simcall_BODY_sem_would_block(smx_sem_t sem) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_sem_would_block(&self->simcall, sem);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_SEM_WOULD_BLOCK;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) sem;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_sem_would_block(&SIMIX_process_self()->simcall, sem);
+    return simcall<int, smx_sem_t>(SIMCALL_SEM_WOULD_BLOCK, sem);
   }
   
 inline static void simcall_BODY_sem_acquire(smx_sem_t sem) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_sem_acquire(&self->simcall, sem);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_SEM_ACQUIRE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) sem;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_sem_acquire(&SIMIX_process_self()->simcall, sem);
+    return simcall<void, smx_sem_t>(SIMCALL_SEM_ACQUIRE, sem);
   }
   
 inline static void simcall_BODY_sem_acquire_timeout(smx_sem_t sem, double timeout) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_sem_acquire_timeout(&self->simcall, sem, timeout);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_SEM_ACQUIRE_TIMEOUT;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) sem;
-    self->simcall.args[1].d = (double) timeout;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    if (0) simcall_HANDLER_sem_acquire_timeout(&SIMIX_process_self()->simcall, sem, timeout);
+    return simcall<void, smx_sem_t, double>(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem, timeout);
   }
   
 inline static int simcall_BODY_sem_get_capacity(smx_sem_t sem) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_sem_get_capacity(&self->simcall, sem);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_SEM_GET_CAPACITY;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) sem;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_sem_get_capacity(&SIMIX_process_self()->simcall, sem);
+    return simcall<int, smx_sem_t>(SIMCALL_SEM_GET_CAPACITY, sem);
   }
   
 inline static sg_size_t simcall_BODY_file_read(smx_file_t fd, sg_size_t size, sg_host_t host) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_read(&self->simcall, fd, size, host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_READ;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) fd;
-    self->simcall.args[1].sgsz = (sg_size_t) size;
-    self->simcall.args[2].dp = (void*) host;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (sg_size_t) self->simcall.result.sgsz;
+    if (0) simcall_HANDLER_file_read(&SIMIX_process_self()->simcall, fd, size, host);
+    return simcall<sg_size_t, smx_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_READ, fd, size, host);
   }
   
 inline static sg_size_t simcall_BODY_file_write(smx_file_t fd, sg_size_t size, sg_host_t host) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_write(&self->simcall, fd, size, host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_WRITE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) fd;
-    self->simcall.args[1].sgsz = (sg_size_t) size;
-    self->simcall.args[2].dp = (void*) host;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (sg_size_t) self->simcall.result.sgsz;
+    if (0) simcall_HANDLER_file_write(&SIMIX_process_self()->simcall, fd, size, host);
+    return simcall<sg_size_t, smx_file_t, sg_size_t, sg_host_t>(SIMCALL_FILE_WRITE, fd, size, host);
   }
   
 inline static smx_file_t simcall_BODY_file_open(const char* fullpath, sg_host_t host) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_open(&self->simcall, fullpath, host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_OPEN;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].cc = (const char*) fullpath;
-    self->simcall.args[1].dp = (void*) host;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (smx_file_t) self->simcall.result.dp;
+    if (0) simcall_HANDLER_file_open(&SIMIX_process_self()->simcall, fullpath, host);
+    return simcall<smx_file_t, const char*, sg_host_t>(SIMCALL_FILE_OPEN, fullpath, host);
   }
   
 inline static int simcall_BODY_file_close(smx_file_t fd, sg_host_t host) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_close(&self->simcall, fd, host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_CLOSE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) fd;
-    self->simcall.args[1].dp = (void*) host;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_file_close(&SIMIX_process_self()->simcall, fd, host);
+    return simcall<int, smx_file_t, sg_host_t>(SIMCALL_FILE_CLOSE, fd, host);
   }
   
 inline static int simcall_BODY_file_unlink(smx_file_t fd, sg_host_t host) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_file_unlink(fd, host);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_UNLINK;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) fd;
-    self->simcall.args[1].dp = (void*) host;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    return simcall<int, smx_file_t, sg_host_t>(SIMCALL_FILE_UNLINK, fd, host);
   }
   
 inline static sg_size_t simcall_BODY_file_get_size(smx_file_t fd) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_get_size(&self->simcall, fd);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_GET_SIZE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) fd;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (sg_size_t) self->simcall.result.sgsz;
+    if (0) simcall_HANDLER_file_get_size(&SIMIX_process_self()->simcall, fd);
+    return simcall<sg_size_t, smx_file_t>(SIMCALL_FILE_GET_SIZE, fd);
   }
   
 inline static sg_size_t simcall_BODY_file_tell(smx_file_t fd) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_tell(&self->simcall, fd);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_TELL;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) fd;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (sg_size_t) self->simcall.result.sgsz;
+    if (0) simcall_HANDLER_file_tell(&SIMIX_process_self()->simcall, fd);
+    return simcall<sg_size_t, smx_file_t>(SIMCALL_FILE_TELL, fd);
   }
   
 inline static int simcall_BODY_file_seek(smx_file_t fd, sg_offset_t offset, int origin) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_seek(&self->simcall, fd, offset, origin);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_SEEK;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) fd;
-    self->simcall.args[1].sgoff = (sg_offset_t) offset;
-    self->simcall.args[2].i = (int) origin;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_file_seek(&SIMIX_process_self()->simcall, fd, offset, origin);
+    return simcall<int, smx_file_t, sg_offset_t, int>(SIMCALL_FILE_SEEK, fd, offset, origin);
   }
   
 inline static xbt_dynar_t simcall_BODY_file_get_info(smx_file_t fd) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_get_info(&self->simcall, fd);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_GET_INFO;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) fd;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (xbt_dynar_t) self->simcall.result.dp;
+    if (0) simcall_HANDLER_file_get_info(&SIMIX_process_self()->simcall, fd);
+    return simcall<xbt_dynar_t, smx_file_t>(SIMCALL_FILE_GET_INFO, fd);
   }
   
 inline static int simcall_BODY_file_move(smx_file_t fd, const char* fullpath) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_file_move(&self->simcall, fd, fullpath);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_FILE_MOVE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) fd;
-    self->simcall.args[1].cc = (const char*) fullpath;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_file_move(&SIMIX_process_self()->simcall, fd, fullpath);
+    return simcall<int, smx_file_t, const char*>(SIMCALL_FILE_MOVE, fd, fullpath);
   }
   
 inline static sg_size_t simcall_BODY_storage_get_free_size(smx_storage_t storage) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_storage_get_free_size(&self->simcall, storage);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_STORAGE_GET_FREE_SIZE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) storage;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (sg_size_t) self->simcall.result.sgsz;
+    if (0) simcall_HANDLER_storage_get_free_size(&SIMIX_process_self()->simcall, storage);
+    return simcall<sg_size_t, smx_storage_t>(SIMCALL_STORAGE_GET_FREE_SIZE, storage);
   }
   
 inline static sg_size_t simcall_BODY_storage_get_used_size(smx_storage_t name) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_storage_get_used_size(&self->simcall, name);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_STORAGE_GET_USED_SIZE;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) name;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (sg_size_t) self->simcall.result.sgsz;
+    if (0) simcall_HANDLER_storage_get_used_size(&SIMIX_process_self()->simcall, name);
+    return simcall<sg_size_t, smx_storage_t>(SIMCALL_STORAGE_GET_USED_SIZE, name);
   }
   
 inline static xbt_dict_t simcall_BODY_storage_get_properties(smx_storage_t storage) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_storage_get_properties(storage);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_STORAGE_GET_PROPERTIES;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) storage;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (xbt_dict_t) self->simcall.result.dp;
+    return simcall<xbt_dict_t, smx_storage_t>(SIMCALL_STORAGE_GET_PROPERTIES, storage);
   }
   
 inline static xbt_dict_t simcall_BODY_storage_get_content(smx_storage_t storage) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_storage_get_content(storage);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_STORAGE_GET_CONTENT;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) storage;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (xbt_dict_t) self->simcall.result.dp;
+    return simcall<xbt_dict_t, smx_storage_t>(SIMCALL_STORAGE_GET_CONTENT, storage);
   }
   
 inline static xbt_dict_t simcall_BODY_asr_get_properties(const char* name) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_asr_get_properties(&self->simcall, name);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_ASR_GET_PROPERTIES;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].cc = (const char*) name;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (xbt_dict_t) self->simcall.result.dp;
+    if (0) simcall_HANDLER_asr_get_properties(&SIMIX_process_self()->simcall, name);
+    return simcall<xbt_dict_t, const char*>(SIMCALL_ASR_GET_PROPERTIES, name);
   }
   
 inline static int simcall_BODY_mc_random(int min, int max) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_mc_random(&self->simcall, min, max);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_MC_RANDOM;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].i = (int) min;
-    self->simcall.args[1].i = (int) max;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (int) self->simcall.result.i;
+    if (0) simcall_HANDLER_mc_random(&SIMIX_process_self()->simcall, min, max);
+    return simcall<int, int, int>(SIMCALL_MC_RANDOM, min, max);
   }
   
 inline static void simcall_BODY_set_category(smx_synchro_t synchro, const char* category) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_set_category(synchro, category);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_SET_CATEGORY;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) synchro;
-    self->simcall.args[1].cc = (const char*) category;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, smx_synchro_t, const char*>(SIMCALL_SET_CATEGORY, synchro, category);
   }
   
 inline static void simcall_BODY_run_kernel(void* code) {
-    smx_process_t self = SIMIX_process_self();
-
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) SIMIX_run_kernel(code);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_RUN_KERNEL;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) code;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    
+    return simcall<void, void*>(SIMCALL_RUN_KERNEL, code);
   }/** @endcond */
index a46f11e..c34bbb5 100644 (file)
@@ -104,323 +104,323 @@ void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {
     return;
   switch (simcall->call) {
 case SIMCALL_VM_SUSPEND:
-       simcall_HANDLER_vm_suspend(simcall , (sg_host_t) simcall->args[0].dp);
+      simcall_HANDLER_vm_suspend(simcall, simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_RESUME:
-       simcall_HANDLER_vm_resume(simcall , (sg_host_t) simcall->args[0].dp);
+      simcall_HANDLER_vm_resume(simcall, simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_SHUTDOWN:
-       simcall_HANDLER_vm_shutdown(simcall , (sg_host_t) simcall->args[0].dp);
+      simcall_HANDLER_vm_shutdown(simcall, simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_SAVE:
-       simcall_HANDLER_vm_save(simcall , (sg_host_t) simcall->args[0].dp);
+      simcall_HANDLER_vm_save(simcall, simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_VM_RESTORE:
-       simcall_HANDLER_vm_restore(simcall , (sg_host_t) simcall->args[0].dp);
+      simcall_HANDLER_vm_restore(simcall, simgrid::simix::unmarshal<sg_host_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_KILL:
-       simcall_HANDLER_process_kill(simcall , (smx_process_t) simcall->args[0].dp);
+      simcall_HANDLER_process_kill(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_KILLALL:
-       simcall_HANDLER_process_killall(simcall ,  simcall->args[0].i);
+      simcall_HANDLER_process_killall(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_CLEANUP:
-       SIMIX_process_cleanup((smx_process_t) simcall->args[0].dp);
+      SIMIX_process_cleanup(simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_SUSPEND:
-       simcall_HANDLER_process_suspend(simcall , (smx_process_t) simcall->args[0].dp);
+      simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]));
        break;  
 
 case SIMCALL_PROCESS_RESUME:
-       simcall_HANDLER_process_resume(simcall , (smx_process_t) simcall->args[0].dp);
+      simcall_HANDLER_process_resume(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_SET_HOST:
-       simcall_HANDLER_process_set_host(simcall , (smx_process_t) simcall->args[0].dp, (sg_host_t) simcall->args[1].dp);
+      simcall_HANDLER_process_set_host(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_IS_SUSPENDED:
-      simcall->result.i = SIMIX_process_is_suspended((smx_process_t) simcall->args[0].dp);
+      simgrid::simix::marshal<int>(simcall->result, SIMIX_process_is_suspended(simgrid::simix::unmarshal<smx_process_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_JOIN:
-       simcall_HANDLER_process_join(simcall , (smx_process_t) simcall->args[0].dp,  simcall->args[1].d);
+      simcall_HANDLER_process_join(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
        break;  
 
 case SIMCALL_PROCESS_SLEEP:
-       simcall_HANDLER_process_sleep(simcall ,  simcall->args[0].d);
+      simcall_HANDLER_process_sleep(simcall, simgrid::simix::unmarshal<double>(simcall->args[0]));
        break;  
 
 case SIMCALL_EXECUTION_START:
-      simcall->result.dp = simcall_HANDLER_execution_start(simcall ,  simcall->args[0].cc,  simcall->args[1].d,  simcall->args[2].d,  simcall->args[3].d,  simcall->args[4].ul);
+      simgrid::simix::marshal<smx_synchro_t>(simcall->result, simcall_HANDLER_execution_start(simcall, simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]), simgrid::simix::unmarshal<double>(simcall->args[3]), simgrid::simix::unmarshal<unsigned long>(simcall->args[4])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_EXECUTION_PARALLEL_START:
-      simcall->result.dp = SIMIX_execution_parallel_start( simcall->args[0].cc, simcall->args[1].i,(sg_host_t*) simcall->args[2].dp,(double*) simcall->args[3].dp,(double*) simcall->args[4].dp, simcall->args[5].d, simcall->args[6].d);
+      simgrid::simix::marshal<smx_synchro_t>(simcall->result, SIMIX_execution_parallel_start(simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]), simgrid::simix::unmarshal<sg_host_t*>(simcall->args[2]), simgrid::simix::unmarshal<double*>(simcall->args[3]), simgrid::simix::unmarshal<double*>(simcall->args[4]), simgrid::simix::unmarshal<double>(simcall->args[5]), simgrid::simix::unmarshal<double>(simcall->args[6])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_EXECUTION_CANCEL:
-       SIMIX_execution_cancel((smx_synchro_t) simcall->args[0].dp);
+      SIMIX_execution_cancel(simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_EXECUTION_SET_PRIORITY:
-       SIMIX_execution_set_priority((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d);
+      SIMIX_execution_set_priority(simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_EXECUTION_SET_BOUND:
-       SIMIX_execution_set_bound((smx_synchro_t) simcall->args[0].dp, simcall->args[1].d);
+      SIMIX_execution_set_bound(simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_EXECUTION_SET_AFFINITY:
-       SIMIX_execution_set_affinity((smx_synchro_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp, simcall->args[2].ul);
+      SIMIX_execution_set_affinity(simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]), simgrid::simix::unmarshal<unsigned long>(simcall->args[2]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_EXECUTION_WAIT:
-       simcall_HANDLER_execution_wait(simcall , (smx_synchro_t) simcall->args[0].dp);
+      simcall_HANDLER_execution_wait(simcall, simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]));
        break;  
 
 case SIMCALL_PROCESS_ON_EXIT:
-       SIMIX_process_on_exit((smx_process_t) simcall->args[0].dp,(int_f_pvoid_pvoid_t) simcall->args[1].fp, simcall->args[2].dp);
+      SIMIX_process_on_exit(simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]), simgrid::simix::unmarshal<int_f_pvoid_pvoid_t>(simcall->args[1]), simgrid::simix::unmarshal<void*>(simcall->args[2]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_AUTO_RESTART_SET:
-       SIMIX_process_auto_restart_set((smx_process_t) simcall->args[0].dp, simcall->args[1].i);
+      SIMIX_process_auto_restart_set(simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_PROCESS_RESTART:
-      simcall->result.dp = simcall_HANDLER_process_restart(simcall , (smx_process_t) simcall->args[0].dp);
+      simgrid::simix::marshal<smx_process_t>(simcall->result, simcall_HANDLER_process_restart(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_MBOX_CREATE:
-      simcall->result.dp = SIMIX_mbox_create( simcall->args[0].cc);
+      simgrid::simix::marshal<smx_mailbox_t>(simcall->result, SIMIX_mbox_create(simgrid::simix::unmarshal<const char*>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_MBOX_SET_RECEIVER:
-       SIMIX_mbox_set_receiver((smx_mailbox_t) simcall->args[0].dp,(smx_process_t) simcall->args[1].dp);
+      SIMIX_mbox_set_receiver(simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_process_t>(simcall->args[1]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_COMM_IPROBE:
-      simcall->result.dp = simcall_HANDLER_comm_iprobe(simcall , (smx_mailbox_t) simcall->args[0].dp,  simcall->args[1].i,  simcall->args[2].i,  simcall->args[3].i, (simix_match_func_t) simcall->args[4].fp,  simcall->args[5].dp);
+      simgrid::simix::marshal<smx_synchro_t>(simcall->result, simcall_HANDLER_comm_iprobe(simcall, simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]), simgrid::simix::unmarshal<int>(simcall->args[2]), simgrid::simix::unmarshal<int>(simcall->args[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[4]), simgrid::simix::unmarshal<void*>(simcall->args[5])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_COMM_SEND:
-       simcall_HANDLER_comm_send(simcall , (smx_process_t) simcall->args[0].dp, (smx_mailbox_t) simcall->args[1].dp,  simcall->args[2].d,  simcall->args[3].d,  simcall->args[4].dp,  simcall->args[5].sz, (simix_match_func_t) simcall->args[6].fp, (simix_copy_data_func_t) simcall->args[7].fp,  simcall->args[8].dp,  simcall->args[9].d);
+      simcall_HANDLER_comm_send(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]), simgrid::simix::unmarshal<double>(simcall->args[3]), simgrid::simix::unmarshal<void*>(simcall->args[4]), simgrid::simix::unmarshal<size_t>(simcall->args[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[7]), simgrid::simix::unmarshal<void*>(simcall->args[8]), simgrid::simix::unmarshal<double>(simcall->args[9]));
        break;  
 
 case SIMCALL_COMM_ISEND:
-      simcall->result.dp = simcall_HANDLER_comm_isend(simcall , (smx_process_t) simcall->args[0].dp, (smx_mailbox_t) simcall->args[1].dp,  simcall->args[2].d,  simcall->args[3].d,  simcall->args[4].dp,  simcall->args[5].sz, (simix_match_func_t) simcall->args[6].fp, (simix_clean_func_t) simcall->args[7].fp, (simix_copy_data_func_t) simcall->args[8].fp,  simcall->args[9].dp,  simcall->args[10].i);
+      simgrid::simix::marshal<smx_synchro_t>(simcall->result, simcall_HANDLER_comm_isend(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]), simgrid::simix::unmarshal<double>(simcall->args[3]), simgrid::simix::unmarshal<void*>(simcall->args[4]), simgrid::simix::unmarshal<size_t>(simcall->args[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]), simgrid::simix::unmarshal<simix_clean_func_t>(simcall->args[7]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[8]), simgrid::simix::unmarshal<void*>(simcall->args[9]), simgrid::simix::unmarshal<int>(simcall->args[10])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_COMM_RECV:
-       simcall_HANDLER_comm_recv(simcall , (smx_process_t) simcall->args[0].dp, (smx_mailbox_t) simcall->args[1].dp,  simcall->args[2].dp, (size_t*) simcall->args[3].dp, (simix_match_func_t) simcall->args[4].fp, (simix_copy_data_func_t) simcall->args[5].fp,  simcall->args[6].dp,  simcall->args[7].d,  simcall->args[8].d);
+      simcall_HANDLER_comm_recv(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]), simgrid::simix::unmarshal<void*>(simcall->args[2]), simgrid::simix::unmarshal<size_t*>(simcall->args[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[5]), simgrid::simix::unmarshal<void*>(simcall->args[6]), simgrid::simix::unmarshal<double>(simcall->args[7]), simgrid::simix::unmarshal<double>(simcall->args[8]));
        break;  
 
 case SIMCALL_COMM_IRECV:
-      simcall->result.dp = simcall_HANDLER_comm_irecv(simcall , (smx_process_t) simcall->args[0].dp, (smx_mailbox_t) simcall->args[1].dp,  simcall->args[2].dp, (size_t*) simcall->args[3].dp, (simix_match_func_t) simcall->args[4].fp, (simix_copy_data_func_t) simcall->args[5].fp,  simcall->args[6].dp,  simcall->args[7].d);
+      simgrid::simix::marshal<smx_synchro_t>(simcall->result, simcall_HANDLER_comm_irecv(simcall, simgrid::simix::unmarshal<smx_process_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]), simgrid::simix::unmarshal<void*>(simcall->args[2]), simgrid::simix::unmarshal<size_t*>(simcall->args[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[5]), simgrid::simix::unmarshal<void*>(simcall->args[6]), simgrid::simix::unmarshal<double>(simcall->args[7])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_COMM_WAITANY:
-       simcall_HANDLER_comm_waitany(simcall , (xbt_dynar_t) simcall->args[0].dp);
+      simcall_HANDLER_comm_waitany(simcall, simgrid::simix::unmarshal<xbt_dynar_t>(simcall->args[0]));
        break;  
 
 case SIMCALL_COMM_WAIT:
-       simcall_HANDLER_comm_wait(simcall , (smx_synchro_t) simcall->args[0].dp,  simcall->args[1].d);
+      simcall_HANDLER_comm_wait(simcall, simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
        break;  
 
 case SIMCALL_COMM_TEST:
-       simcall_HANDLER_comm_test(simcall , (smx_synchro_t) simcall->args[0].dp);
+      simcall_HANDLER_comm_test(simcall, simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]));
        break;  
 
 case SIMCALL_COMM_TESTANY:
-       simcall_HANDLER_comm_testany(simcall , (xbt_dynar_t) simcall->args[0].dp);
+      simcall_HANDLER_comm_testany(simcall, simgrid::simix::unmarshal<xbt_dynar_t>(simcall->args[0]));
        break;  
 
 case SIMCALL_MUTEX_INIT:
-      simcall->result.dp = simcall_HANDLER_mutex_init(simcall );
+      simgrid::simix::marshal<smx_mutex_t>(simcall->result, simcall_HANDLER_mutex_init(simcall));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_MUTEX_LOCK:
-       simcall_HANDLER_mutex_lock(simcall , (smx_mutex_t) simcall->args[0].dp);
+      simcall_HANDLER_mutex_lock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
        break;  
 
 case SIMCALL_MUTEX_TRYLOCK:
-      simcall->result.i = simcall_HANDLER_mutex_trylock(simcall , (smx_mutex_t) simcall->args[0].dp);
+      simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_mutex_trylock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_MUTEX_UNLOCK:
-       simcall_HANDLER_mutex_unlock(simcall , (smx_mutex_t) simcall->args[0].dp);
+      simcall_HANDLER_mutex_unlock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_COND_INIT:
-      simcall->result.dp = SIMIX_cond_init();
+      simgrid::simix::marshal<smx_cond_t>(simcall->result, SIMIX_cond_init());
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_COND_SIGNAL:
-       SIMIX_cond_signal((smx_cond_t) simcall->args[0].dp);
+      SIMIX_cond_signal(simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_COND_WAIT:
-       simcall_HANDLER_cond_wait(simcall , (smx_cond_t) simcall->args[0].dp, (smx_mutex_t) simcall->args[1].dp);
+      simcall_HANDLER_cond_wait(simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[1]));
        break;  
 
 case SIMCALL_COND_WAIT_TIMEOUT:
-       simcall_HANDLER_cond_wait_timeout(simcall , (smx_cond_t) simcall->args[0].dp, (smx_mutex_t) simcall->args[1].dp,  simcall->args[2].d);
+      simcall_HANDLER_cond_wait_timeout(simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]));
        break;  
 
 case SIMCALL_COND_BROADCAST:
-       SIMIX_cond_broadcast((smx_cond_t) simcall->args[0].dp);
+      SIMIX_cond_broadcast(simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_SEM_INIT:
-      simcall->result.dp = SIMIX_sem_init( simcall->args[0].ui);
+      simgrid::simix::marshal<smx_sem_t>(simcall->result, SIMIX_sem_init(simgrid::simix::unmarshal<unsigned int>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_SEM_RELEASE:
-       simcall_HANDLER_sem_release(simcall , (smx_sem_t) simcall->args[0].dp);
+      simcall_HANDLER_sem_release(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_SEM_WOULD_BLOCK:
-      simcall->result.i = simcall_HANDLER_sem_would_block(simcall , (smx_sem_t) simcall->args[0].dp);
+      simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_sem_would_block(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_SEM_ACQUIRE:
-       simcall_HANDLER_sem_acquire(simcall , (smx_sem_t) simcall->args[0].dp);
+      simcall_HANDLER_sem_acquire(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]));
        break;  
 
 case SIMCALL_SEM_ACQUIRE_TIMEOUT:
-       simcall_HANDLER_sem_acquire_timeout(simcall , (smx_sem_t) simcall->args[0].dp,  simcall->args[1].d);
+      simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
        break;  
 
 case SIMCALL_SEM_GET_CAPACITY:
-      simcall->result.i = simcall_HANDLER_sem_get_capacity(simcall , (smx_sem_t) simcall->args[0].dp);
+      simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_sem_get_capacity(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_FILE_READ:
-       simcall_HANDLER_file_read(simcall , (smx_file_t) simcall->args[0].dp,  simcall->args[1].sgsz, (sg_host_t) simcall->args[2].dp);
+      simcall_HANDLER_file_read(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
        break;  
 
 case SIMCALL_FILE_WRITE:
-       simcall_HANDLER_file_write(simcall , (smx_file_t) simcall->args[0].dp,  simcall->args[1].sgsz, (sg_host_t) simcall->args[2].dp);
+      simcall_HANDLER_file_write(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[2]));
        break;  
 
 case SIMCALL_FILE_OPEN:
-       simcall_HANDLER_file_open(simcall ,  simcall->args[0].cc, (sg_host_t) simcall->args[1].dp);
+      simcall_HANDLER_file_open(simcall, simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]));
        break;  
 
 case SIMCALL_FILE_CLOSE:
-       simcall_HANDLER_file_close(simcall , (smx_file_t) simcall->args[0].dp, (sg_host_t) simcall->args[1].dp);
+      simcall_HANDLER_file_close(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[1]));
        break;  
 
 case SIMCALL_FILE_UNLINK:
-      simcall->result.i = SIMIX_file_unlink((smx_file_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp);
+      simgrid::simix::marshal<int>(simcall->result, SIMIX_file_unlink(simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[1])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_FILE_GET_SIZE:
-      simcall->result.sgsz = simcall_HANDLER_file_get_size(simcall , (smx_file_t) simcall->args[0].dp);
+      simgrid::simix::marshal<sg_size_t>(simcall->result, simcall_HANDLER_file_get_size(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_FILE_TELL:
-      simcall->result.sgsz = simcall_HANDLER_file_tell(simcall , (smx_file_t) simcall->args[0].dp);
+      simgrid::simix::marshal<sg_size_t>(simcall->result, simcall_HANDLER_file_tell(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_FILE_SEEK:
-      simcall->result.i = simcall_HANDLER_file_seek(simcall , (smx_file_t) simcall->args[0].dp,  simcall->args[1].sgoff,  simcall->args[2].i);
+      simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_file_seek(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_offset_t>(simcall->args[1]), simgrid::simix::unmarshal<int>(simcall->args[2])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_FILE_GET_INFO:
-      simcall->result.dp = simcall_HANDLER_file_get_info(simcall , (smx_file_t) simcall->args[0].dp);
+      simgrid::simix::marshal<xbt_dynar_t>(simcall->result, simcall_HANDLER_file_get_info(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_FILE_MOVE:
-      simcall->result.i = simcall_HANDLER_file_move(simcall , (smx_file_t) simcall->args[0].dp,  simcall->args[1].cc);
+      simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_file_move(simcall, simgrid::simix::unmarshal<smx_file_t>(simcall->args[0]), simgrid::simix::unmarshal<const char*>(simcall->args[1])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_STORAGE_GET_FREE_SIZE:
-      simcall->result.sgsz = simcall_HANDLER_storage_get_free_size(simcall , (smx_storage_t) simcall->args[0].dp);
+      simgrid::simix::marshal<sg_size_t>(simcall->result, simcall_HANDLER_storage_get_free_size(simcall, simgrid::simix::unmarshal<smx_storage_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_STORAGE_GET_USED_SIZE:
-      simcall->result.sgsz = simcall_HANDLER_storage_get_used_size(simcall , (smx_storage_t) simcall->args[0].dp);
+      simgrid::simix::marshal<sg_size_t>(simcall->result, simcall_HANDLER_storage_get_used_size(simcall, simgrid::simix::unmarshal<smx_storage_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_STORAGE_GET_PROPERTIES:
-      simcall->result.dp = SIMIX_storage_get_properties((smx_storage_t) simcall->args[0].dp);
+      simgrid::simix::marshal<xbt_dict_t>(simcall->result, SIMIX_storage_get_properties(simgrid::simix::unmarshal<smx_storage_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_STORAGE_GET_CONTENT:
-      simcall->result.dp = SIMIX_storage_get_content((smx_storage_t) simcall->args[0].dp);
+      simgrid::simix::marshal<xbt_dict_t>(simcall->result, SIMIX_storage_get_content(simgrid::simix::unmarshal<smx_storage_t>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_ASR_GET_PROPERTIES:
-      simcall->result.dp = simcall_HANDLER_asr_get_properties(simcall ,  simcall->args[0].cc);
+      simgrid::simix::marshal<xbt_dict_t>(simcall->result, simcall_HANDLER_asr_get_properties(simcall, simgrid::simix::unmarshal<const char*>(simcall->args[0])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_MC_RANDOM:
-      simcall->result.i = simcall_HANDLER_mc_random(simcall ,  simcall->args[0].i,  simcall->args[1].i);
+      simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_mc_random(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1])));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_SET_CATEGORY:
-       SIMIX_set_category((smx_synchro_t) simcall->args[0].dp, simcall->args[1].cc);
+      SIMIX_set_category(simgrid::simix::unmarshal<smx_synchro_t>(simcall->args[0]), simgrid::simix::unmarshal<const char*>(simcall->args[1]));
       SIMIX_simcall_answer(simcall);
       break;  
 
 case SIMCALL_RUN_KERNEL:
-       SIMIX_run_kernel( simcall->args[0].dp);
+      SIMIX_run_kernel(simgrid::simix::unmarshal<void*>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
       break;  
     case NUM_SIMCALLS:
index 71bd4ed..3415362 100644 (file)
@@ -25,22 +25,18 @@ typedef void (*FPtr)(void); // Hide the ugliness
 /* Pack all possible scalar types in an union */
 union u_smx_scalar {
   char            c;
-  const char*     cc;
   short           s;
   int             i;
   long            l;
+  long long       ll;
   unsigned char   uc;
   unsigned short  us;
   unsigned int    ui;
   unsigned long   ul;
-  float           f;
+  unsigned long long ull;
   double          d;
-  size_t          sz;
-  sg_size_t       sgsz;
-  sg_offset_t     sgoff;
   void*           dp;
   FPtr            fp;
-  const void*     cp;
 };
 
 /**
@@ -57,8 +53,6 @@ typedef struct s_smx_simcall {
 #define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value))
 #define SIMCALL_GET_MC_VALUE(simcall) ((simcall)->mc_value)
 
-#include "popping_accessors.h"
-
 /******************************** General *************************************/
 
 XBT_PRIVATE void SIMIX_simcall_answer(smx_simcall_t);
@@ -74,18 +68,26 @@ SG_END_DECL()
 namespace simgrid {
 namespace simix {
 
+template<class T>
+class type {
+  constexpr bool operator==(type) const    { return true; }
+  template<class U>
+  constexpr bool operator==(type<U>) const { return false; }
+  constexpr bool operator!=(type) const    { return false; }
+  template<class U>
+  constexpr bool operator!=(type<U>) const { return true; }
+};
+
 template<typename T> struct marshal_t {};
 #define SIMIX_MARSHAL(T, field) \
-  template<> struct marshal_t<T> { \
-    static void marshal(u_smx_scalar& simcall, T value) \
-    { \
-      simcall.field = value; \
-    } \
-    static T unmarshal(u_smx_scalar const& simcall) \
-    { \
-      return simcall.field; \
-    } \
-  };
+  inline void marshal(type<T>, u_smx_scalar& simcall, T value) \
+  { \
+    simcall.field = value; \
+  } \
+  inline T unmarshal(type<T>, u_smx_scalar const& simcall) \
+  { \
+    return simcall.field; \
+  }
 
 SIMIX_MARSHAL(char, c);
 SIMIX_MARSHAL(short, s);
@@ -95,150 +97,72 @@ SIMIX_MARSHAL(unsigned char, uc);
 SIMIX_MARSHAL(unsigned short, us);
 SIMIX_MARSHAL(unsigned int, ui);
 SIMIX_MARSHAL(unsigned long, ul);
-SIMIX_MARSHAL(float, f);
+SIMIX_MARSHAL(unsigned long long, ull);
+SIMIX_MARSHAL(long long, ll);
+SIMIX_MARSHAL(float, d);
 SIMIX_MARSHAL(double, d);
 SIMIX_MARSHAL(FPtr, fp);
 
-template<typename T> struct marshal_t<T*> {
-  static void marshal(u_smx_scalar& simcall, T* value)
-  {
-    simcall.dp = value;
-  }
-  static T* unmarshal(u_smx_scalar const& simcall)
-  {
-    return simcall.dp;
-  }
-};
-
-template<> struct marshal_t<void> {
-  static void unmarshal(u_smx_scalar const& simcall) {}
-};
+inline
+void unmarshal(type<void>, u_smx_scalar const& simcall) {}
 
 template<class T> inline
-void marshal(u_smx_scalar& simcall, T const& value)
+void marshal(type<T*>, u_smx_scalar& simcall, T* value)
 {
-  marshal_t<T>::marshal(simcall, value);
+  simcall.dp = (void*) value;
 }
-
 template<class T> inline
-T unmarshal(u_smx_scalar const& simcall)
-{
-  return marshal_t<T>::unmarshal(simcall);
-}
-
-template<class A> inline
-void marshal(smx_simcall_t simcall, e_smx_simcall_t call, A&& a)
+T* unmarshal(type<T*>, u_smx_scalar const& simcall)
 {
-  simcall->call = call;
-  memset(&simcall->result, 0, sizeof(simcall->result));
-  marshal(simcall->args[0], std::forward<A>(a));
+  return static_cast<T*>(simcall.dp);
 }
 
-template<class A, class B> inline
-void marshal(smx_simcall_t simcall, e_smx_simcall_t call, A&& a, B&& b)
+template<class R, class... T> inline
+void marshal(type<R(*)(T...)>, u_smx_scalar& simcall, R(*value)(T...))
 {
-  simcall->call = call;
-  memset(&simcall->result, 0, sizeof(simcall->result));
-  marshal(simcall->args[0], std::forward<A>(a));
-  marshal(simcall->args[1], std::forward<B>(b));
+  simcall.fp = (FPtr) value;
 }
-
-template<class A, class B, class C> inline
-void marshal(smx_simcall_t simcall, e_smx_simcall_t call, A&& a, B&& b, C&& c)
+template<class R, class... T> inline
+auto unmarshal(type<R(*)(T...)>, u_smx_scalar simcall) -> R(*)(T...)
 {
-  simcall->call = call;
-  memset(&simcall->result, 0, sizeof(simcall->result));
-  marshal(simcall->args[0], std::forward<A>(a));
-  marshal(simcall->args[1], std::forward<B>(b));
-  marshal(simcall->args[2], std::forward<C>(c));
+  return (R(*)(T...)) simcall.fp;
 }
 
-template<class A, class B, class C, class D> inline
-void marshal(smx_simcall_t simcall, e_smx_simcall_t call, A&& a, B&& b, C&& c, D&& d)
+template<class T> inline
+void marshal(u_smx_scalar& simcall, T const& value)
 {
-  simcall->call = call;
-  memset(&simcall->result, 0, sizeof(simcall->result));
-  marshal(simcall->args[0], std::forward<A>(a));
-  marshal(simcall->args[1], std::forward<B>(b));
-  marshal(simcall->args[2], std::forward<C>(c));
-  marshal(simcall->args[3], std::forward<D>(d));
+  return marshal(type<T>(), simcall, value);
 }
-
-template<class A, class B, class C, class D, class E> inline
-void marshal(smx_simcall_t simcall, e_smx_simcall_t call, A&& a, B&& b, C&& c, D&& d, E&& e)
+template<class T> inline
+typename std::remove_reference<T>::type unmarshal(u_smx_scalar& simcall)
 {
-  simcall->call = call;
-  memset(&simcall->result, 0, sizeof(simcall->result));
-  marshal(simcall->args[0], std::forward<A>(a));
-  marshal(simcall->args[1], std::forward<B>(b));
-  marshal(simcall->args[2], std::forward<C>(c));
-  marshal(simcall->args[3], std::forward<D>(d));
-  marshal(simcall->args[4], std::forward<E>(e));
+  return unmarshal(type<T>(), simcall);
 }
 
-template<class A, class B, class C, class D, class E, class F> inline
-void marshal(smx_simcall_t simcall, e_smx_simcall_t call,
-  A&& a, B&& b, C&& c, D&& d, E&& e, F&& f)
-{
-  simcall->call = call;
-  memset(&simcall->result, 0, sizeof(simcall->result));
-  marshal(simcall->args[0], std::forward<A>(a));
-  marshal(simcall->args[1], std::forward<B>(b));
-  marshal(simcall->args[2], std::forward<C>(c));
-  marshal(simcall->args[3], std::forward<D>(d));
-  marshal(simcall->args[4], std::forward<E>(e));
-  marshal(simcall->args[5], std::forward<F>(f));
-}
+template<std::size_t I>
+inline void marshalArgs(smx_simcall_t simcall) {}
 
-template<class A, class B, class C, class D, class E, class F, class G> inline
-void marshal(smx_simcall_t simcall, e_smx_simcall_t call,
-  A&& a, B&& b, C&& c, D&& d, E&& e, F&& f, G&& g)
+template<std::size_t I, class A>
+inline void marshalArgs(smx_simcall_t simcall, A const& a)
 {
-  simcall->call = call;
-  memset(&simcall->result, 0, sizeof(simcall->result));
-  marshal(simcall->args[0], std::forward<A>(a));
-  marshal(simcall->args[1], std::forward<B>(b));
-  marshal(simcall->args[2], std::forward<C>(c));
-  marshal(simcall->args[3], std::forward<D>(d));
-  marshal(simcall->args[4], std::forward<E>(e));
-  marshal(simcall->args[5], std::forward<F>(f));
-  marshal(simcall->args[6], std::forward<G>(g));
+  marshal(simcall->args[I], a);
 }
 
-template<class A, class B, class C,
-          class D, class E, class F, class G, class H> inline
-void marshal(smx_simcall_t simcall, e_smx_simcall_t call,
-  A&& a, B&& b, C&& c, D&& d, E&& e, F&& f, G&& g, H&& h)
+template<std::size_t I, class A, class... B>
+inline void marshalArgs(smx_simcall_t simcall, A const& a, B const&... b)
 {
-  simcall->call = call;
-  memset(&simcall->result, 0, sizeof(simcall->result));
-  marshal(simcall->args[0], std::forward<A>(a));
-  marshal(simcall->args[1], std::forward<B>(b));
-  marshal(simcall->args[2], std::forward<C>(c));
-  marshal(simcall->args[3], std::forward<D>(d));
-  marshal(simcall->args[4], std::forward<E>(e));
-  marshal(simcall->args[5], std::forward<F>(f));
-  marshal(simcall->args[6], std::forward<G>(g));
-  marshal(simcall->args[7], std::forward<H>(h));
+  marshal(simcall->args[I], a);
+  marshalArgs<I+1>(simcall, b...);
 }
 
-template<class A, class B, class C,
-          class D, class E, class F,
-          class G, class H, class I> inline
-void marshal(smx_simcall_t simcall, e_smx_simcall_t call,
-  A&& a, B&& b, C&& c, D&& d, E&& e, F&& f, G&& g, H&& h, I&& i)
+/** Initialize the simcall */
+template<class... A> inline
+void marshal(smx_simcall_t simcall, e_smx_simcall_t call, A const&... a)
 {
   simcall->call = call;
   memset(&simcall->result, 0, sizeof(simcall->result));
-  marshal(simcall->args[0], std::forward<A>(a));
-  marshal(simcall->args[1], std::forward<B>(b));
-  marshal(simcall->args[2], std::forward<C>(c));
-  marshal(simcall->args[3], std::forward<D>(d));
-  marshal(simcall->args[4], std::forward<E>(e));
-  marshal(simcall->args[5], std::forward<F>(f));
-  marshal(simcall->args[6], std::forward<G>(g));
-  marshal(simcall->args[7], std::forward<H>(h));
-  marshal(simcall->args[8], std::forward<I>(i));
+  memset(simcall->args, 0, sizeof(simcall->args));
+  marshalArgs<0>(simcall, a...);
 }
 
 }
@@ -246,4 +170,6 @@ void marshal(smx_simcall_t simcall, e_smx_simcall_t call,
 
 #endif
 
+#include "popping_accessors.h"
+
 #endif
index 531cf70..c78d970 100755 (executable)
@@ -118,41 +118,40 @@ class Simcall(object):
             res.append('static inline %s simcall_%s__get__%s(smx_simcall_t simcall) {' % (
                 arg.rettype(), self.name, arg.name))
             res.append(
-                '  return %s simcall->args[%i].%s;' % (arg.cast(), i, arg.field()))
+                '  return simgrid::simix::unmarshal<%s>(simcall->args[%i]);' % (arg.rettype(), i))
             res.append('}')
             res.append('static inline void simcall_%s__set__%s(smx_simcall_t simcall, %s arg) {' % (
-                self.name, arg.name, arg.type))
-            res.append('    simcall->args[%i].%s = arg;' % (i, arg.field()))
+                self.name, arg.name, arg.rettype()))
+            res.append('    simgrid::simix::marshal<%s>(simcall->args[%i], arg);' % (arg.rettype(), i))
             res.append('}')
 
         # Return value getter/setters
         if self.res.type != 'void':
             res.append(
                 'static inline %s simcall_%s__get__result(smx_simcall_t simcall){' % (self.res.rettype(), self.name))
-            res.append('    return %s simcall->result.%s;' %
-                       (self.res.cast(), self.res.field()))
+            res.append('    return simgrid::simix::unmarshal<%s>(simcall->result);' % self.res.rettype())
             res.append('}')
             res.append(
-                'static inline void simcall_%s__set__result(smx_simcall_t simcall, %s result){' % (self.name, self.res.type,))
-            res.append('    simcall->result.%s = result;' % (self.res.field()))
+                'static inline void simcall_%s__set__result(smx_simcall_t simcall, %s result){' % (self.name, self.res.rettype()))
+            res.append('    simgrid::simix::marshal<%s>(simcall->result, result);' % (self.res.rettype()))
             res.append('}')
         return '\n'.join(res)
 
     def case(self):
         res = []
+        args = [ ("simgrid::simix::unmarshal<%s>(simcall->args[%d])" % (arg.rettype(), i))
+            for i, arg in enumerate(self.args) ]
         res.append('case SIMCALL_%s:' % (self.name.upper()))
         if self.need_handler:
-            res.append(
-                '      %ssimcall_HANDLER_%s(simcall %s);' % ('simcall->result.%s = ' % self.res.field() if self.call_kind == 'Func' else ' ',
-                                                             self.name,
-                                                             ''.join(', %s simcall->args[%d].%s' % (arg.cast(), i, arg.field())
-                                                                     for i, arg in enumerate(self.args))))
+            call = "simcall_HANDLER_%s(simcall%s%s)" % (self.name,
+                ", " if len(args) > 0 else "",
+                ', '.join(args))
         else:
-            res.append(
-                '      %sSIMIX_%s(%s);' % ('simcall->result.%s = ' % self.res.field() if self.call_kind == 'Func' else ' ',
-                                           self.name,
-                                           ','.join('%s simcall->args[%d].%s' % (arg.cast(), i, arg.field())
-                                                    for i, arg in enumerate(self.args))))
+            call = "SIMIX_%s(%s)" % (self.name, ', '.join(args))
+        if self.call_kind == 'Func':
+            res.append("      simgrid::simix::marshal<%s>(simcall->result, %s);" % (self.res.rettype(), call))
+        else:
+            res.append("      " + call + ";");
         res.append('      %sbreak;  \n' %
                    ('SIMIX_simcall_answer(simcall);\n      ' if self.call_kind != 'Blck' else ' '))
         return '\n'.join(res)
@@ -163,41 +162,20 @@ class Simcall(object):
             'inline static %s simcall_BODY_%s(%s) {' % (self.res.rettype(),
                                                         self.name,
                                                         ', '.join('%s %s' % (arg.rettype(), arg.name) for arg in self.args)))
-        res.append('    smx_process_t self = SIMIX_process_self();')
-        res.append('')
         res.append(
             '    /* Go to that function to follow the code flow through the simcall barrier */')
         if self.need_handler:
             res.append('    if (0) simcall_HANDLER_%s(%s);' % (self.name,
-                                                               ', '.join(["&self->simcall"] + [arg.name for arg in self.args])))
+                                                               ', '.join(["&SIMIX_process_self()->simcall"] + [arg.name for arg in self.args])))
         else:
             res.append('    if (0) SIMIX_%s(%s);' % (self.name,
                                                      ', '.join(arg.name for arg in self.args)))
-        res.append(
-            '    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */')
-        res.append('')
-        res.append('    self->simcall.call = SIMCALL_%s;' %
-                   (self.name.upper()))
-        res.append(
-            '    memset(&self->simcall.result, 0, sizeof(self->simcall.result));')
-        res.append(
-            '    memset(self->simcall.args, 0, sizeof(self->simcall.args));')
-        res.append('\n'.join('    self->simcall.args[%d].%s = (%s) %s;' % (i, arg.field(), arg.type, arg.name)
-                             for i, arg in enumerate(self.args)))
-        res.append('    if (self != simix_global->maestro_process) {')
-        res.append(
-            '      XBT_DEBUG("Yield process \'%s\' on simcall %s (%d)", self->name.c_str(),')
-        res.append(
-            '                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);')
-        res.append('      SIMIX_process_yield(self);')
-        res.append('    } else {')
-        res.append('      SIMIX_simcall_handle(&self->simcall, 0);')
-        res.append('    }    ')
-        if self.res.type != 'void':
-            res.append('    return (%s) self->simcall.result.%s;' %
-                       (self.res.rettype(), self.res.field()))
-        else:
-            res.append('    ')
+        res.append('    return simcall<%s%s>(SIMCALL_%s%s);' % (
+            self.res.rettype(),
+            "".join([ ", " + arg.rettype() for i, arg in enumerate(self.args) ]),
+            self.name.upper(),
+            "".join([ ", " + arg.name for i, arg in enumerate(self.args) ])
+            ));
         res.append('  }')
         return '\n'.join(res)
 
@@ -296,6 +274,7 @@ if __name__ == '__main__':
     # smx_popping_accessors.c
     #
     fd = header('popping_accessors.h')
+    fd.write('#include "src/simix/popping_private.h"');
     handle(fd, Simcall.accessors, simcalls, simcalls_dict)
     fd.write(
         "\n\n/* The prototype of all simcall handlers, automatically generated for you */\n\n")
@@ -384,6 +363,22 @@ if __name__ == '__main__':
     fd.write('#include "xbt/ex.h"\n')
     fd.write('#include <simgrid/simix.hpp>\n')
     fd.write("/** @cond */ // Please Doxygen, don't look at this\n")
+    fd.write('''
+template<class R, class... T>
+inline static R simcall(e_smx_simcall_t call, T const&... t)
+{
+  smx_process_t self = SIMIX_process_self();
+  simgrid::simix::marshal(&self->simcall, call, t...);
+  if (self != simix_global->maestro_process) {
+    XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(),
+              SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
+    SIMIX_process_yield(self);
+  } else {
+    SIMIX_simcall_handle(&self->simcall, 0);
+  }
+  return simgrid::simix::unmarshal<R>(self->simcall.result);
+}
+''')
     handle(fd, Simcall.body, simcalls, simcalls_dict)
     fd.write("/** @endcond */\n");
     fd.close()