From: weiyu Date: Wed, 23 Oct 2019 00:29:49 +0000 (-0700) Subject: Some edits X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=c8317c89922bd9555038498b363cf1574e14286f Some edits --- diff --git a/funcnode.cc b/funcnode.cc index c739a284..2972b86e 100644 --- a/funcnode.cc +++ b/funcnode.cc @@ -64,6 +64,7 @@ void FuncNode::add_inst(ModelAction *act) 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(); @@ -306,7 +307,7 @@ void FuncNode::update_predicate_tree(action_list_t * act_list) 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); diff --git a/hashfunction.cc b/hashfunction.cc index eca9cafa..b41dc032 100644 --- a/hashfunction.cc +++ b/hashfunction.cc @@ -1,6 +1,9 @@ #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); diff --git a/predicate.cc b/predicate.cc index ab64a34e..51b216dd 100644 --- a/predicate.cc +++ b/predicate.cc @@ -8,8 +8,8 @@ Predicate::Predicate(FuncInst * func_inst, bool is_entry, bool is_exit) : 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), @@ -98,32 +98,6 @@ ConcretePredicate * Predicate::evaluate(inst_act_map_t * inst_act_map, thread_id 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); @@ -164,7 +138,10 @@ void Predicate::print_predicate() 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"); } diff --git a/predicate.h b/predicate.h index 5c634fbc..3e1867fd 100644 --- a/predicate.h +++ b/predicate.h @@ -40,12 +40,12 @@ public: 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(); @@ -58,8 +58,8 @@ private: 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;