X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=cyclegraph.h;h=f0f04ffee0c3ca1f9cd3ef2edf46c2743e6c0515;hp=2e523d7950b28c5b91830217414eebbc459d2972;hb=39c0de028fe3b1c1d229ecf715007c751ddab445;hpb=d3f14b49a90dc60f1976529f3cd784832c1fad32 diff --git a/cyclegraph.h b/cyclegraph.h index 2e523d79..f0f04ffe 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -8,7 +8,10 @@ #include "hashtable.h" #include #include +#include "config.h" +#include "mymemory.h" +class Promise; class CycleNode; class ModelAction; @@ -19,31 +22,60 @@ class CycleGraph { ~CycleGraph(); void addEdge(const ModelAction *from, const ModelAction *to); bool checkForCycles(); + bool checkForRMWViolation(); void addRMWEdge(const ModelAction *from, const ModelAction *rmw); - + bool checkPromise(const ModelAction *from, Promise *p); 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 *); + HashTable * discovered; /** @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;