From: Brian Norris Date: Fri, 7 Dec 2012 06:03:53 +0000 (-0800) Subject: model: add helper for allocating new UNINIT actions X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=19df39f5f8af9fbe0f67df290681e8663938aacc;p=c11tester.git model: add helper for allocating new UNINIT actions These UNINIT actions will be special; they won't enter the NodeStack, and so they need to be snapshot-allocated. That way, they will roll-back with the execution, instead of requiring manual deletion. --- diff --git a/model.cc b/model.cc index 3a1a7e23..771847ab 100644 --- a/model.cc +++ b/model.cc @@ -1,6 +1,7 @@ #include #include #include +#include #include "model.h" #include "action.h" @@ -2523,6 +2524,19 @@ bool ModelChecker::sleep_can_read_from(ModelAction * curr, const ModelAction *wr } } +/** + * @brief Create a new action representing an uninitialized atomic + * @param location The memory location of the atomic object + * @return A pointer to a new ModelAction + */ +ModelAction * ModelChecker::new_uninitialized_action(void *location) const +{ + ModelAction *act = (ModelAction *)snapshot_malloc(sizeof(class ModelAction)); + act = new (act) ModelAction(ATOMIC_UNINIT, std::memory_order_relaxed, location, 0, model_thread); + act->create_cv(NULL); + return act; +} + static void print_list(action_list_t *list, int exec_num = -1) { action_list_t::iterator it; diff --git a/model.h b/model.h index 5543eb8a..af6802a0 100644 --- a/model.h +++ b/model.h @@ -187,6 +187,8 @@ private: bool release_seq_heads(const ModelAction *rf, rel_heads_list_t *release_heads, struct release_seq *pending) const; bool resolve_release_sequences(void *location, work_queue_t *work_queue); + ModelAction * new_uninitialized_action(void *location) const; + ModelAction *diverge; ModelAction *earliest_diverge;