From: Brian Norris Date: Thu, 6 Jun 2013 00:25:30 +0000 (-0700) Subject: execution: remove redundant condition, reword doc for promises_may_allow X-Git-Tag: oopsla2013-final~7 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=f92474f04a6e57df48c91a4c9e38f31cff153f39;hp=1f817417cb820f356fb2afa7ac9e18d7ef054198;ds=sidebyside execution: remove redundant condition, reword doc for promises_may_allow promises_may_allow() doesn't actually need to check for promises.empty(), as the loop bounds take care of that. In the same spirit, we can reword the comments/documentation so that (1) it is not redundant (condition (a) is subsumed by (b)) (2) we are more explicit about what we actually mean by "crossing promises" --- diff --git a/execution.cc b/execution.cc index e04b672..53aa521 100644 --- a/execution.cc +++ b/execution.cc @@ -755,12 +755,13 @@ bool ModelExecution::process_mutex(ModelAction *curr) /** * @brief Check if the current pending promises allow a future value to be sent * - * If one of the following is true: - * (a) there are no pending promises - * (b) the reader and writer do not cross any promises - * Then, it is safe to pass a future value back now. + * It is unsafe to pass a future value back if there exists a pending promise Pr + * such that: * - * Otherwise, we must save the pending future value until (a) or (b) is true + * reader --exec-> Pr --exec-> writer + * + * If such Pr exists, we must save the pending future value until Pr is + * resolved. * * @param writer The operation which sends the future value. Must be a write. * @param reader The operation which will observe the value. Must be a read. @@ -769,8 +770,6 @@ bool ModelExecution::process_mutex(ModelAction *curr) bool ModelExecution::promises_may_allow(const ModelAction *writer, const ModelAction *reader) const { - if (promises.empty()) - return true; for (int i = promises.size() - 1; i >= 0; i--) { ModelAction *pr = promises[i]->get_reader(0); //reader is after promise...doesn't cross any promise