Skip to content

Commit 75b770b

Browse files
author
Matthias Güdemann
committed
Introduce temporary stack variable for getstatic
1 parent 319ff01 commit 75b770b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,11 +1849,21 @@ codet java_bytecode_convert_methodt::convert_instructions(
18491849
lazy_methods->add_needed_class(
18501850
to_symbol_type(arg0.type()).get_identifier());
18511851
}
1852-
results[0]=java_bytecode_promotion(symbol_expr);
1853-
18541852
// set $assertionDisabled to false
18551853
if(field_name.find("$assertionsDisabled")!=std::string::npos)
1854+
{
18561855
c=code_assignt(symbol_expr, false_exprt());
1856+
results[0]=java_bytecode_promotion(symbol_expr);
1857+
}
1858+
else
1859+
{
1860+
// create a new stack variable to hold the value of the field
1861+
const exprt tmp_var=tmp_variable(
1862+
"stack_static_field",
1863+
java_bytecode_promotion(arg0.type()));
1864+
c=code_assignt(tmp_var, symbol_expr);
1865+
results[0]=java_bytecode_promotion(tmp_var);
1866+
}
18571867
}
18581868
else if(statement=="putfield")
18591869
{

0 commit comments

Comments
 (0)