From 19df39f5f8af9fbe0f67df290681e8663938aacc Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Thu, 6 Dec 2012 22:03:53 -0800 Subject: [PATCH] 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. --- model.cc | 14 ++++++++++++++ model.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/model.cc b/model.cc index 3a1a7e2..771847a 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 5543eb8..af6802a 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; -- 2.34.1