Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
283b7c9dcc8b1969758066fb264824d35ffeae32
[simgrid.git] / src / mc / explo / odpor / ReversibleRaceCalculator.hpp
1 /* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef SIMGRID_MC_ODPOR_REVERSIBLE_RACE_CALCULATOR_HPP
7 #define SIMGRID_MC_ODPOR_REVERSIBLE_RACE_CALCULATOR_HPP
8
9 #include "src/mc/explo/odpor/Execution.hpp"
10 #include "src/mc/explo/odpor/odpor_forward.hpp"
11 #include "src/mc/transition/Transition.hpp"
12 #include "src/mc/transition/TransitionActorJoin.hpp"
13 #include "src/mc/transition/TransitionAny.hpp"
14 #include "src/mc/transition/TransitionComm.hpp"
15 #include "src/mc/transition/TransitionObjectAccess.hpp"
16 #include "src/mc/transition/TransitionRandom.hpp"
17 #include "src/mc/transition/TransitionSynchro.hpp"
18
19 #include <memory>
20
21 namespace simgrid::mc::odpor {
22
23 /**
24  * @brief Computes whether a race between two events
25  * in a given execution is a reversible race.
26  *
27  * @note: All of the methods assume that there is
28  * indeed a race between the two events in the
29  * execution; indeed, the question the method answers
30  * is only sensible in the context of a race
31  */
32 class ReversibleRaceCalculator final {
33   static bool is_race_reversible_ActorJoin(const Execution&, Execution::EventHandle e1, const Transition* e2);
34   static bool is_race_reversible_BarrierAsyncLock(const Execution&, Execution::EventHandle e1, const Transition* e2);
35   static bool is_race_reversible_BarrierWait(const Execution&, Execution::EventHandle e1, const Transition* e2);
36   static bool is_race_reversible_CommRecv(const Execution&, Execution::EventHandle e1, const Transition* e2);
37   static bool is_race_reversible_CommSend(const Execution&, Execution::EventHandle e1, const Transition* e2);
38   static bool is_race_reversible_CommWait(const Execution&, Execution::EventHandle e1, const Transition* e2);
39   static bool is_race_reversible_CommTest(const Execution&, Execution::EventHandle e1, const Transition* e2);
40   static bool is_race_reversible_MutexAsyncLock(const Execution&, Execution::EventHandle e1, const Transition* e2);
41   static bool is_race_reversible_MutexTest(const Execution&, Execution::EventHandle e1, const Transition* e2);
42   static bool is_race_reversible_MutexTrylock(const Execution&, Execution::EventHandle e1, const Transition* e2);
43   static bool is_race_reversible_MutexUnlock(const Execution&, Execution::EventHandle e1, const Transition* e2);
44   static bool is_race_reversible_MutexWait(const Execution&, Execution::EventHandle e1, const Transition* e2);
45   static bool is_race_reversible_SemAsyncLock(const Execution&, Execution::EventHandle e1, const Transition* e2);
46   static bool is_race_reversible_SemUnlock(const Execution&, Execution::EventHandle e1, const Transition* e2);
47   static bool is_race_reversible_SemWait(const Execution&, Execution::EventHandle e1, const Transition* e2);
48   static bool is_race_reversible_ObjectAccess(const Execution&, Execution::EventHandle e1, const Transition* e2);
49   static bool is_race_reversible_Random(const Execution&, Execution::EventHandle e1, const Transition* e2);
50   static bool is_race_reversible_TestAny(const Execution&, Execution::EventHandle e1, const Transition* e2);
51   static bool is_race_reversible_WaitAny(const Execution&, Execution::EventHandle e1, const Transition* e2);
52
53 public:
54   static bool is_race_reversible(const Execution&, Execution::EventHandle e1, Execution::EventHandle e2);
55 };
56
57 } // namespace simgrid::mc::odpor
58 #endif