Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 26 May 2016 20:41:02 +0000 (22:41 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 26 May 2016 20:41:02 +0000 (22:41 +0200)
23 files changed:
include/simgrid/simix.hpp
include/smpi/mpi.h
include/xbt/functional.hpp [new file with mode: 0644]
include/xbt/future.hpp [new file with mode: 0644]
src/instr/instr_paje_header.cpp
src/instr/instr_smpi.h
src/instr/instr_trace.cpp
src/mc/mc_base.h
src/mc/mc_state.cpp
src/msg/msg_process.cpp
src/simix/libsmx.cpp
src/simix/popping.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_generated.cpp
src/simix/popping_private.h
src/simix/simcalls.in
src/simix/simcalls.py
src/smpi/instr_smpi.cpp
src/smpi/private.hpp
src/smpi/smpi_bench.cpp
src/surf/sg_platf.cpp
tools/cmake/DefinePackages.cmake

index bb75c8a..ad30d41 100644 (file)
@@ -18,6 +18,8 @@
 #include <type_traits>
 
 #include <xbt/function_types.h>
+#include <xbt/future.hpp>
+
 #include <simgrid/simix.h>
 
 XBT_PUBLIC(void) simcall_run_kernel(std::function<void()> const& code);
@@ -25,35 +27,6 @@ XBT_PUBLIC(void) simcall_run_kernel(std::function<void()> const& code);
 namespace simgrid {
 namespace simix {
 
-/** Fulfill a promise by executing a given code */
-template<class R, class F>
-void fulfill_promise(std::promise<R>& promise, F&& code)
-{
-  try {
-    promise.set_value(std::forward<F>(code)());
-  }
-  catch(...) {
-    promise.set_exception(std::current_exception());
-  }
-}
-
-/** Fulfill a promise by executing a given code
- *
- *  This is a special version for `std::promise<void>` because the default
- *  version does not compile in this case.
- */
-template<class F>
-void fulfill_promise(std::promise<void>& promise, F&& code)
-{
-  try {
-    std::forward<F>(code)();
-    promise.set_value();
-  }
-  catch(...) {
-    promise.set_exception(std::current_exception());
-  }
-}
-
 /** Execute some code in the kernel/maestro
  *
  *  This can be used to enforce mutual exclusion with other simcall.
@@ -75,114 +48,11 @@ typename std::result_of<F()>::type kernel(F&& code)
   std::promise<R> promise;
   simcall_run_kernel([&]{
     xbt_assert(SIMIX_is_maestro(), "Not in maestro");
-    fulfill_promise(promise, std::forward<F>(code));
+    simgrid::xbt::fulfillPromise(promise, std::forward<F>(code));
   });
   return promise.get_future().get();
 }
 
-class args {
-private:
-  int argc_ = 0;
-  char** argv_ = nullptr;
-public:
-
-  // Main constructors
-  args() {}
-
-  void assign(int argc, const char*const* argv)
-  {
-    clear();
-    char** new_argv = xbt_new(char*,argc + 1);
-    for (int i = 0; i < argc; i++)
-      new_argv[i] = xbt_strdup(argv[i]);
-    new_argv[argc] = nullptr;
-    this->argc_ = argc;
-    this->argv_ = new_argv;
-  }
-  args(int argc, const char*const* argv)
-  {
-    this->assign(argc, argv);
-  }
-
-  char** to_argv() const
-  {
-    const int argc = argc_;
-    char** argv = xbt_new(char*, argc + 1);
-    for (int i=0; i< argc; i++)
-      argv[i] = xbt_strdup(argv_[i]);
-    argv[argc] = nullptr;
-    return argv;
-  }
-
-  // Free
-  void clear()
-  {
-    for (int i = 0; i < this->argc_; i++)
-      free(this->argv_[i]);
-    free(this->argv_);
-    this->argc_ = 0;
-    this->argv_ = nullptr;
-  }
-  ~args() { clear(); }
-
-  // Copy
-  args(args const& that)
-  {
-    this->assign(that.argc(), that.argv());
-  }
-  args& operator=(args const& that)
-  {
-    this->assign(that.argc(), that.argv());
-    return *this;
-  }
-
-  // Move:
-  args(args&& that) : argc_(that.argc_), argv_(that.argv_)
-  {
-    that.argc_ = 0;
-    that.argv_ = nullptr;
-  }
-  args& operator=(args&& that)
-  {
-    this->argc_ = that.argc_;
-    this->argv_ = that.argv_;
-    that.argc_ = 0;
-    that.argv_ = nullptr;
-    return *this;
-  }
-
-  int    argc()            const { return argc_; }
-  char** argv()                  { return argv_; }
-  const char*const* argv() const { return argv_; }
-  char* operator[](std::size_t i) { return argv_[i]; }
-};
-
-inline std::function<void()> wrap_main(
-  xbt_main_func_t code,  std::shared_ptr<simgrid::simix::args> args)
-{
-  if (code) {
-    return [=]() {
-      code(args->argc(), args->argv());
-    };
-  }
-  else return std::function<void()>();
-}
-
-inline
-std::function<void()> wrap_main(xbt_main_func_t code, simgrid::simix::args args)
-{
-  if (code)
-    return wrap_main(code, std::unique_ptr<simgrid::simix::args>(
-      new simgrid::simix::args(std::move(args))));
-  else return std::function<void()>();
-}
-
-inline
-std::function<void()> wrap_main(xbt_main_func_t code, int argc, const char*const* argv)
-{
-  return wrap_main(code, simgrid::simix::args(argc, argv));
-}
-
 class Context;
 class ContextFactory;
 
index a5474a6..5ddbfa3 100644 (file)
@@ -26,8 +26,7 @@
 #endif
 
 #if TRACE_CALL_LOCATION
-#include "src/instr/instr_smpi.h"
-#include "smpi_extended_traces.h"
+#include <smpi/smpi_extended_traces.h>
 #endif
 
 #endif
diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp
new file mode 100644 (file)
index 0000000..31f9430
--- /dev/null
@@ -0,0 +1,123 @@
+/* Copyright (c) 2015-2016. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef XBT_FUNCTIONAL_HPP
+#define XBT_FUNCTIONAL_HPP
+
+#include <cstdlib>
+
+#include <exception>
+#include <functional>
+#include <future>
+#include <utility>
+
+#include <xbt/sysdep.h>
+
+namespace simgrid {
+namespace xbt {
+
+class args {
+private:
+  int argc_ = 0;
+  char** argv_ = nullptr;
+public:
+
+  // Main constructors
+  args() {}
+
+  void assign(int argc, const char*const* argv)
+  {
+    clear();
+    char** new_argv = xbt_new(char*,argc + 1);
+    for (int i = 0; i < argc; i++)
+      new_argv[i] = xbt_strdup(argv[i]);
+    new_argv[argc] = nullptr;
+    this->argc_ = argc;
+    this->argv_ = new_argv;
+  }
+  args(int argc, const char*const* argv)
+  {
+    this->assign(argc, argv);
+  }
+
+  char** to_argv() const
+  {
+    const int argc = argc_;
+    char** argv = xbt_new(char*, argc + 1);
+    for (int i=0; i< argc; i++)
+      argv[i] = xbt_strdup(argv_[i]);
+    argv[argc] = nullptr;
+    return argv;
+  }
+
+  // Free
+  void clear()
+  {
+    for (int i = 0; i < this->argc_; i++)
+      std::free(this->argv_[i]);
+    std::free(this->argv_);
+    this->argc_ = 0;
+    this->argv_ = nullptr;
+  }
+  ~args() { clear(); }
+
+  // Copy
+  args(args const& that)
+  {
+    this->assign(that.argc(), that.argv());
+  }
+  args& operator=(args const& that)
+  {
+    this->assign(that.argc(), that.argv());
+    return *this;
+  }
+
+  // Move:
+  args(args&& that) : argc_(that.argc_), argv_(that.argv_)
+  {
+    that.argc_ = 0;
+    that.argv_ = nullptr;
+  }
+  args& operator=(args&& that)
+  {
+    this->argc_ = that.argc_;
+    this->argv_ = that.argv_;
+    that.argc_ = 0;
+    that.argv_ = nullptr;
+    return *this;
+  }
+
+  int    argc()            const { return argc_; }
+  char** argv()                  { return argv_; }
+  const char*const* argv() const { return argv_; }
+  char* operator[](std::size_t i) { return argv_[i]; }
+};
+
+template<class F> inline
+std::function<void()> wrapMain(F code, std::shared_ptr<simgrid::xbt::args> args)
+{
+  return [=]() {
+    code(args->argc(), args->argv());
+  };
+}
+
+template<class F> inline
+std::function<void()> wrapMain(F code, simgrid::xbt::args args)
+{
+  return wrapMain(std::move(code),
+    std::unique_ptr<simgrid::xbt::args>(new simgrid::xbt::args(std::move(args))));
+}
+
+template<class F> inline
+std::function<void()> wrapMain(F code, int argc, const char*const* argv)
+{
+  return wrapMain(std::move(code), args(argc, argv));
+}
+
+}
+}
+
+#endif
diff --git a/include/xbt/future.hpp b/include/xbt/future.hpp
new file mode 100644 (file)
index 0000000..d5a31a5
--- /dev/null
@@ -0,0 +1,49 @@
+/* Copyright (c) 2015-2016. The SimGrid Team.
+ * All rights reserved.                                                     */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef XBT_FUTURE_HPP
+#define XBT_FUTURE_HPP
+
+#include <future>
+#include <utility>
+#include <exception>
+
+namespace simgrid {
+namespace xbt {
+
+/** Fulfill a promise by executing a given code */
+template<class R, class F>
+void fulfillPromise(std::promise<R>& promise, F code)
+{
+  try {
+    promise.set_value(code());
+  }
+  catch(...) {
+    promise.set_exception(std::current_exception());
+  }
+}
+
+/** Fulfill a promise by executing a given code
+ *
+ *  This is a special version for `std::promise<void>` because the default
+ *  version does not compile in this case.
+ */
+template<class F>
+void fulfillPromise(std::promise<void>& promise, F code)
+{
+  try {
+    (code)();
+    promise.set_value();
+  }
+  catch(...) {
+    promise.set_exception(std::current_exception());
+  }
+}
+
+}
+}
+
+#endif
index f135044..6994075 100644 (file)
@@ -165,8 +165,12 @@ static void TRACE_header_PajePushState (int basic, int size)
   fprintf(tracing_file, "%%       Value string\n");
   if (size) fprintf(tracing_file, "%%       Size int\n");
   if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
-    fprintf(tracing_file, "%%       Filename string\n");
-    fprintf(tracing_file, "%%       Linenumber int\n");
+    /**
+     * paje currently (May 2016) uses "Filename" and "Linenumber" as
+     * reserved words. We cannot use them...
+     */
+    fprintf(tracing_file, "%%       Fname string\n");
+    fprintf(tracing_file, "%%       Lnumber int\n");
   }
   fprintf(tracing_file, "%%EndEventDef\n");
 }
index d80aed2..e371fd6 100644 (file)
@@ -20,8 +20,6 @@ typedef struct smpi_trace_call_location {
 
 } smpi_trace_call_location_t;
 
-smpi_trace_call_location_t* smpi_trace_get_call_location();
-
 #ifdef __cplusplus
 }
 #endif
