Remove unused code
authorweiyu <weiyuluo1232@gmail.com>
Thu, 5 Dec 2019 00:31:31 +0000 (16:31 -0800)
committerweiyu <weiyuluo1232@gmail.com>
Thu, 5 Dec 2019 00:31:31 +0000 (16:31 -0800)
funcnode.cc
newfuzzer.cc

index e5279bd1fd72598642be43265d4fe039cbd744ba..c1b277e8f26f2a57936a88fbe37e6f7a954104d0 100644 (file)
@@ -21,6 +21,7 @@ FuncNode::FuncNode(ModelHistory * history) :
        predicate_tree_entry = new Predicate(NULL, true);
        predicate_tree_entry->add_predicate_expr(NOPREDICATE, NULL, true);
        predicate_tree_exit = new Predicate(NULL, false, true);
+       predicate_tree_exit->set_depth(MAX_DEPTH);
 
        /* Snapshot data structures below */
        action_list_buffer = new SnapList<action_list_t *>();
index 4ea4dd99b6f14ef8c7a0c49bb6447f9c86de0979..2b4ebfd43019ea8853964666c2e47f79eeff3957 100644 (file)
@@ -78,6 +78,8 @@ int NewFuzzer::selectWrite(ModelAction *read, SnapVector<ModelAction *> * rf_set
 
                thrd_last_read_act[thread_id] = read;
                thrd_last_func_inst[thread_id] = read_inst;
+
+               ASSERT(rf_set->size() != 0);
        }
 
        // No write satisfies the selected predicate, so pause this thread.
@@ -198,51 +200,11 @@ Predicate * NewFuzzer::selectBranch(thread_id_t tid, Predicate * curr_pred, Func
 }
 
 /**
- * @brief Select a branch from the given predicate branches based
- * on their exploration counts.
- *
- * Let b_1, ..., b_n be branches with exploration counts c_1, ..., c_n
- * M := max(c_1, ..., c_n) + 1
- * Factor f_i := M / (c_i + 1)
- * The probability p_i that branch b_i is selected:
- *     p_i := f_i / (f_1 + ... + f_n)
- *          = \fraction{ 1/(c_i + 1) }{ 1/(c_1 + 1) + ... + 1/(c_n + 1) }
- *
- * Note: (1) c_i + 1 is used because counts may be 0.
- *      (2) The numerator of f_i is chosen to reduce the effect of underflow
- *
- * @param numerator is M defined above
+ * @brief Select a branch from the given predicate branch
  */
 int NewFuzzer::choose_index(SnapVector<Predicate *> * branches, uint32_t numerator)
 {
        return random() % branches->size();
-/*--
-        if (branches->size() == 1)
-                return 0;
-
-        double total_factor = 0;
-        SnapVector<double> factors = SnapVector<double>( branches->size() + 1 );
-        for (uint i = 0; i < branches->size(); i++) {
-                Predicate * branch = (*branches)[i];
-                double factor = (double) numerator / (branch->get_expl_count() + 5 * branch->get_fail_count() + 1);
-                total_factor += factor;
-                factors.push_back(factor);
-        }
-
-        double prob = (double) random() / RAND_MAX;
-        double prob_sum = 0;
-        int index = 0;
-
-        for (uint i = 0; i < factors.size(); i++) {
-                index = i;
-                prob_sum += (double) (factors[i] / total_factor);
-                if (prob_sum > prob) {
-                        break;
-                }
-        }
-
-        return index;
- */
 }
 
 Predicate * NewFuzzer::get_selected_child_branch(thread_id_t tid)