X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cyclegraph.h;h=a2cb93d7ca702217be5af879cbf0c2ba34f9a67e;hb=284151d644be0946f887561a03344866f0665c03;hp=fcaa21365a6c6e5434c2f9a468e6d041036aab19;hpb=fbacb5f41ada96e7b539ccc41deccb1a7e1a1ba8;p=model-checker.git diff --git a/cyclegraph.h b/cyclegraph.h index fcaa213..a2cb93d 100644 --- a/cyclegraph.h +++ b/cyclegraph.h @@ -9,9 +9,11 @@ #ifndef __CYCLEGRAPH_H__ #define __CYCLEGRAPH_H__ -#include "hashtable.h" #include #include +#include + +#include "hashtable.h" #include "config.h" #include "mymemory.h" @@ -36,8 +38,8 @@ class CycleGraph { bool checkForCycles() const; bool checkPromise(const ModelAction *from, Promise *p) const; - template - bool checkReachable(const ModelAction *from, const T *to) const; + template + bool checkReachable(const T *from, const U *to) const; void startChanges(); void commitChanges(); @@ -45,15 +47,21 @@ class CycleGraph { #if SUPPORT_MOD_ORDER_DUMP void dumpNodes(FILE *file) const; void dumpGraphToFile(const char *filename) const; + + void dot_print_node(FILE *file, const ModelAction *act); + template + void dot_print_edge(FILE *file, const T *from, const U *to, const char *prop); #endif - bool resolvePromise(ModelAction *reader, ModelAction *writer, + bool resolvePromise(const Promise *promise, ModelAction *writer, promise_list_t *mustResolve); SNAPSHOTALLOC private: bool addNodeEdge(CycleNode *fromnode, CycleNode *tonode); void putNode(const ModelAction *act, CycleNode *node); + void putNode(const Promise *promise, CycleNode *node); + void erasePromiseNode(const Promise *promise); CycleNode * getNode(const ModelAction *act); CycleNode * getNode(const Promise *promise); CycleNode * getNode_noCreate(const ModelAction *act) const; @@ -65,12 +73,11 @@ class CycleGraph { /** @brief A table for mapping ModelActions to CycleNodes */ HashTable actionToNode; - /** @brief A table for mapping reader ModelActions to Promise - * CycleNodes */ - HashTable readerToPromiseNode; + /** @brief A table for mapping Promises to CycleNodes */ + HashTable promiseToNode; #if SUPPORT_MOD_ORDER_DUMP - std::vector nodeList; + std::vector< CycleNode *, SnapshotAlloc > nodeList; #endif bool checkReachable(const CycleNode *from, const CycleNode *to) const;