index cfa70ee..850f75e 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "src/instr/instr_private.h"
 #include "src/instr/instr_smpi.h"
+#include "src/smpi/private.hpp"
 #include "xbt/virtu.h" /* sg_cmdline */
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_trace, instr, "tracing event system");
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 41a5263..3ce8d32 100644 (file)
@@ -9,6 +9,7 @@
 #include "msg_private.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
+#include "xbt/functional.hpp"
 #include "src/simix/smx_process_private.h"
 #include "src/simix/smx_private.h"
 
@@ -132,7 +133,8 @@ msg_process_t MSG_process_create_with_environment(const char *name, xbt_main_fun
                                                   int argc, char **argv, xbt_dict_t properties)
 {
   msg_process_t res = MSG_process_create_with_environment(name,
-    simgrid::simix::wrap_main(code, argc, argv), data, host,
+    code ? simgrid::xbt::wrapMain(code, argc, argv) : std::function<void()>(),
+    data, host,
     properties);
   for (int i = 0; i != argc; ++i)
     xbt_free(argv[i]);
index 115a0e8..794909f 100644 (file)
@@ -15,6 +15,8 @@
 
 #include <functional>
 
+#include <xbt/functional.hpp>
+
 #include "src/mc/mc_replay.h"
 #include "smx_private.h"
 #include "src/mc/mc_forward.hpp"
@@ -377,7 +379,7 @@ smx_process_t simcall_process_create(const char *name,
 {
   if (name == nullptr)
     name = "";
-  auto wrapped_code = simgrid::simix::wrap_main(code, argc, argv);
+  auto wrapped_code = simgrid::xbt::wrapMain(code, argc, argv);
   for (int i = 0; i != argc; ++i)
     xbt_free(argv[i]);
   xbt_free(argv);
@@ -1126,7 +1128,7 @@ xbt_dict_t simcall_storage_get_content(smx_storage_t storage)
 
 void simcall_run_kernel(std::function<void()> const& code)
 {
-  return simcall_BODY_run_kernel((void*) &code);
+  return simcall_BODY_run_kernel(&code);
 }
 
 int simcall_mc_random(int min, int max) {
index 832686d..8e93873 100644 (file)
@@ -40,8 +40,7 @@ void SIMIX_simcall_exit(smx_synchro_t synchro)
   synchro->post();
 }
 
-void SIMIX_run_kernel(void* code)
+void SIMIX_run_kernel(std::function<void()> const* code)
 {
-  std::function<void()>* function = (std::function<void()>*) code;
-  (*function)();
+  (*code)();
 }
index b5fff63..5e913d9 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;
+static inline std::function<void()> const* simcall_run_kernel__get__code(smx_simcall_t simcall) {
+  return simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]);
 }
-static inline void simcall_run_kernel__set__code(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
+static inline void simcall_run_kernel__set__code(smx_simcall_t simcall, std::function<void()> const* arg) {
+    simgrid::simix::marshal<std::function<void()> const*>(simcall->args[0], arg);
 }
 
 /* The prototype of all simcall handlers, automatically generated for you */
index 9494181..74b4dcf 100644 (file)
  * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
  */
 
+#include <functional>
 #include "smx_private.h"
 #include "src/mc/mc_forward.hpp"
 #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);
-    }    
-    
-  }
-  
-inline static void simcall_BODY_run_kernel(void* code) {
-    smx_process_t self = SIMIX_process_self();
-
+    return simcall<void, smx_synchro_t, const char*>(SIMCALL_SET_CATEGORY, synchro, category);
+  }
+  
+inline static void simcall_BODY_run_kernel(std::function<void()> const* code) {
     /* 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, std::function<void()> const*>(SIMCALL_RUN_KERNEL, code);
   }/** @endcond */
index a46f11e..f7b5259 100644 (file)
@@ -104,325 +104,325 @@ 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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      break;
 
 case SIMCALL_PROCESS_SUSPEND:
-       simcall_HANDLER_process_suspend(simcall , (smx_process_t) simcall->args[0].dp);
-       break;  
+      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;  
+      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;  
+      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;  
+      break;
 
 case SIMCALL_PROCESS_JOIN:
-       simcall_HANDLER_process_join(simcall , (smx_process_t) simcall->args[0].dp,  simcall->args[1].d);
-       break;  
+      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);
-       break;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      break;
 
 case SIMCALL_EXECUTION_WAIT:
