Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use type aid_t for actor ids.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 22 Apr 2021 10:55:32 +0000 (12:55 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 22 Apr 2021 12:36:33 +0000 (14:36 +0200)
src/mc/ModelChecker.cpp
src/mc/ModelChecker.hpp
src/mc/Transition.hpp
src/mc/remote/AppSide.cpp
src/mc/remote/mc_protocol.h

index f83ee8d..feab1c3 100644 (file)
@@ -317,7 +317,7 @@ void ModelChecker::handle_simcall(Transition const& transition)
   if (this->remote_process_->running())
     checker_side_.dispatch();
 }
-bool ModelChecker::simcall_is_visible(int aid)
+bool ModelChecker::simcall_is_visible(aid_t aid)
 {
   xbt_assert(mc_model_checker != nullptr, "This should be called from the checker side");
 
@@ -336,13 +336,13 @@ bool ModelChecker::simcall_is_visible(int aid)
              to_c_str(answer.type), (int)answer.type, (int)s, (int)MessageType::SIMCALL_IS_VISIBLE_ANSWER,
              (int)sizeof(answer));
 
-  XBT_DEBUG("is_visible(%d) is returning %s", aid, answer.value ? "true" : "false");
+  XBT_DEBUG("is_visible(%ld) is returning %s", aid, answer.value ? "true" : "false");
 
   this->remote_process_->clear_cache();
   return answer.value;
 }
 
