This fixes a potential bug, in which a write could merge with a
different promised value. It's unclear whether this ever manifested
itself, since I believe we had some implicit logic that would ensure
that this did not happen.
ASSERT(p_node->is_promise());
const Promise *promise = p_node->getPromise();
- if (!promise->is_compatible(w_node->getAction())) {
+ if (!promise->is_compatible(w_node->getAction()) ||
+ !promise->same_value(w_node->getAction())) {
hasCycles = true;
return false;
}
{
for (unsigned int i = 0; i < promises->size(); i++) {
Promise *promise = (*promises)[i];
- if (!promise->is_compatible(curr) || promise->get_value() != curr->get_value())
+ if (!promise->is_compatible(curr) || !promise->same_value(curr))
continue;
bool satisfy = true;
return get_num_available_threads() == 1 && is_compatible(act);
}
+/**
+ * @brief Check if a store's value matches this Promise
+ * @param write The store to check
+ * @return True if the store's written value matches this Promise
+ */
+bool Promise::same_value(const ModelAction *write) const
+{
+ return get_value() == write->get_write_value();
+}
+
/**
* @brief Check if a ModelAction's location matches this Promise
* @param act The ModelAction to check
int get_num_available_threads() const { return num_available_threads; }
bool is_compatible(const ModelAction *act) const;
bool is_compatible_exclusive(const ModelAction *act) const;
+ bool same_value(const ModelAction *write) const;
bool same_location(const ModelAction *act) const;
modelclock_t get_expiration() const { return fv.expiration; }