-       simcall_HANDLER_execution_wait(simcall , (smx_synchro_t) simcall->args[0].dp);
-       break;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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);
-       break;  
+      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;  
+      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);
-       break;  
+      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;  
+      break;
 
 case SIMCALL_COMM_WAITANY:
-       simcall_HANDLER_comm_waitany(simcall , (xbt_dynar_t) simcall->args[0].dp);
-       break;  
+      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);
-       break;  
+      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);
-       break;  
+      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);
-       break;  
+      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;  
+      break;
 
 case SIMCALL_MUTEX_LOCK:
-       simcall_HANDLER_mutex_lock(simcall , (smx_mutex_t) simcall->args[0].dp);
-       break;  
+      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;  
+      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;  
+      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;  
+      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;  
+      break;
 
 case SIMCALL_COND_WAIT:
-       simcall_HANDLER_cond_wait(simcall , (smx_cond_t) simcall->args[0].dp, (smx_mutex_t) simcall->args[1].dp);
-       break;  
+      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);
-       break;  
+      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;  
+      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;  
+      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;  
+      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;  
+      break;
 
 case SIMCALL_SEM_ACQUIRE:
-       simcall_HANDLER_sem_acquire(simcall , (smx_sem_t) simcall->args[0].dp);
-       break;  
+      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);
-       break;  
+      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;  
+      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);
-       break;  
+      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);
-       break;  
+      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);
-       break;  
+      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);
-       break;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      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;  
+      break;
 
 case SIMCALL_RUN_KERNEL:
