Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Mark smx_actor_t as deprecated.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 14 Mar 2022 13:21:48 +0000 (14:21 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 14 Mar 2022 13:54:09 +0000 (14:54 +0100)
13 files changed:
include/simgrid/forward.h
include/simgrid/simix.h
src/bindings/java/JavaContext.cpp
src/bindings/java/jmsg_process.cpp
src/kernel/actor/ActorImpl.cpp
src/kernel/actor/Simcall.hpp
src/kernel/context/ContextSwapped.cpp
src/kernel/context/ContextThread.cpp
src/mc/mc_base.cpp
src/mc/mc_base.hpp
src/mc/mc_smx.cpp
src/s4u/s4u_Actor.cpp
src/simix/libsmx.cpp

index c97b3cf..7727ca5 100644 (file)
@@ -227,7 +227,8 @@ using s4u_NetZone           = simgrid::s4u::NetZone;
 using s4u_VM                = simgrid::s4u::VirtualMachine;
 
 using smx_timer_t    = simgrid::kernel::timer::Timer*;
-using smx_actor_t    = simgrid::kernel::actor::ActorImpl*;
+using smx_actor_t
+    XBT_ATTRIB_DEPRECATED_v335("Please use simgrid::kernel::actor::ActorImpl*") = simgrid::kernel::actor::ActorImpl*;
 using smx_activity_t = simgrid::kernel::activity::ActivityImpl*;
 using smx_cond_t     = simgrid::kernel::activity::ConditionVariableImpl*;
 using smx_mailbox_t  = simgrid::kernel::activity::MailboxImpl*;
@@ -251,7 +252,7 @@ typedef struct s4u_NetZone s4u_NetZone;
 typedef struct s4u_VM s4u_VM;
 
 typedef struct s_smx_timer* smx_timer_t;
-typedef struct s_smx_actor* smx_actor_t;
+XBT_ATTRIB_DEPRECATED_v335("Please stop using this type alias") typedef struct s_smx_actor* smx_actor_t;
 typedef struct s_smx_activity* smx_activity_t;
 typedef struct s_smx_cond_t* smx_cond_t;
 typedef struct s_smx_mailbox* smx_mailbox_t;
index 9804e9d..147d22a 100644 (file)
@@ -43,7 +43,13 @@ SG_END_DECL
 
 /********************************* Process ************************************/
 SG_BEGIN_DECL
-XBT_ATTRIB_DEPRECATED_v333("Please use kernel::actor::ActorImpl::self()") XBT_PUBLIC smx_actor_t SIMIX_process_self();
+XBT_ATTRIB_DEPRECATED_v333("Please use kernel::actor::ActorImpl::self()") XBT_PUBLIC
+#ifdef __cplusplus
+    simgrid::kernel::actor::ActorImpl*
+#else
+    smx_actor_t
+#endif
+    SIMIX_process_self();
 XBT_ATTRIB_DEPRECATED_v333("Please use xbt_procname()") XBT_PUBLIC const char* SIMIX_process_self_get_name();
 SG_END_DECL
 
@@ -67,27 +73,28 @@ XBT_ATTRIB_DEPRECATED_v333("Please use Comm::copy_pointer_callback()") XBT_PUBLI
 /************************** Communication simcalls ****************************/
 
 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::send()") XBT_PUBLIC
-    void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
-                           size_t src_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+    void simcall_comm_send(simgrid::kernel::actor::ActorImpl* sender, smx_mailbox_t mbox, double task_size, double rate,
+                           void* src_buff, size_t src_buff_size,
+                           bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                            void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
                            double timeout);
 
 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::isend()") XBT_PUBLIC simgrid::kernel::activity::ActivityImplPtr
-    simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
-                       size_t src_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
-                       void (*clean_fun)(void*),
+    simcall_comm_isend(simgrid::kernel::actor::ActorImpl* sender, smx_mailbox_t mbox, double task_size, double rate,
+                       void* src_buff, size_t src_buff_size,
+                       bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void (*clean_fun)(void*),
                        void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
                        bool detached);
 
 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::recv()") XBT_PUBLIC
-    void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
-                           bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+    void simcall_comm_recv(simgrid::kernel::actor::ActorImpl* receiver, smx_mailbox_t mbox, void* dst_buff,
+                           size_t* dst_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                            void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
                            double timeout, double rate);
 
 XBT_ATTRIB_DEPRECATED_v335("Please use s4u::Comm::irecv()") XBT_PUBLIC simgrid::kernel::activity::ActivityImplPtr
-    simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
-                       bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+    simcall_comm_irecv(simgrid::kernel::actor::ActorImpl* receiver, smx_mailbox_t mbox, void* dst_buff,
+                       size_t* dst_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                        void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
                        double rate);
 
index b64a548..d112228 100644 (file)
@@ -44,7 +44,7 @@ void JavaContextFactory::run_all(std::vector<actor::ActorImpl*> const& actors)
   SerialThreadContext::run_all(actors);
 }
 
