experiment with exponential decay model
[c11tester.git] / predicate.h
index 5c634fbccf8c7938e286b0c7005419847222f485..0512835f6aadfbcab4ce7689dfd3e43ce689a863 100644 (file)
@@ -5,6 +5,8 @@
 #include "predicatetypes.h"
 #include "classlist.h"
 
+#define MAX_DEPTH 0x7fffffff
+
 unsigned int pred_expr_hash (struct pred_expr *);
 bool pred_expr_equal(struct pred_expr *, struct pred_expr *);
 typedef HashSet<struct pred_expr *, uintptr_t, 0, model_malloc, model_calloc, model_free, pred_expr_hash, pred_expr_equal> PredExprSet;
@@ -20,19 +22,25 @@ public:
 
        void add_predicate_expr(token_t token, FuncInst * func_inst, bool value);
        void add_child(Predicate * child);
-       void set_parent(Predicate * parent_pred) { parent = parent_pred; }
-       void set_exit(Predicate * exit_pred) { exit = exit_pred; }
+       void set_parent(Predicate * parent_pred);
+       void set_exit(Predicate * exit_pred);
        void add_backedge(Predicate * back_pred) { backedges.add(back_pred); }
+       void set_weight(double weight_) { weight = weight_; }
        void copy_predicate_expr(Predicate * other);
 
+       Predicate * get_single_child(FuncInst * inst);
        ModelVector<Predicate *> * get_children() { return &children; }
        Predicate * get_parent() { return parent; }
        Predicate * get_exit() { return exit; }
        PredSet * get_backedges() { return &backedges; }
+       double get_weight() { return weight; }
 
        bool is_entry_predicate() { return entry_predicate; }
        void set_entry_predicate() { entry_predicate = true; }
 
+       void alloc_pre_exit_predicates();
+       void add_pre_exit_predicate(Predicate * pred);
+
        /* Whether func_inst does write or not */
        bool is_write() { return does_write; }
        void set_write(bool is_write) { does_write = is_write; }
@@ -40,12 +48,15 @@ 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++; }
+
+       uint32_t get_depth() { return depth; }
+       void set_depth(uint32_t depth_) { depth = depth_; }
 
        void print_predicate();
        void print_pred_subtree();
@@ -57,9 +68,13 @@ private:
        bool exit_predicate;
        bool does_write;
 
+       /* Height of this predicate node in the predicate tree */
+       uint32_t depth;
+       double weight;
+
        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;
@@ -69,8 +84,11 @@ private:
        Predicate * parent;
        Predicate * exit;
 
+       /* Predicates precede exit nodes. Only used by exit predicates */
+       ModelVector<Predicate *> * pre_exit_predicates;
+
        /* May have multiple back edges, e.g. nested loops */
        PredSet backedges;
 };
 
-#endif /* __PREDICATE_H__ */
+#endif /* __PREDICATE_H__ */