From: bdemsky Date: Tue, 21 Jul 2020 23:42:34 +0000 (-0700) Subject: Approach 2 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=b492e4a6a9bfbd3138878846ab0d9810d8814071 Approach 2 --- diff --git a/action.cc b/action.cc index 9905ab2b..af42a1f0 100644 --- a/action.cc +++ b/action.cc @@ -197,9 +197,11 @@ ModelAction::~ModelAction() * vectors which have already been rolled back to an unallocated state. */ - /* - if (cv) - delete cv; */ + + if (cv) + delete cv; + if (rf_cv) + delete rf_cv; } int ModelAction::getSize() const { diff --git a/execution.cc b/execution.cc index 05c5842f..9d80ba49 100644 --- a/execution.cc +++ b/execution.cc @@ -149,7 +149,7 @@ static SnapVector * get_safe_ptr_vect_action(HashTable * vec) { - for (uint i = 0; i < vec->size(); i++) { + for (uint i = 0;i < vec->size();i++) { action_list_t * list = &(*vec)[i]; if (list != NULL) list->fixupParent(); @@ -160,38 +160,38 @@ static void fixup_action_list(SnapVector * vec) static inline void record_atomic_stats(ModelAction * act) { switch (act->get_type()) { - case ATOMIC_WRITE: - atomic_store_count++; - break; - case ATOMIC_RMW: - atomic_load_count++; - break; - case ATOMIC_READ: - atomic_rmw_count++; - break; - case ATOMIC_FENCE: - atomic_fence_count++; - break; - case ATOMIC_LOCK: - atomic_lock_count++; - break; - case ATOMIC_TRYLOCK: - atomic_trylock_count++; - break; - case ATOMIC_UNLOCK: - atomic_unlock_count++; - break; - case ATOMIC_NOTIFY_ONE: - case ATOMIC_NOTIFY_ALL: - atomic_notify_count++; - break; - case ATOMIC_WAIT: - atomic_wait_count++; - break; - case ATOMIC_TIMEDWAIT: - atomic_timedwait_count++; - default: - return; + case ATOMIC_WRITE: + atomic_store_count++; + break; + case ATOMIC_RMW: + atomic_load_count++; + break; + case ATOMIC_READ: + atomic_rmw_count++; + break; + case ATOMIC_FENCE: + atomic_fence_count++; + break; + case ATOMIC_LOCK: + atomic_lock_count++; + break; + case ATOMIC_TRYLOCK: + atomic_trylock_count++; + break; + case ATOMIC_UNLOCK: + atomic_unlock_count++; + break; + case ATOMIC_NOTIFY_ONE: + case ATOMIC_NOTIFY_ALL: + atomic_notify_count++; + break; + case ATOMIC_WAIT: + atomic_wait_count++; + break; + case ATOMIC_TIMEDWAIT: + atomic_timedwait_count++; + default: + return; } } @@ -499,7 +499,7 @@ bool ModelExecution::process_mutex(ModelAction *curr) /* remove old wait action and disable this thread */ simple_action_list_t * waiters = get_safe_ptr_action(&condvar_waiters_map, curr->get_location()); - for (sllnode * it = waiters->begin(); it != NULL; it = it->getNext()) { + for (sllnode * it = waiters->begin();it != NULL;it = it->getNext()) { ModelAction * wait = it->getVal(); if (wait->get_tid() == curr->get_tid()) { waiters->erase(it); @@ -1194,7 +1194,7 @@ ClockVector * ModelExecution::get_hb_from_write(ModelAction *rf) const { //operation that isn't release if (rf->get_last_fence_release()) { if (vec == NULL) - vec = rf->get_last_fence_release()->get_cv(); + vec = new ClockVector(rf->get_last_fence_release()->get_cv(), NULL); else (vec=new ClockVector(vec, NULL))->merge(rf->get_last_fence_release()->get_cv()); }