X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=blobdiff_plain;f=cyclegraph.h;h=42866a3b370ceb52ab85967c1cfe0c80f4aedf6f;hp=2e523d7950b28c5b91830217414eebbc459d2972;hb=7c77391dff9f4cf3166d47015494f0af276963f0;hpb=d3f14b49a90dc60f1976529f3cd784832c1fad32 diff --git a/cyclegraph.h b/cyclegraph.h index 2e523d7..42866a3 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -8,6 +8,8 @@ #include "hashtable.h" #include #include +#include "config.h" +#include "mymemory.h" class CycleNode; class ModelAction; @@ -19,31 +21,59 @@ class CycleGraph { ~CycleGraph(); void addEdge(const ModelAction *from, const ModelAction *to); bool checkForCycles(); + bool checkForRMWViolation(); void addRMWEdge(const ModelAction *from, const ModelAction *rmw); bool checkReachable(const ModelAction *from, const ModelAction *to); + void startChanges(); + void commitChanges(); + void rollbackChanges(); +#if SUPPORT_MOD_ORDER_DUMP + void dumpNodes(FILE *file); + void dumpGraphToFile(const char * filename); +#endif + SNAPSHOTALLOC private: CycleNode * getNode(const ModelAction *); /** @brief A table for mapping ModelActions to CycleNodes */ HashTable actionToNode; +#if SUPPORT_MOD_ORDER_DUMP + std::vector nodeList; +#endif bool checkReachable(CycleNode *from, CycleNode *to); /** @brief A flag: true if this graph contains cycles */ bool hasCycles; + bool oldCycles; + + bool hasRMWViolation; + bool oldRMWViolation; + + std::vector rollbackvector; + std::vector rmwrollbackvector; }; /** @brief A node within a CycleGraph; corresponds to one ModelAction */ class CycleNode { public: CycleNode(const ModelAction *action); - void addEdge(CycleNode * node); + bool addEdge(CycleNode * node); std::vector * getEdges(); bool setRMW(CycleNode *); CycleNode* getRMW(); + const ModelAction * getAction() {return action;}; + + void popEdge() { + edges.pop_back(); + }; + void clearRMW() { + hasRMW=NULL; + } + SNAPSHOTALLOC private: /** @brief The ModelAction that this node represents */ const ModelAction *action;