Add failed predicates to predicate trace; remove unused codes
authorweiyu <weiyuluo1232@gmail.com>
Wed, 19 Feb 2020 00:56:59 +0000 (16:56 -0800)
committerweiyu <weiyuluo1232@gmail.com>
Wed, 19 Feb 2020 00:56:59 +0000 (16:56 -0800)
history.cc
newfuzzer.cc
predicate.cc

index 7fab503bc48e5056f4ec68ae260bfb35e73b9ebd..19354d7475e171749ed4fc413f8e67c289181047 100644 (file)
@@ -147,21 +147,6 @@ void ModelHistory::process_action(ModelAction *act, thread_id_t tid)
        FuncNode * func_node = func_nodes[func_id];
        func_node->add_inst(act);
 
-       if (act->is_read()) {
-               // Do nothing
-       } else if (act->is_write()) {
-               /*
-               Predicate * curr_pred = func_node->get_predicate_tree_position(tid);
-               FuncInst * curr_inst = func_node->get_inst(act);
-
-               if (curr_pred) {
-                       // Follow child
-                       curr_pred = curr_pred->follow_write_child(curr_inst);
-               }
-               func_node->set_predicate_tree_position(tid, curr_pred);
-               */
-       }
-
        func_node->update_tree(act);
        last_action = act;
 }
index be483886bdcde90b5b878cdebd0dcf17c19b115a..da10e864c2c1776a09718893ad82939935e675b5 100644 (file)
@@ -91,6 +91,7 @@ int NewFuzzer::selectWrite(ModelAction *read, SnapVector<ModelAction *> * rf_set
 
                // Increment failure count
                selected_branch->incr_fail_count();
+               func_node->add_predicate_to_trace(tid, selected_branch);        // For updating predicate weight
 
                //model_print("the %d read action of thread %d at %p is unsuccessful\n", read->get_seq_number(), read_thread->get_id(), read->get_location());
 
index 9b329f105cb9e9b8169a1c8b770ee857b11f5207..0028cf170c064b5cecb34edd579aaa4f14fbe058 100644 (file)
@@ -80,25 +80,6 @@ void Predicate::copy_predicate_expr(Predicate * other)
        delete it;
 }
 
-/* Follow the child if any child whose FuncInst matches with inst
- *
- * @param inst must be an ATOMIC_WRITE FuncInst
- * @return NULL if no such child is found.
- */
-Predicate * Predicate::follow_write_child(FuncInst * inst)
-{
-       action_type type = inst->get_type();
-       ASSERT(type == ATOMIC_WRITE || type == ATOMIC_INIT);
-
-       for (uint i = 0;i < children.size();i++) {
-               Predicate * child = children[i];
-               if (child->get_func_inst() == inst)
-                       return child;
-       }
-
-       return NULL;
-}
-
 /* Evaluate predicate expressions against the given inst_act_map */
 ConcretePredicate * Predicate::evaluate(thread_id_t tid)
 {