-       SIMIX_run_kernel( simcall->args[0].dp);
+      SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
-      break;  
+      break;
     case NUM_SIMCALLS:
       break;
     case SIMCALL_NONE:
index 71bd4ed..93f0bfe 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,15 +53,13 @@ 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);
 XBT_PRIVATE void SIMIX_simcall_handle(smx_simcall_t, int);
 XBT_PRIVATE void SIMIX_simcall_exit(smx_synchro_t);
 XBT_PRIVATE const char *SIMIX_simcall_name(e_smx_simcall_t kind);
-XBT_PRIVATE void SIMIX_run_kernel(void* code);
+XBT_PRIVATE void SIMIX_run_kernel(std::function<void()> const* code);
 
 SG_END_DECL()
 
@@ -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 e08a38d..c8cf973 100644 (file)
@@ -3,31 +3,21 @@
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
 
-# CallType handler? name (resulttype,resultcast) (arg0name,arg0type,arg0cast) (arg1name,arg1type,arg1cast)
-
-# CallType must be one of the three:
-#
-#  - Func: returning a value immediately (within the same scheduling round)
-#    examples: all getters that only retrieve information with no side effect
+# The simcalls are given as C-like signatures (one per line):
 #
-#  - Proc: not returning any value (but doing so immediately) 
-#    examples: all setters, *_cancel 
+# int foo(int x, int y);
+# int foo(int x, int y) [[block]];
+# int foo(int x, int y) [[nohandler]];
+# int foo(int x, int y) [[block, nohandler]];
 #
-#  - Blck: Blocking call that does not return in the same scheduling round.
-#    The answer requires some interaction with SURF, even if this can
-#    still occure at the same timestamp under some circonstances (eg
-#    if the surf_action cannot start because of resources that are down)
-#    examples: things that last some time (communicate, execute, mutex_lock)
+# The `block` attribut is used for calls which do not return in the same
+# scheduling round. The answer requires some interaction with SURF,
+# even if this can still occure at the same timestamp under some
+# circonstances (eg if the surf_action cannot start because of resources
+# that are down) examples: things that last some time (communicate, execute,
+# mutex_lock).
 #
