@@ -114,8 +114,8 @@ void goto_symext::rewrite_quantifiers(exprt &expr, statet &state)
114
114
{
115
115
// forall X. P -> P
116
116
// we keep the quantified variable unique by means of L2 renaming
117
- assert (expr.operands ().size ()==2 );
118
- assert (expr.op0 ().id ()==ID_symbol);
117
+ PRECONDITION (expr.operands ().size ()==2 );
118
+ PRECONDITION (expr.op0 ().id ()==ID_symbol);
119
119
symbol_exprt tmp0=
120
120
to_symbol_expr (to_ssa_expr (expr.op0 ()).get_original_expr ());
121
121
symex_decl (state, tmp0);
@@ -124,44 +124,72 @@ void goto_symext::rewrite_quantifiers(exprt &expr, statet &state)
124
124
}
125
125
}
126
126
127
- // / symex from given state
128
- void goto_symext::operator ()(
127
+ void goto_symext::symex_entry_point (
129
128
statet &state,
130
129
const goto_functionst &goto_functions,
131
- const goto_programt &goto_program)
130
+ const goto_programt::const_targett pc,
131
+ const goto_programt::const_targett limit)
132
132
{
133
- assert (!goto_program.instructions .empty ());
134
-
135
- state.source =symex_targett::sourcet (goto_program);
136
- assert (!state.threads .empty ());
137
- assert (!state.call_stack ().empty ());
138
- state.top ().end_of_function =--goto_program.instructions .end ();
133
+ PRECONDITION (!state.threads .empty ());
134
+ PRECONDITION (!state.call_stack ().empty ());
135
+ state.source =symex_targett::sourcet (pc);
136
+ state.top ().end_of_function =limit;
139
137
state.top ().calling_location .pc =state.top ().end_of_function ;
140
138
state.symex_target =⌖
141
139
state.dirty =util_make_unique<dirtyt>(goto_functions);
142
140
143
141
symex_transition (state, state.source .pc );
142
+ }
144
143
145
- assert (state.top ().end_of_function ->is_end_function ());
144
+ void goto_symext::symex_threaded_step (
145
+ statet &state, const goto_functionst &goto_functions)
146
+ {
147
+ symex_step (goto_functions, state);
146
148
147
- while (!state.call_stack ().empty ())
149
+ // is there another thread to execute?
150
+ if (state.call_stack ().empty () &&
151
+ state.source .thread_nr +1 <state.threads .size ())
148
152
{
149
- symex_step (goto_functions, state);
150
-
151
- // is there another thread to execute?
152
- if (state.call_stack ().empty () &&
153
- state.source .thread_nr +1 <state.threads .size ())
154
- {
155
- unsigned t=state.source .thread_nr +1 ;
156
- // std::cout << "********* Now executing thread " << t << '\n';
157
- state.switch_to_thread (t);
158
- symex_transition (state, state.source .pc );
159
- }
153
+ unsigned t=state.source .thread_nr +1 ;
154
+ #if 0
155
+ std::cout << "********* Now executing thread " << t << '\n';
156
+ #endif
157
+ state.switch_to_thread (t);
158
+ symex_transition (state, state.source .pc );
160
159
}
160
+ }
161
+
162
+ // / symex from given state
163
+ void goto_symext::operator ()(
164
+ statet &state,
165
+ const goto_functionst &goto_functions,
166
+ const goto_programt &goto_program)
167
+ {
168
+ PRECONDITION (!goto_program.instructions .empty ());
169
+ symex_entry_point (
170
+ state,
171
+ goto_functions,
172
+ goto_program.instructions .begin (),
173
+ prev (goto_program.instructions .end ()));
174
+ PRECONDITION (state.top ().end_of_function ->is_end_function ());
175
+
176
+ while (!state.call_stack ().empty ())
177
+ symex_threaded_step (state, goto_functions);
161
178
162
179
state.dirty =nullptr ;
163
180
}
164
181
182
+ void goto_symext::operator ()(
183
+ statet &state,
184
+ const goto_functionst &goto_functions,
185
+ const goto_programt::const_targett first,
186
+ const goto_programt::const_targett limit)
187
+ {
188
+ symex_entry_point (state, goto_functions, first, limit);
189
+ while (state.source .pc ->function !=limit->function || state.source .pc !=limit)
190
+ symex_threaded_step (state, goto_functions);
191
+ }
192
+
165
193
// / symex starting from given program
166
194
void goto_symext::operator ()(
167
195
const goto_functionst &goto_functions,
@@ -197,8 +225,8 @@ void goto_symext::symex_step(
197
225
std::cout << "Code: " << from_expr(ns, "", state.source.pc->code) << '\n';
198
226
#endif
199
227
200
- assert (!state.threads .empty ());
201
- assert (!state.call_stack ().empty ());
228
+ PRECONDITION (!state.threads .empty ());
229
+ PRECONDITION (!state.call_stack ().empty ());
202
230
203
231
const goto_programt::instructiont &instruction=*state.source .pc ;
204
232
0 commit comments