Skip to content

Commit 09d1bfa

Browse files
committed
Temporarily disable insertion of dead instructions on leaving a Java block until I can come up with a better algorithm.
1 parent b0aba69 commit 09d1bfa

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/goto-programs/goto_convert.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ void goto_convertt::finish_gotos(goto_programt &dest)
121121
// appropriate for however many automatic variables leave scope.
122122
// We don't currently handle variables *entering* scope, which is illegal
123123
// for C++ non-pod types and impossible in Java in any case.
124+
/*
124125
auto goto_stack=it.second;
125126
const auto& label_stack=l_it->second.second;
126127
bool stack_is_prefix=true;
@@ -148,6 +149,7 @@ void goto_convertt::finish_gotos(goto_programt &dest)
148149
// is std::list.
149150
}
150151
}
152+
*/
151153
}
152154
else
153155
{
@@ -231,21 +233,21 @@ Function: goto_convertt::finish_guarded_gotos
231233

232234
void goto_convertt::finish_guarded_gotos(goto_programt &dest)
233235
{
234-
std::map<goto_programt::targett, int> itertoint;
235-
236-
int i=0;
237-
for(goto_programt::targett it = dest.instructions.begin(), itend=dest.instructions.end();
238-
it!=itend; ++it,++i)
239-
itertoint[it]=i;
240-
241236
for(auto& gg : guarded_gotos)
242237
{
243238
// Check if any destructor code has been inserted:
244239
bool destructor_present=false;
245240
for(auto it=gg.ifiter; it!=gg.gotoiter && !destructor_present; ++it)
246241
{
247-
if(!(it->is_goto() || it->is_skip()))
248-
destructor_present=true;
242+
switch(it->type)
243+
{
244+
case GOTO:
245+
case SKIP:
246+
continue;
247+
default:
248+
destructor_present=true;
249+
break;
250+
}
249251
}
250252

251253
// If so, can't simplify.
@@ -299,7 +301,7 @@ void goto_convertt::goto_convert_rec(
299301

300302
finish_gotos(dest);
301303
finish_computed_gotos(dest);
302-
finish_guarded_gotos(dest);
304+
//finish_guarded_gotos(dest);
303305
}
304306

305307
/*******************************************************************\
@@ -2265,7 +2267,9 @@ void goto_convertt::generate_ifthenelse(
22652267
// if(some) { label: goto somewhere; }
22662268
// Don't perform the transformation here, as code might get inserted into
22672269
// the true case to perform destructors. This will be attempted in finish_guarded_gotos.
2268-
is_guarded_goto=true;
2270+
//is_guarded_goto=true;
2271+
true_case.instructions.back().guard=guard;
2272+
dest.destructive_append(true_case);
22692273
}
22702274

22712275
// similarly, do guarded assertions directly

0 commit comments

Comments
 (0)