*/
void CycleGraph::putNode(const Promise *promise, CycleNode *node)
{
- const ModelAction *reader = promise->get_action();
- readerToPromiseNode.put(reader, node);
+ promiseToNode.put(promise, node);
#if SUPPORT_MOD_ORDER_DUMP
nodeList.push_back(node);
#endif
*/
void CycleGraph::erasePromiseNode(const Promise *promise)
{
- const ModelAction *reader = promise->get_action();
- readerToPromiseNode.put(reader, NULL);
+ promiseToNode.put(promise, NULL);
#if SUPPORT_MOD_ORDER_DUMP
/* Remove the promise node from nodeList */
CycleNode *node = getNode_noCreate(promise);
/** @return The corresponding CycleNode, if exists; otherwise NULL */
CycleNode * CycleGraph::getNode_noCreate(const Promise *promise) const
{
- return readerToPromiseNode.get(promise->get_action());
+ return promiseToNode.get(promise);
}
/**
/**
* @return false if the resolution results in a cycle; true otherwise
*/
-bool CycleGraph::resolvePromise(ModelAction *reader, ModelAction *writer,
+bool CycleGraph::resolvePromise(const Promise *promise, ModelAction *writer,
promise_list_t *mustResolve)
{
- CycleNode *promise_node = readerToPromiseNode.get(reader);
+ CycleNode *promise_node = promiseToNode.get(promise);
CycleNode *w_node = actionToNode.get(writer);
ASSERT(promise_node);
void dumpGraphToFile(const char *filename) const;
#endif
- bool resolvePromise(ModelAction *reader, ModelAction *writer,
+ bool resolvePromise(const Promise *promise, ModelAction *writer,
promise_list_t *mustResolve);
SNAPSHOTALLOC
/** @brief A table for mapping ModelActions to CycleNodes */
HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> actionToNode;
- /** @brief A table for mapping reader ModelActions to Promise
- * CycleNodes */
- HashTable<const ModelAction *, CycleNode *, uintptr_t, 4> readerToPromiseNode;
+ /** @brief A table for mapping Promises to CycleNodes */
+ HashTable<const Promise *, CycleNode *, uintptr_t, 4> promiseToNode;
#if SUPPORT_MOD_ORDER_DUMP
std::vector<CycleNode *> nodeList;
read_from(read, write);
//Make sure the promise's value matches the write's value
ASSERT(promise->is_compatible(write));
- mo_graph->resolvePromise(read, write, &mustResolve);
+ mo_graph->resolvePromise(promise, write, &mustResolve);
resolved.push_back(promise);
promises->erase(promises->begin() + promise_index);