position(NULL),
reads_from(NULL),
last_fence_release(NULL),
- uninitaction(NULL),
cv(NULL),
rf_cv(NULL),
+ action_ref(NULL),
value(value),
type(type),
order(order),
seq_number(ACTION_INITIAL_CLOCK)
{
/* References to NULL atomic variables can end up here */
- ASSERT(loc || type == ATOMIC_FENCE);
+ ASSERT(loc || type == ATOMIC_FENCE || type == ATOMIC_NOP);
Thread *t = thread ? thread : thread_current();
this->tid = t!= NULL ? t->get_id() : -1;
position(NULL),
time(_time),
last_fence_release(NULL),
- uninitaction(NULL),
cv(NULL),
rf_cv(NULL),
+ action_ref(NULL),
value(value),
type(type),
order(order),
position(NULL),
reads_from(NULL),
last_fence_release(NULL),
- uninitaction(NULL),
cv(NULL),
rf_cv(NULL),
+ action_ref(NULL),
value(value),
type(type),
order(order),
/* References to NULL atomic variables can end up here */
ASSERT(loc);
this->size = size;
- Thread *t = thread_current();
- this->tid = t->get_id();
+ this->tid = thread_current_id();
}
position(position),
reads_from(NULL),
last_fence_release(NULL),
- uninitaction(NULL),
cv(NULL),
rf_cv(NULL),
+ action_ref(NULL),
value(value),
type(type),
order(order),
/* References to NULL atomic variables can end up here */
ASSERT(loc);
this->size = size;
- Thread *t = thread_current();
- this->tid = t->get_id();
+ this->tid = thread_current_id();
}
position(position),
reads_from(NULL),
last_fence_release(NULL),
- uninitaction(NULL),
cv(NULL),
rf_cv(NULL),
+ action_ref(NULL),
value(value),
type(type),
order(order),
* 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 {
void ModelAction::set_seq_number(modelclock_t num)
{
- /* ATOMIC_UNINIT actions should never have non-zero clock */
- ASSERT(!is_uninitialized());
ASSERT(seq_number == ACTION_INITIAL_CLOCK);
seq_number = num;
}
return is_read() || could_be_write();
}
-bool ModelAction::is_uninitialized() const
-{
- return type == ATOMIC_UNINIT;
-}
-
bool ModelAction::is_read() const
{
return type == ATOMIC_READ || type == ATOMIC_RMWR || type == ATOMIC_RMWRCAS || type == ATOMIC_RMW;
bool ModelAction::is_write() const
{
- return type == ATOMIC_WRITE || type == ATOMIC_RMW || type == ATOMIC_INIT || type == ATOMIC_UNINIT || type == NONATOMIC_WRITE;
+ return type == ATOMIC_WRITE || type == ATOMIC_RMW || type == ATOMIC_INIT || type == NONATOMIC_WRITE;
+}
+
+bool ModelAction::is_create() const
+{
+ return type == THREAD_CREATE || type == PTHREAD_CREATE;
+}
+
+bool ModelAction::is_free() const
+{
+ return type == READY_FREE;
}
bool ModelAction::could_be_write() const
ASSERT(act);
reads_from = act;
- if (act->is_uninitialized()) { // WL
- uint64_t val = *((uint64_t *) location);
- ModelAction * act_uninitialized = (ModelAction *)act;
- act_uninitialized->set_value(val);
- reads_from = act_uninitialized;
-
-// disabled by WL, because LLVM IR is unable to detect atomic init
-/* model->assert_bug("May read from uninitialized atomic:\n"
- " action %d, thread %d, location %p (%s, %s)",
- seq_number, id_to_int(tid), location,
- get_type_str(), get_mo_str());
- */
- }
}
/**
case PTHREAD_CREATE: return "pthread create";
case PTHREAD_JOIN: return "pthread join";
- case ATOMIC_UNINIT: return "uninitialized";
case NONATOMIC_WRITE: return "nonatomic write";
case ATOMIC_READ: return "atomic read";
case ATOMIC_WRITE: return "atomic write";
model_print("%-4d %-2d %-14s %7s %14p %-#18" PRIx64,
seq_number, id_to_int(tid), type_str, mo_str, location, get_return_value());
if (is_read()) {
+ if (is_write()) {
+ model_print("(%" PRIx64 ")", get_write_value());
+ }
if (reads_from)
model_print(" %-3d", reads_from->get_seq_number());
else