* Sets a promise to explore meeting with the given node.
* @param i is the promise index.
*/
-void Node::set_promise(unsigned int i) {
+void Node::set_promise(unsigned int i, bool is_rmw) {
if (i >= promises.size())
promises.resize(i + 1, PROMISE_IGNORE);
- if (promises[i] == PROMISE_IGNORE)
+ if (promises[i] == PROMISE_IGNORE) {
promises[i] = PROMISE_UNFULFILLED;
+ if (is_rmw)
+ promises[i] |= PROMISE_RMW;
+ }
}
/**
* @return true if the promise should be satisfied by the given model action.
*/
bool Node::get_promise(unsigned int i) {
- return (i < promises.size()) && (promises[i] == PROMISE_FULFILLED);
+ return (i < promises.size()) && ((promises[i] & PROMISE_MASK) == PROMISE_FULFILLED);
}
/**
*/
bool Node::increment_promise() {
DBG();
-
+ unsigned int rmw_count=0;
for (unsigned int i = 0; i < promises.size(); i++) {
- if (promises[i] == PROMISE_UNFULFILLED) {
- promises[i] = PROMISE_FULFILLED;
+ if (promises[i]==(PROMISE_RMW|PROMISE_FULFILLED))
+ rmw_count++;
+ }
+
+ for (unsigned int i = 0; i < promises.size(); i++) {
+ if ((promises[i] & PROMISE_MASK) == PROMISE_UNFULFILLED) {
+ if ((rmw_count > 0) && (promises[i] & PROMISE_RMW)) {
+ //sending our value to two rmws... not going to work..try next combination
+ continue;
+ }
+ promises[i] = (promises[i] & PROMISE_RMW) |PROMISE_FULFILLED;
while (i > 0) {
i--;
- if (promises[i] == PROMISE_FULFILLED)
- promises[i] = PROMISE_UNFULFILLED;
+ if ((promises[i] & PROMISE_MASK) == PROMISE_FULFILLED)
+ promises[i] = (promises[i] & PROMISE_RMW) | PROMISE_UNFULFILLED;
}
return true;
+ } else if (promises[i] == (PROMISE_RMW|PROMISE_FULFILLED)) {
+ rmw_count--;
}
}
return false;
* @return true if we have explored all promise combinations.
*/
bool Node::promise_empty() {
- for (unsigned int i = 0; i < promises.size();i++)
- if (promises[i] == PROMISE_UNFULFILLED)
+ unsigned int rmw_count=0;
+ for (unsigned int i = 0; i < promises.size(); i++) {
+ if (promises[i]==(PROMISE_RMW|PROMISE_FULFILLED))
+ rmw_count++;
+ }
+
+ for (unsigned int i = 0; i < promises.size();i++) {
+ if ((promises[i]& PROMISE_MASK) == PROMISE_UNFULFILLED) {
+ //if this isn't a feasible option, keep going
+ if ((rmw_count > 0)&&(promises[i] & PROMISE_RMW))
+ continue;
return false;
+ } else if (promises[i] == (PROMISE_RMW|PROMISE_FULFILLED)) {
+ rmw_count--;
+ }
+ }
return true;
}
* <li>@b fulfilled: satisfied by this Node's ModelAction under the current
* configuration.</li></ol>
*/
-typedef enum {
- PROMISE_IGNORE = 0, /**< This promise is inapplicable; ignore it */
- PROMISE_UNFULFILLED, /**< This promise is applicable but unfulfilled */
- PROMISE_FULFILLED /**< This promise is applicable and fulfilled */
-} promise_t;
+
+#define PROMISE_IGNORE 0 /**< This promise is inapplicable; ignore it */
+#define PROMISE_UNFULFILLED 1 /**< This promise is applicable but unfulfilled */
+#define PROMISE_FULFILLED 2 /**< This promise is applicable and fulfilled */
+#define PROMISE_MASK 0xf
+#define PROMISE_RMW 0x10
+
+typedef int promise_t;
struct future_value {
uint64_t value;
int get_read_from_size();
const ModelAction * get_read_from_at(int i);
- void set_promise(unsigned int i);
+ void set_promise(unsigned int i, bool is_rmw);
bool get_promise(unsigned int i);
bool increment_promise();
bool promise_empty();