projects
/
c11tester.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
missing changes
[c11tester.git]
/
action.cc
diff --git
a/action.cc
b/action.cc
index a88cc451f532a59a2ff939bef3172613aedf3e57..205bedbf6f12806835a503975e95709162630070 100644
(file)
--- a/
action.cc
+++ b/
action.cc
@@
-1,6
+1,7
@@
#include <stdio.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <stdio.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
+#include <vector>
#include "model.h"
#include "action.h"
#include "model.h"
#include "action.h"
@@
-161,27
+162,35
@@
void ModelAction::create_cv(const ModelAction *parent)
cv = new ClockVector(NULL, this);
}
cv = new ClockVector(NULL, this);
}
-
/** Update the model action's read_from action */
void ModelAction::read_from(const ModelAction *act)
{
ASSERT(cv);
/** Update the model action's read_from action */
void ModelAction::read_from(const ModelAction *act)
{
ASSERT(cv);
- if (act!=NULL && act->is_release() && this->is_acquire()) {
- synchronized(act);
- cv->merge(act->cv);
- }
reads_from = act;
reads_from = act;
+ if (act != NULL && this->is_acquire()) {
+ std::vector<const ModelAction *> release_heads;
+ model->get_release_seq_heads(this, &release_heads);
+ for (unsigned int i = 0; i < release_heads.size(); i++)
+ synchronize_with(release_heads[i]);
+ }
}
}
-
-/** Synchronize the current thread with the thread corresponding to
- * the ModelAction parameter. */
-
-void ModelAction::synchronized(const ModelAction *act) {
+/**
+ * Synchronize the current thread with the thread corresponding to the
+ * ModelAction parameter.
+ * @param act The ModelAction to synchronize with
+ */
+void ModelAction::synchronize_with(const ModelAction *act) {
+ ASSERT(*act < *this);
model->check_promises(cv, act->cv);
cv->merge(act->cv);
}
model->check_promises(cv, act->cv);
cv->merge(act->cv);
}
+bool ModelAction::has_synchronized_with(const ModelAction *act) const
+{
+ return cv->has_synchronized_with(act->cv);
+}
+
/**
* Check whether 'this' happens before act, according to the memory-model's
* happens before relation. This is checked via the ClockVector constructs.
/**
* Check whether 'this' happens before act, according to the memory-model's
* happens before relation. This is checked via the ClockVector constructs.
@@
-209,6
+218,9
@@
void ModelAction::print(void) const
case THREAD_JOIN:
type_str = "thread join";
break;
case THREAD_JOIN:
type_str = "thread join";
break;
+ case THREAD_FINISH:
+ type_str = "thread finish";
+ break;
case ATOMIC_READ:
type_str = "atomic read";
break;
case ATOMIC_READ:
type_str = "atomic read";
break;
@@
-256,8
+268,12
@@
void ModelAction::print(void) const
printf("(%3d) Thread: %-2d Action: %-13s MO: %7s Loc: %14p Value: %-12" PRIu64,
seq_number, id_to_int(tid), type_str, mo_str, location, valuetoprint);
printf("(%3d) Thread: %-2d Action: %-13s MO: %7s Loc: %14p Value: %-12" PRIu64,
seq_number, id_to_int(tid), type_str, mo_str, location, valuetoprint);
- if (reads_from)
- printf(" Rf: %d", reads_from->get_seq_number());
+ if (is_read()) {
+ if (reads_from)
+ printf(" Rf: %d", reads_from->get_seq_number());
+ else
+ printf(" Rf: ?");
+ }
if (cv) {
printf("\t");
cv->print();
if (cv) {
printf("\t");
cv->print();