1#ifndef EXECUTION_STATE_H_
2#define EXECUTION_STATE_H_
82 goto_symex_statet::merge_state_listt::iterator
snapshot;
110 std::shared_ptr<symex_targett> _target,
112 std::shared_ptr<ex_state_level2t> l2init,
147 std::shared_ptr<renaming::level2t>
clone()
const override;
164 std::shared_ptr<renaming::level2t>
clone()
const override;
199 log_error(
"Setting thread data for nonexistant thread {}", tid);
211 log_error(
"Setting thread data for nonexistant thread {}", tid);
228 virtual std::shared_ptr<execution_statet>
clone()
const = 0;
268 void claim(
const expr2tc &expr,
const std::string &msg)
override;
440 statet::merge_state_listt::iterator parked)
override;
482 std::set<expr2tc> &global_list,
484 bool under_deref =
false);
508 std::set<expr2tc> &global_list,
514 std::set<expr2tc> &global_list,
653 std::vector<std::list<std::pair<goto_programt::const_targett, merge_statet>>>
678 "execution_statet::\\guard_exec";
788 std::shared_ptr<symex_targett> _target,
797 options.get_bool_option(
"state-hashing")
804 std::shared_ptr<execution_statet>
clone()
const override;
821 std::shared_ptr<symex_targett> _target,
848 std::shared_ptr<execution_statet>
clone()
const override;
850 void claim(
const expr2tc &expr,
const std::string &msg)
override;
std::shared_ptr< execution_statet > clone() const override
Duplicate this execution state.
Definition execution_state.cpp:1680
dfs_execution_statet(const dfs_execution_statet &ref)=default
~dfs_execution_statet() override
Definition execution_state.cpp:1673
dfs_execution_statet(const goto_functionst &goto_functions, const namespacet &ns, reachability_treet *art, std::shared_ptr< symex_targett > _target, contextt &context, optionst &options)
Definition execution_state.h:784
execution_statet specific level2t.
Definition execution_state.h:143
void rename(expr2tc &lhs_symbol, unsigned count) override
Definition execution_state.cpp:1661
~ex_state_level2t() override=default
std::shared_ptr< renaming::level2t > clone() const override
Definition execution_state.cpp:1656
execution_statet * owner
Definition execution_state.h:151
ex_state_level2t(execution_statet &ref)
Definition execution_state.cpp:1650
State-hashing level2t.
Definition execution_state.h:160
std::size_t generate_l2_state_hash() const
Definition execution_state.cpp:1764
std::map< irep_idt, std::size_t > current_state_hashest
Definition execution_state.h:170
state_hashing_level2t(execution_statet &ref)
Definition execution_state.cpp:1734
std::shared_ptr< renaming::level2t > clone() const override
Definition execution_state.cpp:1741
current_state_hashest current_hashes
Definition execution_state.h:171
void make_assignment(expr2tc &lhs_symbol, const expr2tc &const_value, const expr2tc &assigned_value) override
Definition execution_state.cpp:1746
~state_hashing_level2t() override=default
const std::vector< unsigned int > & get_thread_last_transition() const
Read-only accessor for the chain's run order, for the A6.4 harness.
Definition execution_state.h:567
void record_access_key(const expr2tc &key, std::set< expr2tc > &global_list, access_kindt kind)
Record key as an object accessed by this transition, for MPOR.
Definition execution_state.cpp:1028
void update_after_switch_point()
Perform any necessary steps after a context switch point.
Definition execution_state.cpp:619
void print_stack_traces(unsigned int indent=0) const
Print stack trace of each thread to stdout.
Definition execution_state.cpp:1553
unsigned int active_thread
Current active states thread ID.
Definition execution_state.h:675
unsigned int get_active_atomic_number() const
Get atomic number count for current thread state.
Definition execution_state.cpp:504
std::vector< std::list< std::pair< goto_programt::const_targett, merge_statet > > > preserved_paths
Preserved paths.
Definition execution_state.h:654
std::size_t update_hash_for_assignment(const expr2tc &rhs)
Generate hash of an expression.
Definition execution_state.cpp:1545
unsigned int & get_nondet_counter() override
Like get_dynamic_counter, but with nondet symbols.
Definition execution_state.cpp:489
void assume(const expr2tc &assumption) override
Assume some expression is true.
Definition execution_state.cpp:446
bool all_threads_terminal() const
True iff every thread in this schedule has reached a terminal state, i.e.
Definition execution_state.cpp:596
void defer_assumption(const expr2tc &assumption) override
As assume(), the deferred assumption reads its condition now.
Definition execution_state.cpp:454
int get_context_switch() const
Get the number of context switches performed by this ex_state.
Definition execution_state.h:183
access_kindt
Kind of memory access, used by get_expr_globals to decide whether a read-only global can be filtered ...
Definition execution_state.h:463
@ READ
Definition execution_state.h:464
@ WRITE
Definition execution_state.h:465
void analyze_read(const expr2tc &expr)
Analyze the contents of a read for threading.
Definition execution_state.cpp:943
void execute_guard()
Generates execution guard that's true if this interleaving can be reached.
Definition execution_state.cpp:811
std::vector< std::vector< int > > dependency_chain
Dependancy chain for POR calculations.
Definition execution_state.h:726
transition_resultt last_transition
Explicit result of the last symbolic transition taken.
Definition execution_state.h:668
bool mon_from_tid
Whether monitor_from_tid is set.
Definition execution_state.h:702
unsigned int last_active_thread
Last active thread's ID.
Definition execution_state.h:666
void note_bounded_loop_truncation() override
Under –no-unwinding-assertions a truncated loop is cut with an assumption, which drives the state gua...
Definition execution_state.cpp:473
void calculate_mpor_constraints()
Calculate MPOR schedulable threads.
Definition execution_state.cpp:1347
bool can_execution_continue() const
Can execution continue in this thread?
Definition execution_state.cpp:1494
void cull_all_paths()
Definition execution_state.cpp:711
transition_footprintt last_transition_footprint(unsigned int tid) const
Footprint of the transition thread tid most recently completed.
Definition execution_state.h:534
std::vector< expr2tc > thread_start_data
Storage for threading libraries thread start data.
Definition execution_state.h:664
bool mpor_says_no
MPOR scheduling outcome.
Definition execution_state.h:738
void increment_context_switch()
Increase number of context switches this ex_state has taken.
Definition execution_state.h:177
friend void build_goto_symex_classes()
value_sett global_value_set
Global pointer tracking state record.
Definition execution_state.h:673
void record_aggregate_held_target(const namespacet &ns, const expr2tc &expr, std::set< expr2tc > &global_list, access_kindt kind)
Record what a dereference reaches when the pointer it goes through is not a bare symbol (R29).
Definition execution_state.cpp:1110
std::vector< goto_symex_statet > threads_state
Stack of thread states.
Definition execution_state.h:647
void force_cswitch()
Accessor method for cswitch_forced.
Definition execution_state.h:573
goto_symex_statet::merge_statet merge_statet
Definition execution_state.h:50
void set_thread_start_data(unsigned int tid, const expr2tc &argdata)
Set internal thread startup data.
Definition execution_state.h:195
bool is_cur_state_guard_false(const expr2tc &guard)
Determines if current state guard is false.
Definition execution_state.cpp:781
execution_statet(const goto_functionst &goto_functions, const namespacet &ns, reachability_treet *art, std::shared_ptr< symex_targett > _target, contextt &context, std::shared_ptr< ex_state_level2t > l2init, optionst &options)
Default constructor.
Definition execution_state.cpp:24
const std::vector< std::vector< int > > & get_dependency_chain() const
Read-only accessor for the MPOR dependency chain, for the A6.4 harness.
Definition execution_state.h:561
void symex_end_function(reachability_treet &art, const goto_programt::instructiont &instruction)
Definition execution_state.cpp:258
unsigned int monitor_tid
TID of monitor thread, for monitor intrinsics.
Definition execution_state.h:696
std::shared_ptr< ex_state_level2t > state_level2
Global L2 state of this execution_statet.
Definition execution_state.h:671
expr2tc resolve_pointer_target(const namespacet &ns, const expr2tc &ptr, bool &to_global, bool through_deref)
Resolve one pointer level: the object ptr's value set names, or nil.
Definition execution_state.cpp:965
unsigned int transition_ordinal
Ordinal issued to the next completed transition.
Definition execution_state.h:734
void claim(const expr2tc &expr, const std::string &msg) override
Symbolically assert something.
Definition execution_state.cpp:417
unsigned int thread_cswitch_threshold
Minimum number of threads to exist to consider a context switch.
Definition execution_state.h:711
unsigned int get_active_state_number() const
Fetch the thread ID of the current active thread.
Definition execution_state.h:189
void decrement_active_atomic_number()
Decrease current threads atomic number count.
Definition execution_state.cpp:514
bool tid_is_set
Whether monitor_tid is set.
Definition execution_state.h:698
unsigned int monitor_from_tid
TID of thread that switched to monitor.
Definition execution_state.h:700
goto_symex_statet & get_active_state()
Get reference to current thread state.
Definition execution_state.cpp:494
void record_parked_path(goto_programt::const_targett target, statet::merge_state_listt::iterator parked) override
Hook called when a step parks a merge_statet snapshot for a deferred merge — a GOTO forking off its s...
Definition execution_state.cpp:439
bool symex_trace
Are we tracing / printing symex instructions?
Definition execution_state.h:744
bool no_propagation
Was constant propagation disabled with –no-propagation?
Definition execution_state.h:753
unsigned int & get_dynamic_counter() override
Fetch reference to count of dynamic objects in this state.
Definition execution_state.cpp:484
unsigned nondet_count
Number of nondeterministic symbols in this state.
Definition execution_state.h:682
bool smt_thread_guard
Are we evaluating the thread guard in the SMT solver during context switching?
Definition execution_state.h:749
bool check_if_ileaves_blocked()
Test to see if interleavings are blocked by the current state.
Definition execution_state.cpp:538
bool check_mpor_dependency(unsigned int j, unsigned int l) const
Check for scheduling dependencies.
Definition execution_state.cpp:1311
expr2tc get_guard_identifier()
Fetch name of current execution guard.
Definition execution_state.cpp:519
static unsigned int node_count
Definition execution_state.h:769
int CS_number
Number of context switches performed by this ex_state.
Definition execution_state.h:715
static constexpr const char * guard_execution_name
Name of the top-level execution guard symbol.
Definition execution_state.h:677
bool smt_during_symex
Are we encoding SMT during exploration?
Definition execution_state.h:746
void symex_assign(const expr2tc &code, const bool hidden, const guard2tc &guard) override
Symbolically assign a value.
Definition execution_state.cpp:406
void switch_away_from_monitor()
Switch away from registered monitor thread.
Definition execution_state.cpp:1615
std::vector< unsigned int > thread_last_transition
Run-order ordinal of each thread's last completed transition; 0 for a thread that has not run.
Definition execution_state.h:732
static void reset_dynamic_counter()
Zero the dynamic-object counter.
Definition execution_state.cpp:479
void kill_monitor_thread()
Makr registered monitor thread as ended.
Definition execution_state.cpp:1641
static unsigned dynamic_counter
Number of dynamic objects in this state.
Definition execution_state.h:685
std::size_t generate_hash() const
Generate hash of entire execution state.
Definition execution_state.cpp:1505
bool interleaving_unviable
True if the guard on this interleaving becomes false.
Definition execution_state.h:692
std::vector< std::set< expr2tc > > thread_last_writes
For each thread, a set of symbols that were written by the thread in the last transition (run).
Definition execution_state.h:723
bool cswitch_forced
Indicates a mandatory context switch should occur.
Definition execution_state.h:741
void symex_goto(const expr2tc &old_guard) override
Perform a jump across GOTO code.
Definition execution_state.cpp:425
virtual std::shared_ptr< execution_statet > clone() const =0
Duplicate this execution state.
void symex_printf(const expr2tc &lhs, expr2tc &code) override
Implemented by goto_symext::symex_printf.
Definition execution_state.cpp:462
void symex_step(reachability_treet &art) override
Make one symbolic execution step.
Definition execution_state.cpp:313
std::vector< std::set< expr2tc > > thread_last_reads
For each thread, a set of symbols that were read by the thread in the last transition (run).
Definition execution_state.h:719
const expr2tc & get_thread_start_data(unsigned int tid) const
Fetch internal thread startup data.
Definition execution_state.h:207
void analyze_args(const expr2tc &expr) override
Analyze the shared varables in a function call, this is because an argumemt may be renamed to constan...
Definition execution_state.cpp:959
execution_statet & operator=(const execution_statet &ex)=delete
Public assignment is deleted: a standalone a = b would not be correct here (it would leave the base g...
unsigned int add_thread(const goto_programt *prog)
Create a new thread.
Definition execution_state.cpp:872
void switch_to_monitor()
Switch to registered monitor thread.
Definition execution_state.cpp:1574
void analyze_assign(const expr2tc &assign)
Analyze the contents of an assignment for threading.
Definition execution_state.cpp:923
std::vector< unsigned int > atomic_numbers
Atomic section count.
Definition execution_state.h:659
unsigned int node_id
Identifying number for this execution state.
Definition execution_state.h:688
bool is_transition_blocked_by_mpor() const
Read-only accessor for mpor_says_no.
Definition execution_state.h:555
void copy_derived_from(const execution_statet &ex)
Copy execution_statet's own scheduling fields from ex.
Definition execution_state.cpp:136
bool has_cswitch_point_occured() const
Has a context switch point occurred.
Definition execution_state.cpp:1467
void get_expr_globals(const namespacet &ns, const expr2tc &expr, std::set< expr2tc > &global_list, access_kindt kind, bool under_deref=false)
Get list of globals accessed by expr.
Definition execution_state.cpp:1132
void restore_last_paths()
Definition execution_state.cpp:739
irep_idt guard_execution
Name prefix for execution guard.
Definition execution_state.h:680
void switch_to_thread(unsigned int i)
Perform a context switch to thread ID i.
Definition execution_state.cpp:531
void preserve_last_paths(const transition_resultt &transition)
Definition execution_state.cpp:643
bool main_returned
True once main has returned and the exit-time code is running.
Definition execution_state.h:694
virtual ~execution_statet()=default
Default destructor.
void end_thread()
Record a thread as ended.
Definition execution_state.cpp:604
void increment_active_atomic_number()
Increase current threads atomic number count.
Definition execution_state.cpp:509
Definition goto_functions.h:56
Container for an instruction of the goto-program.
Definition goto_program.h:95
A generic container class for a control flow graph for one function, in the form of a goto-program.
Definition goto_program.h:63
instructionst::const_iterator const_targett
Definition goto_program.h:591
Snapshot of the symbolic data needed to merge a deferred path.
Definition goto_symex_state.h:100
Class for storing a particular threads state.
Definition goto_symex_state.h:36
const goto_functionst & goto_functions
GOTO functions that we're operating over.
Definition goto_symex.h:1726
friend class reachability_treet
Definition goto_symex.h:94
std::shared_ptr< symex_targett > target
Target listening to the execution trace.
Definition goto_symex.h:1728
optionst & options
Options we're working with.
Definition goto_symex.h:1621
const namespacet & ns
Namespace we're working in.
Definition goto_symex.h:1722
goto_symext(const namespacet &_ns, contextt &_new_context, const goto_functionst &goto_functions, std::shared_ptr< symex_targett > _target, optionst &opts)
Default constructor.
Definition symex_assign.cpp:32
virtual void note_bounded_loop_truncation()
Records that a loop was cut off at the unwinding bound with nothing to flag it.
Definition goto_symex.h:522
Path-condition guard container.
Definition irep2_guard.h:32
Definition namespace.h:10
Class to explore states reachable through threading.
Definition reachability_tree.h:65
unsigned int * psimplified_claims
Definition execution_state.h:859
unsigned int * ptruncations
Definition execution_state.h:862
~schedule_execution_statet() override
Definition execution_state.cpp:1699
unsigned int * premaining_claims
Definition execution_state.h:858
std::shared_ptr< execution_statet > clone() const override
Duplicate this execution state.
Definition execution_state.cpp:1704
schedule_execution_statet(const goto_functionst &goto_functions, const namespacet &ns, reachability_treet *art, std::shared_ptr< symex_targett > _target, contextt &context, optionst &options, unsigned int *ptotal_claims, unsigned int *premaining_claims, unsigned int *psimplified_claims, unsigned int *ptruncations)
Definition execution_state.h:817
void note_bounded_loop_truncation() override
Under –no-unwinding-assertions a truncated loop is cut with an assumption, which drives the state gua...
Definition execution_state.h:851
unsigned int * ptotal_claims
Definition execution_state.h:857
schedule_execution_statet(const schedule_execution_statet &ref)=default
void claim(const expr2tc &expr, const std::string &msg) override
Symbolically assert something.
Definition execution_state.cpp:1714
Definition value_set.h:64
int count
Definition cuda.h:51
Classes and definitions for non-stringy internal representation.
irep_container< expr2t > expr2tc
Definition irep2.h:431
#define log_error(fmt,...)
Definition message.h:83
Definition exception.cpp:51
uint256_t key
Definition solidity_mapping.c:1
static exprt assigned_value(exprt rhs, const symbol_exprt &lhs)
Definition st_fb_translator.cpp:339
void abort(void)
Definition stdlib.c:77
A path the transition parked for a deferred merge: the sibling arm of a branch, or the continuation a...
Definition execution_state.h:57
goto_symex_statet::merge_state_listt::iterator snapshot
Direct reference to the parked merge_statet in cur_state->top().merge_state_map[target].
Definition execution_state.h:82
goto_programt::const_targett target
Instruction at which the parked path will be merged in.
Definition execution_state.h:59
Definition execution_state.h:86
unsigned int thread_id
Definition execution_state.h:87
std::optional< guard2tc > parent_guard
Definition execution_state.h:88
std::optional< parked_patht > parked
Definition execution_state.h:89
Definition renaming.h:140