X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=nodestack.cc;h=6b1d4ef9c86929fdd14d14172149abaacec96133;hp=378dd8f4eebf3a5636a6203edd4eb4f381252343;hb=6f8de9e0f5697652fd20b2ecf149f96bfb572538;hpb=20d006a8c581117c6636e835cdbe36dac5d6ef93 diff --git a/nodestack.cc b/nodestack.cc index 378dd8f4..6b1d4ef9 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -4,6 +4,7 @@ #include "action.h" #include "common.h" #include "model.h" +#include "threads.h" /** * @brief Node constructor @@ -77,7 +78,7 @@ Node::~Node() if (action) delete action; if (enabled_array) - MYFREE(enabled_array); + model_free(enabled_array); } /** Prints debugging info for the ModelAction associated with this Node */ @@ -121,6 +122,8 @@ bool Node::get_promise(unsigned int i) { * @return true if we have a valid combination. */ bool Node::increment_promise() { + DBG(); + for (unsigned int i = 0; i < promises.size(); i++) { if (promises[i] == PROMISE_UNFULFILLED) { promises[i] = PROMISE_FULFILLED; @@ -156,7 +159,7 @@ bool Node::add_future_value(uint64_t value, modelclock_t expiration) { if (future_values[i].value == value) { if (future_values[i].expiration>=expiration) return false; - if (future_index < i) { + if (future_index < ((int) i)) { suitableindex=i; } } @@ -176,7 +179,7 @@ bool Node::add_future_value(uint64_t value, modelclock_t expiration) { * @return true if the future_values set is empty. */ bool Node::future_value_empty() { - return ((future_index + 1) >= future_values.size()); + return ((future_index + 1) >= ((int)future_values.size())); } /** @@ -216,7 +219,7 @@ bool Node::read_from_empty() { void Node::explore_child(ModelAction *act, bool * is_enabled) { if ( ! enabled_array ) - enabled_array=(bool *)MYMALLOC(sizeof(bool)*num_threads); + enabled_array=(bool *)model_malloc(sizeof(bool)*num_threads); if (is_enabled != NULL) memcpy(enabled_array, is_enabled, sizeof(bool)*num_threads); else { @@ -271,6 +274,11 @@ bool Node::is_enabled(thread_id_t tid) return thread_id < num_threads && enabled_array[thread_id]; } +bool Node::has_priority(thread_id_t tid) +{ + return fairness[id_to_int(tid)].priority; +} + /** * Add an action to the may_read_from set. * @param act is the action to add @@ -286,12 +294,12 @@ void Node::add_read_from(const ModelAction *act) * @return The first element in future_values */ uint64_t Node::get_future_value() { - ASSERT(future_index