if ( func_inst_map.contains(position) ) {
FuncInst * inst = func_inst_map.get(position);
+ /* TODO: The assertion fails when encountering volatile variables that use ++ or -- syntax, i.e. read and write have the same position */
ASSERT(inst->get_type() == act->get_type());
int curr_execution_number = model->get_execution_number();
inst_id_map.put(next_inst, inst_counter++);
it = it->getNext();
- /*-- curr_pred->incr_expl_count(); */
+ curr_pred->incr_expl_count();
}
curr_pred->set_exit(predicate_tree_exit);
#include "hashfunction.h"
-/* Hash function for 64-bit integers */
+/**
+ * Hash function for 64-bit integers
+ * https://gist.github.com/badboy/6267743#64-bit-to-32-bit-hash-functions
+ */
unsigned int int64_hash(uint64_t key) {
key = (~key) + (key << 18); // key = (key << 18) - key - 1;
key = key ^ (key >> 31);
exit_predicate(is_exit),
does_write(false),
exploration_count(0),
- failure_count(0),
- sleep_score(100),
+ store_visible_count(0),
+ total_checking_count(0),
pred_expressions(16),
children(),
parent(NULL),
return concrete;
}
-void Predicate::incr_expl_count()
-{
- exploration_count++;
-}
-
-void Predicate::incr_fail_count()
-{
- failure_count++;
-}
-
-void Predicate::incr_sleep_score(uint32_t amount)
-{
- if (sleep_score + amount > 100)
- sleep_score = 100;
- else
- sleep_score += amount;
-}
-
-void Predicate::decr_sleep_score(uint32_t amount)
-{
- if (sleep_score > amount)
- sleep_score -= amount;
- else
- sleep_score = 0;
-}
-
void Predicate::print_predicate()
{
model_print("\"%p\" [shape=box, label=\"\n", this);
if (does_write) {
model_print("Does write\n");
}
- model_print("Count: %d, failed count: %d\n", exploration_count, failure_count);
+
+ double prob = (double) store_visible_count / total_checking_count;
+ model_print("Total checks: %d, visible count: %d; prob: %f\n", total_checking_count, store_visible_count, prob);
+ model_print("Exploration count: %d", exploration_count);
model_print("\"];\n");
}
ConcretePredicate * evaluate(inst_act_map_t * inst_act_map, thread_id_t tid);
uint32_t get_expl_count() { return exploration_count; }
- uint32_t get_fail_count() { return failure_count; }
- uint32_t get_sleep_score() { return sleep_score; }
- void incr_expl_count();
- void incr_fail_count();
- void incr_sleep_score(uint32_t amount);
- void decr_sleep_score(uint32_t amount);
+ uint32_t get_store_visible_count() { return store_visible_count; }
+ uint32_t get_total_checking_count() { return total_checking_count; }
+
+ void incr_expl_count() { exploration_count++; }
+ void incr_store_visible_count() { store_visible_count++; }
+ void incr_total_checking_count() { total_checking_count++; }
void print_predicate();
void print_pred_subtree();
bool does_write;
uint32_t exploration_count;
- uint32_t failure_count;
- uint32_t sleep_score; /* 0 <= sleep_score <= 100 */
+ uint32_t store_visible_count;
+ uint32_t total_checking_count; /* The number of times the store visibility is checked */
/* May have multiple predicate expressions */
PredExprSet pred_expressions;