Factor predicate expression types into a separate file
authorweiyu <weiyuluo1232@gmail.com>
Mon, 30 Sep 2019 17:39:12 +0000 (10:39 -0700)
committerweiyu <weiyuluo1232@gmail.com>
Mon, 30 Sep 2019 17:39:12 +0000 (10:39 -0700)
include/predicatetypes.h [new file with mode: 0644]
newfuzzer.cc
predicate.h

diff --git a/include/predicatetypes.h b/include/predicatetypes.h
new file mode 100644 (file)
index 0000000..bb3094c
--- /dev/null
@@ -0,0 +1,59 @@
+/**
+ * @file predicatetypes.h
+ * @brief Define common predicate expression types
+ */
+
+#ifndef __PREDICATE_TYPES_H__
+#define __PREDICATE_TYPES_H__
+
+typedef enum predicate_token {
+       NOPREDICATE, EQUALITY, NULLITY
+} token_t;
+
+/* If token is EQUALITY, then the predicate asserts whether
+ * this load should read the same value as the last value
+ * read at memory location specified in predicate_expr.
+ */
+struct pred_expr {
+       pred_expr(token_t token, FuncInst * inst, bool value) :
+               token(token),
+               func_inst(inst),
+               value(value)
+       {}
+
+       token_t token;
+       FuncInst * func_inst;
+       bool value;
+
+       MEMALLOC
+};
+
+/* Used by FuncNode to generate Predicates */
+struct half_pred_expr {
+       half_pred_expr(token_t token, FuncInst * inst) :
+               token(token),
+               func_inst(inst)
+       {}
+
+       token_t token;
+       FuncInst * func_inst;
+
+       SNAPSHOTALLOC
+};
+
+struct concrete_pred_expr {
+       concrete_pred_expr(token_t token, uint64_t value, bool equality) :
+               token(token),
+               value(value),
+               equality(equality)
+       {}
+
+       token_t token;
+       uint64_t value;
+       bool equality;
+
+       SNAPSHOTALLOC
+};
+
+#endif  /* __PREDICATE_TYPES_H__ */
+
index 4e0d69dbc44b26138844028fa732aeafef1d7dff..1fdc7d85f91f2b5b121b242b9c84ece0e987594d 100644 (file)
@@ -5,6 +5,7 @@
 #include "execution.h"
 #include "funcnode.h"
 #include "schedule.h"
+#include "concretepredicate.h"
 
 NewFuzzer::NewFuzzer() :
        thrd_last_read_act(),
@@ -241,7 +242,7 @@ void NewFuzzer::wake_up_paused_threads(int * threadlist, int * numthreads)
 /* Notify one of conditional sleeping threads if the desired write is available */
 bool NewFuzzer::notify_conditional_sleep(Thread * thread)
 {
-
+       
 }
 
 bool NewFuzzer::shouldWait(const ModelAction * act)
index 6c83683dddfdfeff4a3fe502625b77a13695a04e..4bb3039b2ced7c62d9feb945614ec6340c6f75cb 100644 (file)
@@ -1,63 +1,15 @@
-#ifndef __PREDICTAE_H__
+#ifndef __PREDICATE_H__
 #define __PREDICATE_H__
 
 #include "funcinst.h"
 #include "hashset.h"
+#include "predicatetypes.h"
 
 unsigned int pred_expr_hash (struct pred_expr *);
 bool pred_expr_equal(struct pred_expr *, struct pred_expr *);
 typedef HashSet<struct pred_expr *, uintptr_t, 0, model_malloc, model_calloc, model_free, pred_expr_hash, pred_expr_equal> PredExprSet;
 typedef HSIterator<struct pred_expr *, uintptr_t, 0, model_malloc, model_calloc, model_free, pred_expr_hash, pred_expr_equal> PredExprSetIter;
 
-typedef enum predicate_token {
-       NOPREDICATE, EQUALITY, NULLITY
-} token_t;
-
-/* If token is EQUALITY, then the predicate asserts whether
- * this load should read the same value as the last value
- * read at memory location specified in predicate_expr.
- */
-struct pred_expr {
-       pred_expr(token_t token, FuncInst * inst, bool value) :
-               token(token),
-               func_inst(inst),
-               value(value)
-       {}
-
-       token_t token;
-       FuncInst * func_inst;
-       bool value;
-
-       MEMALLOC
-};
-
-/* Used by predicate generator */
-struct half_pred_expr {
-       half_pred_expr(token_t token, FuncInst * inst) :
-               token(token),
-               func_inst(inst)
-       {}
-
-       token_t token;
-       FuncInst * func_inst;
-
-       SNAPSHOTALLOC
-};
-
-struct concrete_pred_expr {
-       concrete_pred_expr(token_t token, uint64_t value, bool equality) :
-               token(token),
-               value(value),
-               equality(equality)
-       {}
-
-       token_t token;
-       uint64_t value;
-       bool equality;
-
-       SNAPSHOTALLOC
-};
-
 class Predicate {
 public:
        Predicate(FuncInst * func_inst, bool is_entry = false);