-#    In a perfect world, these answers would also be handled by the
-#    script, but we are not there yet. Instead, the answer is manually
-#    generated in one of the SIMIX_post_*() functions, that are called
-#    when we unpack the done and failed actions returned by surf after
-#    a surf simulation round. Weird things happen if you forget to
-#    answer a given simcall in there...
-
-# Handler? is either "H" if we need to generate a handler or "-" if we should go without handlers
-
+# The `nohandler` is used to disable handlers.
 # I wish we could completely remove the handlers as their only use is
 # to adapt the interface between the exported symbol that is visible
 # by the user applications and the internal symbol that is implemented 
 # ./include/simgrid/simix.h (otherwise you will get a warning at the
 # compilation time)
 
-Proc H vm_suspend (void) (ind_vm, void*, sg_host_t)
-Proc H vm_resume (void) (ind_vm, void*, sg_host_t)
-Proc H vm_shutdown (void) (ind_vm, void*, sg_host_t)
-Proc H vm_save (void) (ind_vm, void*, sg_host_t)
-Proc H vm_restore (void) (ind_vm, void*, sg_host_t)
-
-Proc H process_kill (void) (process, void*, smx_process_t)
-Proc H process_killall (void) (reset_pid, int)
-Proc - process_cleanup (void) (process, void*, smx_process_t)
-Blck H process_suspend (void) (process, void*, smx_process_t)
-Proc H process_resume (void) (process, void*, smx_process_t)
-Proc H process_set_host (void) (process, void*, smx_process_t) (dest, void*, sg_host_t)
-Func - process_is_suspended (int) (process, void*, smx_process_t)
-Blck H process_join (int) (process, void*, smx_process_t) (timeout, double)
-Blck H process_sleep (int) (duration, double)
-
-Func H execution_start (void*, smx_synchro_t) (name, const char*) (flops_amount, double) (priority, double) (bound, double) (affinity_mask, unsigned long)
-Func - execution_parallel_start (void*, smx_synchro_t) (name, const char*) (host_nb, int) (host_list, void*, sg_host_t*) (flops_amount, void*, double*) (bytes_amount, void*, double*) (amount, double) (rate, double)
-Proc - execution_cancel (void) (execution, void*, smx_synchro_t)
-Proc - execution_set_priority (void) (execution, void*, smx_synchro_t) (priority, double)
-Proc - execution_set_bound (void) (execution, void*, smx_synchro_t) (bound, double)
-Proc - execution_set_affinity (void) (execution, void*, smx_synchro_t) (ws, void*, sg_host_t) (mask, unsigned long)
-Blck H execution_wait (int) (execution, void*, smx_synchro_t)
-
-Proc - process_on_exit (void) (process, void*, smx_process_t) (fun, FPtr, int_f_pvoid_pvoid_t) (data, void*)
-Proc - process_auto_restart_set (void) (process, void*, smx_process_t) (auto_restart, int)
-Func H process_restart (void*, smx_process_t) (process, void*, smx_process_t)
-
-Func - mbox_create (void*, smx_mailbox_t) (name, const char*)
-Proc - mbox_set_receiver (void) (mbox, void*, smx_mailbox_t) (receiver, void*, smx_process_t)
-
-Func H comm_iprobe (void*, smx_synchro_t) (mbox, void*, smx_mailbox_t) (type, int) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*)
-Blck H comm_send (void)                  (sender, void*, smx_process_t) (mbox, void*, smx_mailbox_t)  (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double)
-Func H comm_isend (void*, smx_synchro_t) (sender, void*, smx_process_t) (mbox, void*, smx_mailbox_t) (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (clean_fun, FPtr, simix_clean_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (detached, int)
-Blck H comm_recv (void)                  (receiver, void*, smx_process_t) (mbox, void*, smx_mailbox_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double) (rate, double)
-Func H comm_irecv (void*, smx_synchro_t) (receiver, void*, smx_process_t) (mbox, void*, smx_mailbox_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (rate, double)
-Blck H comm_waitany (int) (comms, void*, xbt_dynar_t)
-Blck H comm_wait (void) (comm, void*, smx_synchro_t) (timeout, double)
-Blck H comm_test (int) (comm, void*, smx_synchro_t)
-Blck H comm_testany (int) (comms, void*, xbt_dynar_t)
-
-Func H mutex_init (void*, smx_mutex_t)
-Blck H mutex_lock (void) (mutex, void*, smx_mutex_t)
-Func H mutex_trylock (int) (mutex, void*, smx_mutex_t)
-Proc H mutex_unlock (void) (mutex, void*, smx_mutex_t)
-
-Func - cond_init (void*, smx_cond_t)
-Proc - cond_signal (void) (cond, void*, smx_cond_t)
-Blck H cond_wait (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t)
-Blck H cond_wait_timeout (void) (cond, void*, smx_cond_t) (mutex, void*, smx_mutex_t) (timeout, double)
-Proc - cond_broadcast (void) (cond, void*, smx_cond_t)
-
-Func - sem_init (void*, smx_sem_t) (capacity, unsigned int)
-Proc H sem_release (void) (sem, void*, smx_sem_t)
-Func H sem_would_block (int) (sem, void*, smx_sem_t)
-Blck H sem_acquire (void) (sem, void*, smx_sem_t)
-Blck H sem_acquire_timeout (void) (sem, void*, smx_sem_t) (timeout, double)
-Func H sem_get_capacity (int) (sem, void*, smx_sem_t)
-
-Blck H file_read (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, sg_host_t)
-Blck H file_write (sg_size_t) (fd, void*, smx_file_t) (size, sg_size_t) (host, void*, sg_host_t)
-Blck H file_open (void*, smx_file_t) (fullpath, const char*) (host, void*, sg_host_t)
-Blck H file_close (int) (fd, void*, smx_file_t) (host, void*, sg_host_t)
-Func - file_unlink (int) (fd, void*, smx_file_t) (host, void*, sg_host_t)
-Func H file_get_size (sg_size_t) (fd, void*, smx_file_t)
-Func H file_tell (sg_size_t) (fd, void*, smx_file_t)
-Func H file_seek (int) (fd, void*, smx_file_t) (offset, sg_offset_t) (origin, int)
-Func H file_get_info (void*, xbt_dynar_t) (fd, void*, smx_file_t)
-Func H file_move (int) (fd, void*, smx_file_t) (fullpath, const char*)
-
-Func H storage_get_free_size (sg_size_t) (storage, void*, smx_storage_t)
-Func H storage_get_used_size (sg_size_t) (name, void*, smx_storage_t)
-Func - storage_get_properties (void*, xbt_dict_t) (storage, void*, smx_storage_t)
-Func - storage_get_content (void*, xbt_dict_t) (storage, void*, smx_storage_t)
-
-Func H asr_get_properties (void*, xbt_dict_t) (name, const char*)
-Func H mc_random (int) (min, int) (max, int)
-Proc - set_category (void) (synchro, void*, smx_synchro_t) (category, const char*)
-
-Proc - run_kernel (void) (code, void*)
+void vm_suspend(sg_host_t ind_vm);
+void vm_resume(sg_host_t ind_vm);
+void vm_shutdown(sg_host_t ind_vm);
+void vm_save(sg_host_t ind_vm);
+void vm_restore(sg_host_t ind_vm);
+
+void process_kill(smx_process_t process);
+void process_killall(int reset_pid);
+void process_cleanup(smx_process_t process) [[nohandler]];
+void process_suspend(smx_process_t process) [[block]];
+void process_resume(smx_process_t process);
+void process_set_host(smx_process_t process, sg_host_t dest);
+int  process_is_suspended(smx_process_t process) [[nohandler]];
+int  process_join(smx_process_t process, double timeout) [[block]];
+int  process_sleep(double duration) [[block]];
+
+smx_synchro_t execution_start(const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask);
+smx_synchro_t execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double amount, double rate) [[nohandler]];
+void          execution_cancel(smx_synchro_t execution) [[nohandler]];
+void          execution_set_priority(smx_synchro_t execution, double priority) [[nohandler]];
+void          execution_set_bound(smx_synchro_t execution, double bound) [[nohandler]];
+void          execution_set_affinity(smx_synchro_t execution, sg_host_t ws, unsigned long mask) [[nohandler]];
+int           execution_wait(smx_synchro_t execution) [[block]];
+
+void          process_on_exit(smx_process_t process, int_f_pvoid_pvoid_t fun, void* data) [[nohandler]];
+void          process_auto_restart_set(smx_process_t process, int auto_restart) [[nohandler]];
+smx_process_t process_restart(smx_process_t process);
+
+smx_mailbox_t mbox_create(const char* name) [[nohandler]];
+void          mbox_set_receiver(smx_mailbox_t mbox, smx_process_t receiver) [[nohandler]];
+
+smx_synchro_t comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag, simix_match_func_t match_fun, void* data);
+void          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) [[block]];
+smx_synchro_t 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);
+void          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) [[block]];
+smx_synchro_t 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);
+int           comm_waitany(xbt_dynar_t comms) [[block]];
+void          comm_wait(smx_synchro_t comm, double timeout) [[block]];
+int           comm_test(smx_synchro_t comm) [[block]];
+int           comm_testany(xbt_dynar_t comms) [[block]];
+
+smx_mutex_t mutex_init();
+void        mutex_lock(smx_mutex_t mutex) [[block]];
+int         mutex_trylock(smx_mutex_t mutex);
+void        mutex_unlock(smx_mutex_t mutex);
+
+smx_cond_t cond_init() [[nohandler]];
+void       cond_signal(smx_cond_t cond) [[nohandler]];
+void       cond_wait(smx_cond_t cond, smx_mutex_t mutex) [[block]];
+void       cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) [[block]];
+void       cond_broadcast(smx_cond_t cond) [[nohandler]];
+
+smx_sem_t sem_init(unsigned int capacity) [[nohandler]];
+void      sem_release(smx_sem_t sem);
+int       sem_would_block(smx_sem_t sem);
+void      sem_acquire(smx_sem_t sem) [[block]];
+void      sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
+int       sem_get_capacity(smx_sem_t sem);
+
+sg_size_t   file_read(smx_file_t fd, sg_size_t size, sg_host_t host) [[block]];
+sg_size_t   file_write(smx_file_t fd, sg_size_t size, sg_host_t host) [[block]];
+smx_file_t  file_open(const char* fullpath, sg_host_t host) [[block]];
+int         file_close(smx_file_t fd, sg_host_t host) [[block]];
+int         file_unlink(smx_file_t fd, sg_host_t host) [[nohandler]];
+sg_size_t   file_get_size(smx_file_t fd);
+sg_size_t   file_tell(smx_file_t fd);
+int         file_seek(smx_file_t fd, sg_offset_t offset, int origin);
+xbt_dynar_t file_get_info(smx_file_t fd);
+int         file_move(smx_file_t fd, const char* fullpath);
+
+sg_size_t  storage_get_free_size(smx_storage_t storage);
+sg_size_t  storage_get_used_size(smx_storage_t name);
+xbt_dict_t storage_get_properties(smx_storage_t storage) [[nohandler]];
+xbt_dict_t storage_get_content(smx_storage_t storage) [[nohandler]];
+
+xbt_dict_t asr_get_properties(const char* name);
+int        mc_random(int min, int max);
+void       set_category(smx_synchro_t synchro, const char* category) [[nohandler]];
+
+void       run_kernel(std::function<void()> const* code) [[nohandler]];
index 18c6dab..adca709 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
-# Copyright (c) 2014-2015. The SimGrid Team. All rights reserved.
+# Copyright (c) 2014-2016. The SimGrid Team. All rights reserved.
 
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the license (GNU LGPL) which comes with this package.
@@ -9,30 +9,17 @@
 import re
 import glob
 