-JavaContext::JavaContext(std::function<void()>&& code, smx_actor_t actor)
+JavaContext::JavaContext(std::function<void()>&& code, actor::ActorImpl* actor)
     : SerialThreadContext(std::move(code), actor, false /* not maestro */)
 {
   /* ThreadContext already does all we need */
index 1167be4..ffbf7ff 100644 (file)
@@ -77,7 +77,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject
   auto actor_code   = [jprocess]() { simgrid::kernel::context::java_main_jprocess(jprocess); };
   auto self         = simgrid::kernel::actor::ActorImpl::self();
   sg_host_t host    = jhost_get_native(env, jhost);
-  smx_actor_t actor = simgrid::kernel::actor::simcall_answered([name, actor_code, host, self] {
+  auto* actor       = simgrid::kernel::actor::simcall_answered([name, actor_code, host, self] {
     return simgrid::kernel::actor::ActorImpl::create(std::move(name), std::move(actor_code), nullptr, host, self).get();
   });
   sg_actor_yield();
index 47b901c..21acfce 100644 (file)
@@ -29,7 +29,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_actor, kernel, "Logging specific to Actor's
  *
  * @return The SIMIX process
  */
-smx_actor_t SIMIX_process_self() // XBT_ATTRIB_DEPRECATED_v333
+simgrid::kernel::actor::ActorImpl* SIMIX_process_self() // XBT_ATTRIB_DEPRECATED_v333
 {
   return simgrid::kernel::actor::ActorImpl::self();
 }
index 2d561cb..c50dbfd 100644 (file)
@@ -24,7 +24,7 @@ public:
   XBT_DECLARE_ENUM_CLASS(Type, NONE, RUN_ANSWERED, RUN_BLOCKING);
 
   Type call_                                         = Type::NONE;
-  smx_actor_t issuer_                                = nullptr;
+  simgrid::kernel::actor::ActorImpl* issuer_         = nullptr;
   simgrid::kernel::timer::Timer* timeout_cb_         = nullptr; // Callback to timeouts
   simgrid::kernel::actor::SimcallObserver* observer_ = nullptr; // makes that simcall observable by the MC
   unsigned int mc_max_consider_ =
index 26f6738..a4ab5b3 100644 (file)
@@ -70,7 +70,7 @@ namespace context {
 /* thread-specific storage for the worker's context */
 thread_local SwappedContext* SwappedContext::worker_context_ = nullptr;
 
-SwappedContext::SwappedContext(std::function<void()>&& code, smx_actor_t actor, SwappedContextFactory* factory)
+SwappedContext::SwappedContext(std::function<void()>&& code, actor::ActorImpl* actor, SwappedContextFactory* factory)
     : Context(std::move(code), actor, not code /* maestro if no code */), factory_(*factory)
 {
   // Save maestro (=first created context) in preparation for run_all
@@ -207,7 +207,7 @@ void SwappedContextFactory::run_all(std::vector<actor::ActorImpl*> const& actors
   if (is_parallel()) {
     // We lazily create the parmap so that all options are actually processed when doing so.
     if (parmap_ == nullptr)
-      parmap_ = std::make_unique<simgrid::xbt::Parmap<smx_actor_t>>(get_nthreads(), get_parallel_mode());
+      parmap_ = std::make_unique<simgrid::xbt::Parmap<actor::ActorImpl*>>(get_nthreads(), get_parallel_mode());
 
     // Usually, Parmap::apply() executes the provided function on all elements of the array.
     // Here, the executed function does not return the control to the parmap before all the array is processed:
@@ -266,7 +266,7 @@ void SwappedContext::suspend()
   SwappedContext* next_context;
   if (is_parallel()) {
     // Get some more work to directly swap into the next executable actor instead of yielding back to the parmap
-    boost::optional<smx_actor_t> next_work = factory_.parmap_->next();
+    boost::optional<actor::ActorImpl*> next_work = factory_.parmap_->next();
     if (next_work) {
       // There is a next soul to embody (ie, another executable actor)
       XBT_DEBUG("Run next process");
index eb9b4bd..0a5dc3e 100644 (file)
@@ -166,7 +166,7 @@ void ThreadContext::attach_stop()
 
 void SerialThreadContext::run_all(std::vector<actor::ActorImpl*> const& actors_list)
 {
-  for (smx_actor_t const& actor : actors_list) {
+  for (auto const* actor : actors_list) {
     XBT_DEBUG("Handling %p", actor);
     auto* context = static_cast<ThreadContext*>(actor->context_.get());
     context->release();
@@ -191,10 +191,10 @@ void ParallelThreadContext::finalize()
 
 void ParallelThreadContext::run_all(std::vector<actor::ActorImpl*> const& actors_list)
 {
-  for (smx_actor_t const& actor : actors_list)
+  for (auto const* actor : actors_list)
     static_cast<ThreadContext*>(actor->context_.get())->release();
 
-  for (smx_actor_t const& actor : actors_list)
+  for (auto const* actor : actors_list)
     static_cast<ThreadContext*>(actor->context_.get())->wait();
 }
 
index 3711f92..dbebae2 100644 (file)
@@ -78,7 +78,7 @@ void execute_actors()
  * This is controlled in the is_enabled() method of the corresponding observers.
  */
 // Called from both MCer and MCed:
-bool actor_is_enabled(smx_actor_t actor)
+bool actor_is_enabled(kernel::actor::ActorImpl* actor)
 {
 #if SIMGRID_HAVE_MC
   xbt_assert(mc_model_checker == nullptr, "This should be called from the client side");
index 69fc226..84bf8be 100644 (file)
@@ -34,7 +34,7 @@ XBT_PRIVATE void handle_simcall(kernel::actor::Simcall* req, int req_num);
  *  have both a source and a destination yet is not enabled
  *  (unless timeout is enabled in the wait and enabled in SimGridMC).
  */
-XBT_PRIVATE bool actor_is_enabled(smx_actor_t process);
+XBT_PRIVATE bool actor_is_enabled(kernel::actor::ActorImpl* process);
 
 /** Check if the given simcall is visible */
 XBT_PRIVATE bool request_is_visible(const kernel::actor::Simcall* req);
index a2d3310..dd88147 100644 (file)
@@ -29,7 +29,7 @@ using simgrid::mc::remote;
 /** Load the remote list of processes into a vector
  *
  *  @param process      MCed process
- *  @param target       Local vector (to be filled with copies of `s_smx_actor_t`)
+ *  @param target       Local vector (to be filled with `simgrid::mc::ActorInformation`)
  *  @param remote_dynar Address of the process dynar in the remote list
  */
 static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteProcess* process,
@@ -41,7 +41,7 @@ static void MC_process_refresh_simix_actor_dynar(const simgrid::mc::RemoteProces
   s_xbt_dynar_t dynar;
   process->read_bytes(&dynar, sizeof(dynar), remote_dynar);
 
-  auto* data = static_cast<smx_actor_t*>(::operator new(dynar.elmsize * dynar.used));
+  auto* data = static_cast<simgrid::kernel::actor::ActorImpl**>(::operator new(dynar.elmsize * dynar.used));
   process->read_bytes(data, dynar.elmsize * dynar.used, simgrid::mc::RemotePtr<void>(dynar.data));
 
   // Load each element of the vector from the MCed process:
index 469d06c..194af96 100644 (file)
@@ -720,7 +720,7 @@ sg_actor_t sg_actor_attach(const char* name, void* data, sg_host_t host, xbt_dic
   xbt_dict_free(&properties);
 
   /* Let's create the actor: SIMIX may decide to start it right now, even before returning the flow control to us */
-  smx_actor_t actor = nullptr;
+  simgrid::kernel::actor::ActorImpl* actor = nullptr;
   try {
     actor = simgrid::kernel::actor::ActorImpl::attach(name, data, host).get();
     actor->set_properties(props);
index 402d188..0ee6a0c 100644 (file)
@@ -23,8 +23,9 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ker_simcall);
 /**
  * @ingroup simix_comm_management
  */
-void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
-                       size_t src_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+void simcall_comm_send(simgrid::kernel::actor::ActorImpl* sender, smx_mailbox_t mbox, double task_size, double rate,
+                       void* src_buff, size_t src_buff_size,
+                       bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                        void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
                        double timeout) // XBT_ATTRIB_DEPRECATED_v335
 {
@@ -37,10 +38,11 @@ void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size,
  * @ingroup simix_comm_management
  */
 simgrid::kernel::activity::ActivityImplPtr
-simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
-                   size_t src_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
-                   void (*clean_fun)(void*), void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t),
-                   void* data, bool detached) // XBT_ATTRIB_DEPRECATED_v335
+simcall_comm_isend(simgrid::kernel::actor::ActorImpl* sender, smx_mailbox_t mbox, double task_size, double rate,
+                   void* src_buff, size_t src_buff_size,
+                   bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void (*clean_fun)(void*),
+                   void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
+                   bool detached) // XBT_ATTRIB_DEPRECATED_v335
 {
   /* checking for infinite values */
   xbt_assert(std::isfinite(task_size), "task_size is not finite!");
@@ -58,8 +60,8 @@ simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, dou
 /**
  * @ingroup simix_comm_management
  */
-void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
-                       bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+void simcall_comm_recv(simgrid::kernel::actor::ActorImpl* receiver, smx_mailbox_t mbox, void* dst_buff,
+                       size_t* dst_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                        void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
                        double timeout, double rate) // XBT_ATTRIB_DEPRECATED_v335
 {
@@ -72,8 +74,8 @@ void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff,
  * @ingroup simix_comm_management
  */
 simgrid::kernel::activity::ActivityImplPtr
-simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
-                   bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+simcall_comm_irecv(simgrid::kernel::actor::ActorImpl* receiver, smx_mailbox_t mbox, void* dst_buff,
+                   size_t* dst_buff_size, bool (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                    void (*copy_data_fun)(simgrid::kernel::activity::CommImpl*, void*, size_t), void* data,
                    double rate) // XBT_ATTRIB_DEPRECATED_v335
 {