X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fba44e13f2b2b7fb3f99030e5a59cd1eb721d558..3f9b311ec56db95ec539001a860ae3c838c48312:/src/mc/transition/TransitionObjectAccess.cpp diff --git a/src/mc/transition/TransitionObjectAccess.cpp b/src/mc/transition/TransitionObjectAccess.cpp index 144107dc75..f32e459008 100644 --- a/src/mc/transition/TransitionObjectAccess.cpp +++ b/src/mc/transition/TransitionObjectAccess.cpp @@ -15,21 +15,42 @@ ObjectAccessTransition::ObjectAccessTransition(aid_t issuer, int times_considere { short s; xbt_assert(stream >> s >> objaddr_ >> objname_ >> file_ >> line_); - type_ = static_cast(s); + access_type_ = static_cast(s); } std::string ObjectAccessTransition::to_string(bool verbose) const { - if (type_ == ObjectAccessType::ENTER) - return xbt::string_printf("BeginObjectAccess(%s @ %s:%d)", objname_.c_str(), file_.c_str(), line_); - if (type_ == ObjectAccessType::EXIT) - return xbt::string_printf("EndObjectAccess(%s @ %s:%d)", objname_.c_str(), file_.c_str(), line_); - return xbt::string_printf("ObjectAccess(%s @ %s:%d)", objname_.c_str(), file_.c_str(), line_); + std::string res; + if (access_type_ == ObjectAccessType::ENTER) + res = std::string("BeginObjectAccess("); + else if (access_type_ == ObjectAccessType::EXIT) + res = std::string("EndObjectAccess("); + else + res = std::string("ObjectAccess("); + res += objname_; + if (not xbt_log_no_loc) + res += std::string(" @ ") + file_ + ":" + std::to_string(line_); + res += std::string(")"); + return res; } bool ObjectAccessTransition::depends(const Transition* o) const { + if (o->type_ < type_) + return o->depends(this); + + // Actions executed by the same actor are always dependent + if (o->aid_ == aid_) + return true; + if (const auto* other = dynamic_cast(o)) return objaddr_ == other->objaddr_; // dependent only if it's an access to the same object return false; } +bool ObjectAccessTransition::reversible_race(const Transition* other) const +{ + xbt_assert(type_ == Type::OBJECT_ACCESS, "Unexpected transition type %s", to_c_str(type_)); + + return true; // Object access is always enabled +} + } // namespace simgrid::mc