hash ^= reads_from->get_seq_number();
return hash;
}
+
+/**
+ * @brief Checks the NodeStack to see if a ModelAction is in our may-read-from set
+ * @param write The ModelAction to check for
+ * @return True if the ModelAction is found; false otherwise
+ */
+bool ModelAction::may_read_from(const ModelAction *write) const
+{
+ for (int i = 0; i < node->get_read_from_past_size(); i++)
+ if (node->get_read_from_past(i) == write)
+ return true;
+ return false;
+}
+
+/**
+ * @brief Checks the NodeStack to see if a Promise is in our may-read-from set
+ * @param promise The Promise to check for
+ * @return True if the Promise is found; false otherwise
+ */
+bool ModelAction::may_read_from(const Promise *promise) const
+{
+ for (int i = 0; i < node->get_read_from_promise_size(); i++)
+ if (node->get_read_from_promise(i) == promise)
+ return true;
+ return false;
+}
bool equals(const ModelAction *x) const { return this == x; }
bool equals(const Promise *x) const { return false; }
+
+ bool may_read_from(const ModelAction *write) const;
+ bool may_read_from(const Promise *promise) const;
MEMALLOC
private:
bool feasiblewrite = true;
/* now we need to see if this write works for everyone */
-
for (int loop = params.maxreads; loop > 0; loop--, ritcopy++) {
ModelAction *act = *ritcopy;
- bool foundvalue = false;
- for (int j = 0; j < act->get_node()->get_read_from_past_size(); j++) {
- if (act->get_node()->get_read_from_past(j) == write) {
- foundvalue = true;
- break;
- }
- }
- if (!foundvalue) {
+ if (!act->may_read_from(write)) {
feasiblewrite = false;
break;
}