From: weiyu Date: Tue, 13 Aug 2019 00:46:25 +0000 (-0700) Subject: do optimization for FuncNode::update_tree X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=9a2ba97d13c76e9048ba7c499b3cbca0d02a84ca do optimization for FuncNode::update_tree --- diff --git a/funcnode.cc b/funcnode.cc index cf651ae8..188ed173 100644 --- a/funcnode.cc +++ b/funcnode.cc @@ -1,5 +1,4 @@ #include "funcnode.h" -#include 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; - HashTable act_inst_map; for (sllnode * 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(); - if (func_inst->is_read()) { + if (func_inst->is_read()) read_act_list.push_back(act); - act_inst_map.put(act, func_inst); - } } 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) - return 0xdeadbeef; + return VALUE_NONE; 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; @@ -222,7 +218,7 @@ void FuncNode::clear_read_map(uint32_t tid) thrd_read_map[tid]->reset(); } -void FuncNode::update_predicate_tree(action_list_t * act_list, HashTable * act_inst_map) +void FuncNode::update_predicate_tree(action_list_t * act_list) { if (act_list == NULL || act_list->size() == 0) return; @@ -241,7 +237,7 @@ void FuncNode::update_predicate_tree(action_list_t * act_list, HashTablegetVal(); - 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); diff --git a/funcnode.h b/funcnode.h index fba23609..4ba23985 100644 --- a/funcnode.h +++ b/funcnode.h @@ -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 update_predicate_tree(action_list_t * act_list, HashTable * 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* loc_act_map); void print_predicate_tree(); diff --git a/librace.cc b/librace.cc index 64133304..faa98cdb 100644 --- a/librace.cc +++ b/librace.cc @@ -94,10 +94,12 @@ uint64_t load_64(const void *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) {