-types = [(
-    'TCHAR', 'char', 'c'), ('TSTRING', 'const char*', 'cc'), ('TINT', 'int', 'i'), ('TLONG', 'long', 'l'), ('TUCHAR', 'unsigned char', 'uc'), ('TUSHORT', 'unsigned short', 'us'), ('TUINT', 'unsigned int', 'ui'), ('TULONG', 'unsigned long', 'ul'), ('TFLOAT', 'float', 'f'),
-    ('TDOUBLE', 'double', 'd'), ('TDPTR', 'void*', 'dp'), ('TFPTR', 'FPtr', 'fp'), ('TCPTR', 'const void*', 'cp'), ('TSIZE', 'size_t', 'sz'), ('TSGSIZE', 'sg_size_t', 'sgsz'), ('TSGOFF', 'sg_offset_t', 'sgoff'), ('TVOID', 'void', ''), ('TDSPEC', 'void*', 'dp'), ('TFSPEC', 'FPtr', 'fp')]
-
-
 class Arg(object):
-    simcall_types = {k: v for _, k, v in types}
 
-    def __init__(self, name, type, casted=None):
+    def __init__(self, name, type):
         self.name = name
         self.type = type
-        self.casted = casted
-        assert type in self.simcall_types, '%s not in (%s)' % (
-            type, ', '.join(self.simcall_types.keys()))
 
     def field(self):
         return self.simcall_types[self.type]
 
     def rettype(self):
