do optimization for FuncNode::update_tree
authorweiyu <weiyuluo1232@gmail.com>
Tue, 13 Aug 2019 00:46:25 +0000 (17:46 -0700)
committerweiyu <weiyuluo1232@gmail.com>
Tue, 13 Aug 2019 00:46:25 +0000 (17:46 -0700)
funcnode.cc
funcnode.h
librace.cc

index cf651ae8679a4ddcba176caa9a3b9d2ccb8f7b91..188ed173c3c0bfda3bc60fad06c7d781fc4f5fbc 100644 (file)
@@ -1,5 +1,4 @@
 #include "funcnode.h"
 #include "funcnode.h"
-#include <fcntl.h>
 
 FuncNode::FuncNode() :
        predicate_tree_initialized(false),
 
 FuncNode::FuncNode() :
        predicate_tree_initialized(false),
@@ -114,7 +113,6 @@ void FuncNode::update_tree(action_list_t * act_list)
        /* build inst_list from act_list for later processing */
        func_inst_list_t inst_list;
        action_list_t read_act_list;
        /* build inst_list from act_list for later processing */
        func_inst_list_t inst_list;
        action_list_t read_act_list;
-       HashTable<ModelAction *, FuncInst *, uintptr_t, 4> act_inst_map;
 
        for (sllnode<ModelAction *> * it = act_list->begin(); it != NULL; it = it->getNext()) {
                ModelAction * act = it->getVal();
 
        for (sllnode<ModelAction *> * it = act_list->begin(); it != NULL; it = it->getNext()) {
                ModelAction * act = it->getVal();
@@ -128,14 +126,12 @@ void FuncNode::update_tree(action_list_t * act_list)
 //             model_print("position: %s ", act->get_position());
 //             act->print();
 
 //             model_print("position: %s ", act->get_position());
 //             act->print();
 
-               if (func_inst->is_read()) {
+               if (func_inst->is_read())
                        read_act_list.push_back(act);
                        read_act_list.push_back(act);
-                       act_inst_map.put(act, func_inst);
-               }
        }
 
        update_inst_tree(&inst_list);
        }
 
        update_inst_tree(&inst_list);
-       update_predicate_tree(&read_act_list, &act_inst_map);
+       update_predicate_tree(&read_act_list);
 }
 
 /** 
 }
 
 /** 
@@ -198,13 +194,13 @@ void FuncNode::store_read(ModelAction * act, uint32_t tid)
 uint64_t FuncNode::query_last_read(void * location, uint32_t tid)
 {
        if (thrd_read_map.size() <= tid)
 uint64_t FuncNode::query_last_read(void * location, uint32_t tid)
 {
        if (thrd_read_map.size() <= tid)
-               return 0xdeadbeef;
+               return VALUE_NONE;
 
        read_map_t * read_map = thrd_read_map[tid];
 
        /* last read value not found */
        if ( !read_map->contains(location) )
 
        read_map_t * read_map = thrd_read_map[tid];
 
        /* last read value not found */
        if ( !read_map->contains(location) )
-               return 0xdeadbeef;
+               return VALUE_NONE;
 
        uint64_t read_val = read_map->get(location);
        return read_val;
 
        uint64_t read_val = read_map->get(location);
        return read_val;
@@ -222,7 +218,7 @@ void FuncNode::clear_read_map(uint32_t tid)
        thrd_read_map[tid]->reset();
 }
 
        thrd_read_map[tid]->reset();
 }
 
-void FuncNode::update_predicate_tree(action_list_t * act_list, HashTable<ModelAction *, FuncInst *, uintptr_t, 4> * act_inst_map)
+void FuncNode::update_predicate_tree(action_list_t * act_list)
 {
        if (act_list == NULL || act_list->size() == 0)
                return;
 {
        if (act_list == NULL || act_list->size() == 0)
                return;
@@ -241,7 +237,7 @@ void FuncNode::update_predicate_tree(action_list_t * act_list, HashTable<ModelAc
 
        while (it != NULL) {
                ModelAction * next_act = it->getVal();
 
        while (it != NULL) {
                ModelAction * next_act = it->getVal();
-               FuncInst * next_inst = act_inst_map->get(next_act);
+               FuncInst * next_inst = get_inst(next_act);
                Predicate * old_pred = curr_pred;
 
                bool branch_found = follow_branch(&curr_pred, next_inst, next_act, &loc_act_map);
                Predicate * old_pred = curr_pred;
 
                bool branch_found = follow_branch(&curr_pred, next_inst, next_act, &loc_act_map);
index fba236093ce02ac91f7688a27a677bd6b533278b..4ba239856df8e468a7bf4f6b7518a7a95381bed7 100644 (file)
@@ -36,7 +36,7 @@ public:
        void clear_read_map(uint32_t tid);
 
        /* TODO: generate EQUALITY or NULLITY predicate based on write_history in history.cc */
        void clear_read_map(uint32_t tid);
 
        /* TODO: generate EQUALITY or NULLITY predicate based on write_history in history.cc */
-       void update_predicate_tree(action_list_t * act_list, HashTable<ModelAction *, FuncInst *, uintptr_t, 4> * act_inst_map);
+       void update_predicate_tree(action_list_t * act_list);
        bool follow_branch(Predicate ** curr_pred, FuncInst * next_inst, ModelAction * next_act, HashTable<void *, ModelAction *, uintptr_t, 0>* loc_act_map);
        void print_predicate_tree();
 
        bool follow_branch(Predicate ** curr_pred, FuncInst * next_inst, ModelAction * next_act, HashTable<void *, ModelAction *, uintptr_t, 0>* loc_act_map);
        void print_predicate_tree();
 
index 64133304e31e5fc72414c4399d6719e0b410c4d3..faa98cdb02221518825e82547d2b0a5126d07685 100644 (file)
@@ -94,10 +94,12 @@ uint64_t load_64(const void *addr)
        return *((uint64_t *)addr);
 }
 
        return *((uint64_t *)addr);
 }
 
-// helper functions used by CdsPass
-// The CdsPass implementation does not replace normal load/stores with cds load/stores,
-// but inserts cds load/stores to check dataraces. Thus, the cds load/stores do not
-// return anything.
+/**
+ * Helper functions used by CDSPass
+ * The CDSPass implementation does not replace normal load/stores with cds load/stores,
+ * but inserts cds load/stores to check dataraces. Thus, the cds load/stores do not
+ * return anything.
+ */
 
 void cds_store8(void *addr)
 {
 
 void cds_store8(void *addr)
 {