#include "common.h"
#include "promise.h"
#include "model.h"
+#include "threads-model.h"
/** Initializes a CycleGraph object. */
CycleGraph::CycleGraph() :
*/
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);