projects
/
model-checker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
compiles with condition variables file added...
[model-checker.git]
/
action.cc
diff --git
a/action.cc
b/action.cc
index 5e050810e7526408828b27c74cad76fcdef95a4b..44a6d9ad6948c116e3305bd955e204825f01bc96 100644
(file)
--- a/
action.cc
+++ b/
action.cc
@@
-36,6
+36,9
@@
ModelAction::ModelAction(action_type_t type, memory_order order, void *loc,
cv(NULL),
sleep_flag(false)
{
cv(NULL),
sleep_flag(false)
{
+ /* References to NULL atomic variables can end up here */
+ ASSERT(loc || type == MODEL_FIXUP_RELSEQ);
+
Thread *t = thread ? thread : thread_current();
this->tid = t->get_id();
}
Thread *t = thread ? thread : thread_current();
this->tid = t->get_id();
}
@@
-111,6
+114,11
@@
bool ModelAction::is_write() const
return type == ATOMIC_WRITE || type == ATOMIC_RMW || type == ATOMIC_INIT;
}
return type == ATOMIC_WRITE || type == ATOMIC_RMW || type == ATOMIC_INIT;
}
+bool ModelAction::could_be_write() const
+{
+ return is_write() || is_rmwr();
+}
+
bool ModelAction::is_rmwr() const
{
return type == ATOMIC_RMWR;
bool ModelAction::is_rmwr() const
{
return type == ATOMIC_RMWR;
@@
-217,11
+225,11
@@
bool ModelAction::could_synchronize_with(const ModelAction *act) const
// Explore interleavings of seqcst writes to guarantee total order
// of seq_cst operations that don't commute
// Explore interleavings of seqcst writes to guarantee total order
// of seq_cst operations that don't commute
- if ((
is_write() || act->is
_write()) && is_seqcst() && act->is_seqcst())
+ if ((
could_be_write() || act->could_be
_write()) && is_seqcst() && act->is_seqcst())
return true;
// Explore synchronizing read/write pairs
return true;
// Explore synchronizing read/write pairs
- if (is_read() && is_acquire() && act->
is
_write() && act->is_release())
+ if (is_read() && is_acquire() && act->
could_be
_write() && act->is_release())
return true;
// Otherwise handle by reads_from relation
return true;
// Otherwise handle by reads_from relation
@@
-401,16
+409,19
@@
void ModelAction::print() const
break;
}
break;
}
- printf("(%
3d) Thread: %-2d Action: %-13s MO: %7s Loc: %14p Value: %-12" PRIu
64,
+ printf("(%
4d) Thread: %-2d Action: %-13s MO: %7s Loc: %14p Value: %-#18" PRIx
64,
seq_number, id_to_int(tid), type_str, mo_str, location, valuetoprint);
if (is_read()) {
if (reads_from)
seq_number, id_to_int(tid), type_str, mo_str, location, valuetoprint);
if (is_read()) {
if (reads_from)
- printf("
Rf: %
d", reads_from->get_seq_number());
+ printf("
Rf: %-3
d", reads_from->get_seq_number());
else
else
- printf("
Rf: ?
");
+ printf("
Rf: ?
");
}
if (cv) {
}
if (cv) {
- printf("\t");
+ if (is_read())
+ printf(" ");
+ else
+ printf(" ");
cv->print();
} else
printf("\n");
cv->print();
} else
printf("\n");