-std::string ModelChecker::simcall_to_string(MessageType type, int aid, int times_considered)
+std::string ModelChecker::simcall_to_string(MessageType type, aid_t aid, int times_considered)
 {
   xbt_assert(mc_model_checker != nullptr, "This should be called from the checker side");
 
@@ -365,17 +365,17 @@ std::string ModelChecker::simcall_to_string(MessageType type, int aid, int times
   return std::string(answer.value);
 }
 
-std::string ModelChecker::simcall_to_string(int aid, int times_considered)
+std::string ModelChecker::simcall_to_string(aid_t aid, int times_considered)
 {
   std::string answer = simcall_to_string(MessageType::SIMCALL_TO_STRING, aid, times_considered);
-  XBT_DEBUG("to_string(%d) is returning %s", aid, answer.c_str());
+  XBT_DEBUG("to_string(%ld) is returning %s", aid, answer.c_str());
   return answer;
 }
 
-std::string ModelChecker::simcall_dot_label(int aid, int times_considered)
+std::string ModelChecker::simcall_dot_label(aid_t aid, int times_considered)
 {
   std::string answer = simcall_to_string(MessageType::SIMCALL_DOT_LABEL, aid, times_considered);
-  XBT_DEBUG("dot_label(%d) is returning %s", aid, answer.c_str());
+  XBT_DEBUG("dot_label(%ld) is returning %s", aid, answer.c_str());
   return answer;
 }
 
index 2bf1ceb..8b8d395 100644 (file)
@@ -29,7 +29,7 @@ class ModelChecker {
   Checker* checker_ = nullptr;
 
   // Expect MessageType::SIMCALL_TO_STRING or MessageType::SIMCALL_DOT_LABEL
-  std::string simcall_to_string(MessageType type, int aid, int times_considered);
+  std::string simcall_to_string(MessageType type, aid_t aid, int times_considered);
 
 public:
   ModelChecker(ModelChecker const&) = delete;
@@ -52,9 +52,9 @@ public:
   void handle_simcall(Transition const& transition);
 
   /* Interactions with the simcall observer */
-  bool simcall_is_visible(int aid);
-  std::string simcall_to_string(int aid, int times_considered);
-  std::string simcall_dot_label(int aid, int times_considered);
+  bool simcall_is_visible(aid_t aid);
+  std::string simcall_to_string(aid_t aid, int times_considered);
+  std::string simcall_dot_label(aid_t aid, int times_considered);
 
   XBT_ATTRIB_NORETURN void exit(int status);
 
index a8a151e..17754e6 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef SIMGRID_MC_TRANSITION_HPP
 #define SIMGRID_MC_TRANSITION_HPP
 
+#include "simgrid/forward.h" // aid_t
 #include <string>
 
 namespace simgrid {
@@ -22,7 +23,7 @@ namespace mc {
  */
 class Transition {
 public:
-  long aid_ = 0;
+  aid_t aid_ = 0;
 
   /* Which transition was executed for this simcall
    *
index 376e8b6..f45e856 100644 (file)
@@ -92,7 +92,7 @@ void AppSide::handle_deadlock_check(const s_mc_message_t*) const
 void AppSide::handle_simcall_execute(const s_mc_message_simcall_handle_t* message) const
 {
   kernel::actor::ActorImpl* process = kernel::actor::ActorImpl::by_pid(message->aid_);
-  xbt_assert(process != nullptr, "Invalid pid %lu", message->aid_);
+  xbt_assert(process != nullptr, "Invalid pid %ld", message->aid_);
   process->simcall_handle(message->times_considered_);
   xbt_assert(channel_.send(MessageType::WAITING) == 0, "Could not send MESSAGE_WAITING to model-checker");
 }
@@ -138,7 +138,7 @@ void AppSide::handle_messages() const
         assert_msg_size("SIMCALL_IS_VISIBLE", s_mc_message_simcall_is_visible_t);
         auto msg_simcall                = (s_mc_message_simcall_is_visible_t*)message_buffer.data();
         const kernel::actor::ActorImpl* actor = kernel::actor::ActorImpl::by_pid(msg_simcall->aid);
-        xbt_assert(actor != nullptr, "Invalid pid %d", msg_simcall->aid);
+        xbt_assert(actor != nullptr, "Invalid pid %ld", msg_simcall->aid);
         xbt_assert(actor->simcall_.observer_, "The transition of %s has no observer", actor->get_cname());
         bool value = actor->simcall_.observer_->is_visible();
 
@@ -152,7 +152,7 @@ void AppSide::handle_messages() const
         assert_msg_size("SIMCALL_TO_STRING", s_mc_message_simcall_to_string_t);
         auto msg_simcall                = (s_mc_message_simcall_to_string_t*)message_buffer.data();
         const kernel::actor::ActorImpl* actor = kernel::actor::ActorImpl::by_pid(msg_simcall->aid);
-        xbt_assert(actor != nullptr, "Invalid pid %d", msg_simcall->aid);
+        xbt_assert(actor != nullptr, "Invalid pid %ld", msg_simcall->aid);
         xbt_assert(actor->simcall_.observer_, "The transition of %s has no observer", actor->get_cname());
         std::string value = actor->simcall_.observer_->to_string(msg_simcall->time_considered);
 
@@ -167,7 +167,7 @@ void AppSide::handle_messages() const
         assert_msg_size("SIMCALL_DOT_LABEL", s_mc_message_simcall_to_string_t);
         auto msg_simcall                = (s_mc_message_simcall_to_string_t*)message_buffer.data();
         const kernel::actor::ActorImpl* actor = kernel::actor::ActorImpl::by_pid(msg_simcall->aid);
-        xbt_assert(actor != nullptr, "Invalid pid %d", msg_simcall->aid);
+        xbt_assert(actor != nullptr, "Invalid pid %ld", msg_simcall->aid);
         xbt_assert(actor->simcall_.observer_, "The transition of %s has no observer", actor->get_cname());
         std::string value = actor->simcall_.observer_->dot_label();
 
index 4f506b5..9b08c62 100644 (file)
@@ -96,7 +96,7 @@ struct s_mc_message_register_symbol_t {
 /* Server -> client */
 struct s_mc_message_simcall_handle_t {
   simgrid::mc::MessageType type;
-  unsigned long aid_;
+  aid_t aid_;
   int times_considered_;
 };
 
@@ -113,7 +113,7 @@ struct s_mc_message_actor_enabled_t {
 /* RPC */
 struct s_mc_message_simcall_is_visible_t { // MessageType::SIMCALL_IS_VISIBLE
   simgrid::mc::MessageType type;
-  int aid;
+  aid_t aid;
 };
 struct s_mc_message_simcall_is_visible_answer_t { // MessageType::SIMCALL_IS_VISIBLE_ANSWER
   simgrid::mc::MessageType type;
@@ -122,7 +122,7 @@ struct s_mc_message_simcall_is_visible_answer_t { // MessageType::SIMCALL_IS_VIS
 
 struct s_mc_message_simcall_to_string_t { // MessageType::SIMCALL_TO_STRING or MessageType::SIMCALL_DOT_LABEL
   simgrid::mc::MessageType type;
-  int aid;
+  aid_t aid;
   int time_considered;
 };
 struct s_mc_message_simcall_to_string_answer_t { // MessageType::SIMCALL_TO_STRING_ANSWER