-        return '%s' % self.casted if self.casted else self.type
-
-    def cast(self):
-        return '(%s)' % self.casted if self.casted else ''
-
+        return self.type
 
 class Simcall(object):
     simcalls_BODY = None
@@ -56,7 +43,7 @@ class Simcall(object):
             print '# ERROR: No function calling simcall_BODY_%s' % self.name
             print '# Add something like this to libsmx.c:'
             print '%s simcall_%s(%s) {' % (self.res.rettype(), self.name, ', '.join('%s %s' % (arg.rettype(), arg.name) for arg in self.args))
-            print '  return simcall_BODY_%s(%s);' % (self.name)
+            print '  return simcall_BODY_%s(%s);' % (self.name, "...")
             print '}'
             return False
 
@@ -100,43 +87,44 @@ 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))))
-        res.append('      %sbreak;  \n' %
-                   ('SIMIX_simcall_answer(simcall);\n      ' if self.call_kind != 'Blck' else ' '))
+            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 + ";");
+        if self.call_kind != 'Blck':
+            res.append('      SIMIX_simcall_answer(simcall);')
+        res.append('      break;')
+        res.append('')
         return '\n'.join(res)
 
     def body(self):
@@ -145,41 +133,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)
 
@@ -204,18 +171,33 @@ def parse(fn):
         if line.startswith('#') or not line:
             continue
         match = re.match(
-            r'(\S*?) *(\S*?) *(\S*?) *\((.*?)(?:, *(.*?))?\) *(.*)', line)
+            r'^(\S+)\s+([^\)\(\s]+)\s*\(*(.*)\)\s*(\[\[.*\]\])?\s*;\s*?$', line)
         assert match, line
