From: Brian Norris Date: Sun, 4 Nov 2012 02:39:33 +0000 (-0700) Subject: nodestack: limit the number of future values per read X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=9e4f7e812e1e6e8cdb4df00add7199288dc30c04 nodestack: limit the number of future values per read Not tested very thoroughly, but it seems to limit the future values set as intended. --- diff --git a/nodestack.cc b/nodestack.cc index 743cb864..f73d4cf4 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -192,8 +192,13 @@ bool Node::misc_empty() { /** - * Adds a value from a weakly ordered future write to backtrack to. + * Adds a value from a weakly ordered future write to backtrack to. This + * operation may "fail" if the future value is already set (with a later + * expiration), or if the futurevalues set has reached its maximum. + * @see model_params.maxfuturevalues + * * @param value is the value to backtrack to. + * @return True if the future value was successully added; false otherwise */ bool Node::add_future_value(uint64_t value, modelclock_t expiration) { int suitableindex=-1; @@ -211,7 +216,12 @@ bool Node::add_future_value(uint64_t value, modelclock_t expiration) { future_values[suitableindex].expiration=expiration; return true; } - struct future_value newfv={value, expiration}; + + if (model->params.maxfuturevalues > 0 && + (int)future_values.size() >= model->params.maxfuturevalues) + return false; + + struct future_value newfv = {value, expiration}; future_values.push_back(newfv); return true; }