From: Brian Norris Date: Tue, 20 Nov 2012 04:51:04 +0000 (-0800) Subject: model: add const X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=e13a7703ecf62b58bf9b3e138739ba53c6b53616;hp=21f8ca7067d5d6810ea819a183ea50f863c17752 model: add const --- diff --git a/model.cc b/model.cc index 700f25c0..8d8c1878 100644 --- a/model.cc +++ b/model.cc @@ -172,7 +172,7 @@ unsigned int ModelChecker::get_num_threads() const } /** @return The currently executing Thread. */ -Thread * ModelChecker::get_current_thread() +Thread * ModelChecker::get_current_thread() const { return scheduler->get_current_thread(); } @@ -183,7 +183,8 @@ modelclock_t ModelChecker::get_next_seq_num() return ++priv->used_sequence_numbers; } -Node * ModelChecker::get_curr_node() { +Node * ModelChecker::get_curr_node() const +{ return node_stack->get_head(); } @@ -2016,7 +2017,7 @@ ModelAction * ModelChecker::get_last_unlock(ModelAction *curr) const return NULL; } -ModelAction * ModelChecker::get_parent_action(thread_id_t tid) +ModelAction * ModelChecker::get_parent_action(thread_id_t tid) const { ModelAction *parent = get_last_action(tid); if (!parent) @@ -2029,7 +2030,7 @@ ModelAction * ModelChecker::get_parent_action(thread_id_t tid) * @param tid The thread whose clock vector we want * @return Desired clock vector */ -ClockVector * ModelChecker::get_cv(thread_id_t tid) +ClockVector * ModelChecker::get_cv(thread_id_t tid) const { return get_parent_action(tid)->get_cv(); } diff --git a/model.h b/model.h index 74866c65..80917741 100644 --- a/model.h +++ b/model.h @@ -111,11 +111,11 @@ public: thread_id_t get_next_id(); unsigned int get_num_threads() const; - Thread * get_current_thread(); + Thread * get_current_thread() const; int switch_to_master(ModelAction *act); - ClockVector * get_cv(thread_id_t tid); - ModelAction * get_parent_action(thread_id_t tid); + ClockVector * get_cv(thread_id_t tid) const; + ModelAction * get_parent_action(thread_id_t tid) const; void check_promises_thread_disabled(); void mo_check_promises(thread_id_t tid, const ModelAction *write); void check_promises(thread_id_t tid, ClockVector *old_cv, ClockVector * merge_cv); @@ -128,7 +128,7 @@ public: void set_bad_synchronization(); const model_params params; - Node * get_curr_node(); + Node * get_curr_node() const; MEMALLOC private: