Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Compile the safe part of MC in default mode too
[simgrid.git] / src / mc / transition / TransitionComm.cpp
index 5907f7f..8ae9d20 100644 (file)
@@ -1,24 +1,21 @@
-/* Copyright (c) 2015-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2015-2023. 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. */
 
 #include "src/mc/transition/TransitionComm.hpp"
-#include "xbt/asserts.h"
-#include <simgrid/config.h>
-#if SIMGRID_HAVE_MC
-#include "src/mc/ModelChecker.hpp"
-#include "src/mc/Session.hpp"
+#include "simgrid/config.h"
+#include "src/mc/api/RemoteApp.hpp"
 #include "src/mc/api/State.hpp"
-#endif
+#include "xbt/asserts.h"
+#include "xbt/string.hpp"
 
 #include <sstream>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_trans_comm, mc_transition,
                                 "Logging specific to MC transitions about communications");
 
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
 
 CommWaitTransition::CommWaitTransition(aid_t issuer, int times_considered, std::stringstream& stream)
     : Transition(Type::COMM_WAIT, issuer, times_considered)
@@ -41,9 +38,6 @@ std::string CommWaitTransition::to_string(bool verbose) const
 }
 bool CommWaitTransition::depends(const Transition* other) const
 {
-  if (aid_ == other->aid_)
-    return false;
-
   if (other->type_ < type_)
     return other->depends(this);
 
@@ -56,9 +50,11 @@ bool CommWaitTransition::depends(const Transition* other) const
     if (sbuff_ != 0 && rbuff_ != 0 && wait->sbuff_ != 0 && wait->rbuff_ != 0 && rbuff_ != wait->sbuff_ &&
         rbuff_ != wait->rbuff_ && rbuff_ != sbuff_)
       return false;
+
+    return true;
   }
 
-  return true;
+  return false; // Comm transitions are INDEP with non-comm transitions
 }
 CommTestTransition::CommTestTransition(aid_t issuer, int times_considered, std::stringstream& stream)
     : Transition(Type::COMM_TEST, issuer, times_considered)
@@ -80,9 +76,6 @@ std::string CommTestTransition::to_string(bool verbose) const
 }
 bool CommTestTransition::depends(const Transition* other) const
 {
-  if (aid_ == other->aid_)
-    return false;
-
   if (other->type_ < type_)
     return other->depends(this);
 
@@ -97,11 +90,11 @@ bool CommTestTransition::depends(const Transition* other) const
     return false;
   }
 
-  return true;
+  return false; // Comm transitions are INDEP with non-comm transitions
 }
 
 CommRecvTransition::CommRecvTransition(aid_t issuer, int times_considered, std::stringstream& stream)
-    : Transition(Type::COMM_RECV, issuer, times_considered)
+    : Transition(Type::COMM_ASYNC_RECV, issuer, times_considered)
 {
   xbt_assert(stream >> comm_ >> mbox_ >> rbuff_ >> tag_);
 }
@@ -115,9 +108,6 @@ std::string CommRecvTransition::to_string(bool verbose) const
 }
 bool CommRecvTransition::depends(const Transition* other) const
 {
-  if (aid_ == other->aid_)
-    return false;
-
   if (other->type_ < type_)
     return other->depends(this);
 
@@ -133,6 +123,8 @@ bool CommRecvTransition::depends(const Transition* other) const
 
     if ((aid_ != test->sender_) && (aid_ != test->receiver_) && (test->rbuff_ != rbuff_))
       return false;
+
+    return true; // DEP with other send transitions
   }
 
   if (auto* wait = dynamic_cast<const CommWaitTransition*>(other)) {
@@ -144,13 +136,15 @@ bool CommRecvTransition::depends(const Transition* other) const
 
     if ((aid_ != wait->sender_) && (aid_ != wait->receiver_) && (wait->rbuff_ != rbuff_))
       return false;
+
+    return true; // DEP with other wait transitions
   }
 
-  return true;
+  return false; // Comm transitions are INDEP with non-comm transitions
 }
 
 CommSendTransition::CommSendTransition(aid_t issuer, int times_considered, std::stringstream& stream)
-    : Transition(Type::COMM_SEND, issuer, times_considered)
+    : Transition(Type::COMM_ASYNC_SEND, issuer, times_considered)
 {
   xbt_assert(stream >> comm_ >> mbox_ >> sbuff_ >> size_ >> tag_);
   XBT_DEBUG("SendTransition comm:%" PRIxPTR " mbox:%u sbuff:%" PRIxPTR " size:%zu", comm_, mbox_, sbuff_, size_);
@@ -166,9 +160,6 @@ std::string CommSendTransition::to_string(bool verbose = false) const
 
 bool CommSendTransition::depends(const Transition* other) const
 {
-  if (aid_ == other->aid_)
-    return false;
-
   if (other->type_ < type_)
     return other->depends(this);
 
@@ -184,6 +175,8 @@ bool CommSendTransition::depends(const Transition* other) const
 
     if ((aid_ != test->sender_) && (aid_ != test->receiver_) && (test->sbuff_ != sbuff_))
       return false;
+
+    return true; // DEP with other test transitions
   }
 
   if (const auto* wait = dynamic_cast<const CommWaitTransition*>(other)) {
@@ -195,10 +188,11 @@ bool CommSendTransition::depends(const Transition* other) const
 
     if ((aid_ != wait->sender_) && (aid_ != wait->receiver_) && (wait->sbuff_ != sbuff_))
       return false;
+
+    return true; // DEP with other wait transitions
   }
 
-  return true;
+  return false; // Comm transitions are INDEP with non-comm transitions
 }
 
-} // namespace mc
-} // namespace simgrid
+} // namespace simgrid::mc