thrd_loc_inst_map(),
thrd_predicate_tree_position(),
thrd_predicate_trace(),
- predicate_leaves(),
- leaves_tmp_storage(),
failed_predicates(),
edge_table(32),
out_edges()
add_predicate_to_trace(tid, curr_pred);
break;
}
-
-// leaves_tmp_storage.push_back(curr_pred);
}
/* Given curr_pred and next_inst, find the branch following curr_pred that
curr_pred->add_child(new_pred);
new_pred->set_parent(curr_pred);
- /* Maintain predicate leaves */
- predicate_leaves.add(new_pred);
- predicate_leaves.remove(curr_pred);
-
/* entry predicates and predicates containing pure write actions
* have no predicate expressions */
if ( curr_pred->is_entry_predicate() )
Predicate * pred= predicates[i];
curr_pred->add_child(pred);
pred->set_parent(curr_pred);
-
- /* Add new predicate leaves */
- predicate_leaves.add(pred);
}
- /* Remove predicate node that has children */
- predicate_leaves.remove(curr_pred);
-
/* Free memories allocated by infer_predicate */
for (uint i = 0;i < half_pred_expressions->size();i++) {
struct half_pred_expr * tmp = (*half_pred_expressions)[i];
failed_predicates.add(pred);
}
-/* Implement quick sort to sort leaves before assigning base scores */
-template<typename _Tp>
-static int partition(ModelVector<_Tp *> * arr, int low, int high)
-{
- unsigned int pivot = (*arr)[high] -> get_depth();
- int i = low - 1;
-
- for (int j = low;j <= high - 1;j ++) {
- if ( (*arr)[j] -> get_depth() < pivot ) {
- i ++;
- _Tp * tmp = (*arr)[i];
- (*arr)[i] = (*arr)[j];
- (*arr)[j] = tmp;
- }
- }
-
- _Tp * tmp = (*arr)[i + 1];
- (*arr)[i + 1] = (*arr)[high];
- (*arr)[high] = tmp;
-
- return i + 1;
-}
-
-/* Implement quick sort to sort leaves before assigning base scores */
-template<typename _Tp>
-static void quickSort(ModelVector<_Tp *> * arr, int low, int high)
-{
- if (low < high) {
- int pi = partition(arr, low, high);
-
- quickSort(arr, low, pi - 1);
- quickSort(arr, pi + 1, high);
- }
-}
-
void FuncNode::update_predicate_tree_weight(thread_id_t tid)
{
failed_predicates.reset();
// Update predicate weights based on prediate trace
for (mllnode<Predicate *> * rit = trace->end(); rit != NULL; rit = rit->getPrev()) {
Predicate * node = rit->getVal();
+ ModelVector<Predicate *> * children = node->get_children();
- if (predicate_leaves.contains(node)) {
+ if (children->size() == 0) {
double weight = 100.0 / sqrt(node->get_expl_count() + node->get_fail_count() + 1);
node->set_weight(weight);
} else {
double weight_sum = 0.0;
- ModelVector<Predicate *> * children = node->get_children();
for (uint i = 0;i < children->size();i++) {
Predicate * child = (*children)[i];
double weight = child->get_weight();
#define MAX_DIST 10
typedef ModelList<FuncInst *> func_inst_list_mt;
+typedef ModelList<Predicate *> predicate_trace_t;
+
typedef HashTable<void *, FuncInst *, uintptr_t, 0, model_malloc, model_calloc, model_free> loc_inst_map_t;
typedef HashTable<FuncInst *, uint32_t, uintptr_t, 0, model_malloc, model_calloc, model_free> inst_id_map_t;
typedef HashTable<FuncInst *, Predicate *, uintptr_t, 0, model_malloc, model_calloc, model_free> inst_pred_map_t;
-typedef ModelList<Predicate *> predicate_trace_t;
-
typedef enum edge_type {
IN_EDGE, OUT_EDGE, BI_EDGE
} edge_type_t;
void init_predicate_tree_data_structure(thread_id_t tid);
void reset_predicate_tree_data_structure(thread_id_t tid);
- PredSet predicate_leaves;
- ModelVector<Predicate *> leaves_tmp_storage;
PredSet failed_predicates;
/* Store the relation between this FuncNode and other FuncNodes */