-        ans, handler, name, rest, resc, args = match.groups()
-        assert (ans == 'Proc' or ans == 'Func' or ans == 'Blck'), "Invalid call type: '%s'. Faulty line:\n%s\n" % (
-            ans, line)
-        assert (handler == 'H' or handler == '-'), "Invalid need_handler indication: '%s'. Faulty line:\n%s\n" % (
-            handler, line)
+        ret, name, args, attrs = match.groups()
         sargs = []
-        for n, t, c in re.findall(r'\((.*?), *(.*?)(?:, *(.*?))?\)', args):
-            sargs.append(Arg(n, t, c))
-        sim = Simcall(name, handler == 'H',
-                      Arg('result', rest, resc), sargs, ans)
+        if not re.match("^\s*$", args):
+            for arg in re.split(",", args):
+                args = args.strip()
+                match = re.match("^(.*?)\s*?(\S+)$", arg)
+                t, n = match.groups()
+                t = t.strip()
+                n = n.strip()
+                sargs.append(Arg(n, t))
+        if ret == "void":
+            ans = "Proc"
+        else:
+            ans = "Func"
+        handler = True
+        if attrs:
+            attrs = attrs[2:-2]
+            for attr in re.split(",", attrs):
+                if attr == "block":
+                    ans = "Blck"
+                elif attr == "nohandler":
+                    handler = False
+                else:
+                    assert False, "Unknown attribute %s in: %s" % (attr, line)
+        sim = Simcall(name, handler, Arg('result', ret), sargs, ans)
         if resdi is None:
             simcalls.append(sim)
         else:
@@ -278,6 +260,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")
@@ -361,11 +344,28 @@ if __name__ == '__main__':
     # smx_popping_bodies.cpp
     #
     fd = header('popping_bodies.cpp')
+    fd.write('#include <functional>\n')
     fd.write('#include "smx_private.h"\n')
     fd.write('#include "src/mc/mc_forward.hpp"\n')
     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()
index 2618f2d..4f0ae28 100644 (file)
@@ -5,7 +5,6 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "private.h"
-#include "private.hpp"
 #include <ctype.h>
 #include <wchar.h>
 #include <stdarg.h>
index b0433fc..cc87c97 100644 (file)
@@ -17,3 +17,4 @@ extern std::map<std::string, double> location2speedup;
  * \brief Returns the last call location (filename, linenumber). Process-specific.
  */
 XBT_PUBLIC(smpi_trace_call_location_t*) smpi_process_get_call_location(void);
+XBT_PUBLIC(smpi_trace_call_location_t*) smpi_trace_get_call_location();
index a997df0..891b663 100644 (file)
@@ -738,12 +738,11 @@ void smpi_destroy_global_memory_segments(){
 #endif
 }
 
-extern "C" {
-
-  smpi_trace_call_location_t* smpi_trace_get_call_location() {
-    return smpi_process_get_call_location();
-  }
+smpi_trace_call_location_t* smpi_trace_get_call_location() {
+  return smpi_process_get_call_location();
+}
 
+extern "C" { /** These functions will be called from the user code **/
   void smpi_trace_set_call_location(const char* file, const int line) {
     smpi_trace_call_location_t* loc = smpi_process_get_call_location();
 
index 144002f..43f06ef 100644 (file)
@@ -9,6 +9,7 @@
 #include "xbt/str.h"
 #include "xbt/dict.h"
 #include "xbt/RngStream.h"
+#include <xbt/functional.hpp>
 #include <xbt/signal.hpp>
 #include "src/surf/HostImpl.hpp"
 #include "surf/surf.h"
@@ -572,7 +573,7 @@ void sg_platf_new_process(sg_platf_process_cbarg_t process)
   double kill_time  = process->kill_time;
   int auto_restart = process->on_failure == SURF_PROCESS_ON_FAILURE_DIE ? 0 : 1;
 
-  std::function<void()> code = simgrid::simix::wrap_main(parse_code, process->argc, process->argv);
+  std::function<void()> code = simgrid::xbt::wrapMain(parse_code, process->argc, process->argv);
 
   smx_process_arg_t arg = NULL;
   smx_process_t process_created = NULL;
index c14bf25..0b25bce 100644 (file)
@@ -669,6 +669,8 @@ set(headers_to_install
   include/xbt/fifo.h
   include/xbt/file.h
   include/xbt/function_types.h
+  include/xbt/functional.hpp
+  include/xbt/future.hpp
   include/xbt/graph.h
   include/xbt/heap.h
   include/xbt/lib.h