Tabbing
authorweiyu <weiyuluo1232@gmail.com>
Wed, 4 Dec 2019 20:32:49 +0000 (12:32 -0800)
committerweiyu <weiyuluo1232@gmail.com>
Wed, 4 Dec 2019 20:32:49 +0000 (12:32 -0800)
funcnode.cc
funcnode.h
history.cc

index 2a25bfb..e5279bd 100644 (file)
@@ -342,7 +342,7 @@ void FuncNode::update_predicate_tree(action_list_t * act_list)
  * @return true if branch found, false otherwise.
  */
 bool FuncNode::follow_branch(Predicate ** curr_pred, FuncInst * next_inst,
-                                                                                                                ModelAction * next_act, SnapVector<Predicate *> * unset_predicates)
+ModelAction * next_act, SnapVector<Predicate *> * unset_predicates)
 {
        /* Check if a branch with func_inst and corresponding predicate exists */
        bool branch_found = false;
@@ -369,33 +369,34 @@ bool FuncNode::follow_branch(Predicate ** curr_pred, FuncInst * next_inst,
                        bool equality;
 
                        switch(pred_expression->token) {
-                       case NOPREDICATE:
-                               predicate_correct = true;
-                               break;
-                       case EQUALITY:
-                               FuncInst * to_be_compared;
-                               ModelAction * last_act;
-
-                               to_be_compared = pred_expression->func_inst;
-                               last_act = to_be_compared->get_associated_act(marker);
-
-                               last_read = last_act->get_reads_from_value();
-                               next_read = next_act->get_reads_from_value();
-                               equality = (last_read == next_read);
-                               if (equality != pred_expression->value)
+                               case NOPREDICATE:
+                                       predicate_correct = true;
+                                       break;
+                               case EQUALITY:
+                                       FuncInst * to_be_compared;
+                                       ModelAction * last_act;
+
+                                       to_be_compared = pred_expression->func_inst;
+                                       last_act = to_be_compared->get_associated_act(marker);
+
+                                       last_read = last_act->get_reads_from_value();
+                                       next_read = next_act->get_reads_from_value();
+                                       equality = (last_read == next_read);
+                                       if (equality != pred_expression->value)
+                                               predicate_correct = false;
+
+                                       break;
+                               case NULLITY:
+                                       next_read = next_act->get_reads_from_value();
+                                       // TODO: implement likely to be null
+                                       equality = ( (void*) (next_read & 0xffffffff) == NULL);
+                                       if (equality != pred_expression->value)
+                                               predicate_correct = false;
+                                       break;
+                               default:
                                        predicate_correct = false;
-
-                               break;
-                       case NULLITY:
-                               next_read = next_act->get_reads_from_value();
-                               equality = ((void*)next_read == NULL);
-                               if (equality != pred_expression->value)
-                                       predicate_correct = false;
-                               break;
-                       default:
-                               predicate_correct = false;
-                               model_print("unkown predicate token\n");
-                               break;
+                                       model_print("unkown predicate token\n");
+                                       break;
                        }
                }
 
@@ -411,8 +412,8 @@ bool FuncNode::follow_branch(Predicate ** curr_pred, FuncInst * next_inst,
 
 /* Infer predicate expressions, which are generated in FuncNode::generate_predicates */
 void FuncNode::infer_predicates(FuncInst * next_inst, ModelAction * next_act,
-                                                                                                                               HashTable<void *, ModelAction *, uintptr_t, 0> * loc_act_map,
-                                                                                                                               SnapVector<struct half_pred_expr *> * half_pred_expressions)
+HashTable<void *, ModelAction *, uintptr_t, 0> * loc_act_map,
+SnapVector<struct half_pred_expr *> * half_pred_expressions)
 {
        void * loc = next_act->get_location();
 
@@ -457,7 +458,7 @@ void FuncNode::infer_predicates(FuncInst * next_inst, ModelAction * next_act,
 
 /* Able to generate complex predicates when there are multiple predciate expressions */
 void FuncNode::generate_predicates(Predicate ** curr_pred, FuncInst * next_inst,
-                                                                                                                                        SnapVector<struct half_pred_expr *> * half_pred_expressions)
+SnapVector<struct half_pred_expr *> * half_pred_expressions)
 {
        if (half_pred_expressions->size() == 0) {
                Predicate * new_pred = new Predicate(next_inst);
index 9e3bc69..4738473 100644 (file)
@@ -72,7 +72,6 @@ private:
        Predicate * predicate_tree_entry;       // A dummy node whose children are the real entries
        Predicate * predicate_tree_exit;        // A dummy node
 
-
        uint32_t exit_count;
        uint32_t marker;
 
index 03515b5..a5b437c 100644 (file)
@@ -398,7 +398,7 @@ WaitObj * ModelHistory::getWaitObj(thread_id_t tid)
 }
 
 void ModelHistory::add_waiting_thread(thread_id_t self_id,
-                                                                                                                                                       thread_id_t waiting_for_id, FuncNode * target_node, int dist)
+thread_id_t waiting_for_id, FuncNode * target_node, int dist)
 {
        WaitObj * self_wait_obj = getWaitObj(self_id);
        self_wait_obj->add_waiting_for(waiting_for_id, target_node, dist);
@@ -426,7 +426,7 @@ void ModelHistory::remove_waiting_thread(thread_id_t tid)
 }
 
 void ModelHistory::stop_waiting_for_node(thread_id_t self_id,
-                                                                                                                                                                thread_id_t waiting_for_id, FuncNode * target_node)
+thread_id_t waiting_for_id, FuncNode * target_node)
 {
        WaitObj * self_wait_obj = getWaitObj(self_id);
        bool thread_removed = self_wait_obj->remove_waiting_for_node(waiting_for_id, target_node);