From: weiyu Date: Mon, 30 Sep 2019 17:39:12 +0000 (-0700) Subject: Factor predicate expression types into a separate file X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=02060a26c266ffad07c29327431621e611c09065;p=c11tester.git Factor predicate expression types into a separate file --- diff --git a/include/predicatetypes.h b/include/predicatetypes.h new file mode 100644 index 00000000..bb3094c8 --- /dev/null +++ b/include/predicatetypes.h @@ -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__ */ + diff --git a/newfuzzer.cc b/newfuzzer.cc index 4e0d69db..1fdc7d85 100644 --- a/newfuzzer.cc +++ b/newfuzzer.cc @@ -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) diff --git a/predicate.h b/predicate.h index 6c83683d..4bb3039b 100644 --- a/predicate.h +++ b/predicate.h @@ -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 PredExprSet; typedef HSIterator 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);