@@ -126,10 +126,7 @@ namespace smt {
126
126
if (!def_int) {
127
127
ptr_buffer<expr> descendants;
128
128
get_foreign_descendants (to_app (n), fid, descendants);
129
- ptr_buffer<expr>::iterator it = descendants.begin ();
130
- ptr_buffer<expr>::iterator end = descendants.end ();
131
- for (; it != end; ++it) {
132
- expr * arg = *it;
129
+ for (expr * arg : descendants) {
133
130
ts_visit_child (arg, false , tcolors, fcolors, todo, visited);
134
131
}
135
132
return visited;
@@ -154,27 +151,27 @@ namespace smt {
154
151
}
155
152
156
153
void context::top_sort_expr (expr * n, svector<expr_bool_pair> & sorted_exprs) {
157
- svector<expr_bool_pair> todo ;
158
- svector< int > tcolors;
159
- svector< int > fcolors;
160
- todo .push_back (expr_bool_pair (n, true ));
161
- while (!todo .empty ()) {
162
- expr_bool_pair & p = todo .back ();
154
+ ts_todo. reset () ;
155
+ tcolors. reset () ;
156
+ fcolors. reset () ;
157
+ ts_todo .push_back (expr_bool_pair (n, true ));
158
+ while (!ts_todo .empty ()) {
159
+ expr_bool_pair & p = ts_todo .back ();
163
160
expr * curr = p.first ;
164
161
bool gate_ctx = p.second ;
165
162
switch (get_color (tcolors, fcolors, curr, gate_ctx)) {
166
163
case White:
167
164
set_color (tcolors, fcolors, curr, gate_ctx, Grey);
168
- ts_visit_children (curr, gate_ctx, tcolors, fcolors, todo );
165
+ ts_visit_children (curr, gate_ctx, tcolors, fcolors, ts_todo );
169
166
break ;
170
167
case Grey:
171
- SASSERT (ts_visit_children (curr, gate_ctx, tcolors, fcolors, todo ));
168
+ SASSERT (ts_visit_children (curr, gate_ctx, tcolors, fcolors, ts_todo ));
172
169
set_color (tcolors, fcolors, curr, gate_ctx, Black);
173
170
if (n != curr && !m.is_not (curr))
174
171
sorted_exprs.push_back (expr_bool_pair (curr, gate_ctx));
175
172
break ;
176
173
case Black:
177
- todo .pop_back ();
174
+ ts_todo .pop_back ();
178
175
break ;
179
176
default :
180
177
UNREACHABLE ();
@@ -185,7 +182,7 @@ namespace smt {
185
182
#define DEEP_EXPR_THRESHOLD 1024
186
183
187
184
void context::internalize_deep (expr* n) {
188
- if (::get_depth (n) > DEEP_EXPR_THRESHOLD) {
185
+ if (! e_internalized (n) && ::get_depth (n) > DEEP_EXPR_THRESHOLD) {
189
186
// if the expression is deep, then execute topological sort to avoid
190
187
// stack overflow.
191
188
// a caveat is that theory internalizers do rely on recursive descent so
0 commit comments