From: Brian Demsky Date: Thu, 12 Dec 2019 07:58:04 +0000 (-0800) Subject: Towards erase method X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d9876c1bb83f7bdfee8156cec5c86a92e1ce2235;p=c11tester.git Towards erase method --- diff --git a/action.h b/action.h index 15bb02ea..78f6f140 100644 --- a/action.h +++ b/action.h @@ -192,6 +192,9 @@ public: void setTraceRef(sllnode *ref) { trace_ref = ref; } void setThrdMapRef(sllnode *ref) { thrdmap_ref = ref; } void setActionRef(sllnode *ref) { action_ref = ref; } + sllnode * getTraceRef() { return trace_ref; } + sllnode * getThrdMapRef() { return thrdmap_ref; } + sllnode * getActionRef() { return action_ref; } SNAPSHOTALLOC private: const char * get_type_str() const; diff --git a/execution.cc b/execution.cc index 185874ee..68fd9706 100644 --- a/execution.cc +++ b/execution.cc @@ -1715,6 +1715,42 @@ Thread * ModelExecution::take_step(ModelAction *curr) return action_select_next_thread(curr); } +void ModelExecution::removeAction(ModelAction *act) { + { + sllnode * listref = act->getTraceRef(); + if (listref != NULL) { + action_trace.erase(listref); + } + } + { + sllnode * listref = act->getThrdMapRef(); + if (listref != NULL) { + SnapVector *vec = get_safe_ptr_vect_action(&obj_thrd_map, act->get_location()); + (*vec)[act->get_tid()].erase(listref); + } + } + if ((act->is_fence() && act->is_seqcst()) || act->is_unlock()) { + sllnode * listref = act->getActionRef(); + if (listref != NULL) { + action_list_t *list = get_safe_ptr_action(&obj_map, act->get_location()); + list->erase(listref); + } + } else if (act->is_wait()) { + sllnode * listref = act->getActionRef(); + if (listref != NULL) { + void *mutex_loc = (void *) act->get_value(); + get_safe_ptr_action(&obj_map, mutex_loc)->erase(listref); + } + } else if (act->is_write()) { + sllnode * listref = act->getActionRef(); + if (listref != NULL) { + SnapVector *vec = get_safe_ptr_vect_action(&obj_wr_thrd_map, act->get_location()); + (*vec)[act->get_tid()].erase(listref); + } + } + +} + Fuzzer * ModelExecution::getFuzzer() { return fuzzer; } diff --git a/execution.h b/execution.h index 42178127..72b51fb8 100644 --- a/execution.h +++ b/execution.h @@ -123,6 +123,7 @@ private: ClockVector * get_hb_from_write(ModelAction *rf) const; ModelAction * get_uninitialized_action(ModelAction *curr) const; ModelAction * convertNonAtomicStore(void*); + void removeAction(ModelAction *act); #ifdef TLS pthread_key_t pthreadkey; @@ -132,13 +133,14 @@ private: /** The scheduler to use: tracks the running/ready Threads */ Scheduler * const scheduler; - action_list_t action_trace; SnapVector thread_map; SnapVector pthread_map; uint32_t pthread_counter; + action_list_t action_trace; + /** Per-object list of actions. Maps an object (i.e., memory location) * to a trace of all actions performed on the object.