Skip to content

Commit 8a4ed59

Browse files
Extract convert_pop function
1 parent 5e37b9e commit 8a4ed59

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,16 +1605,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
16051605
}
16061606
else if(statement=="pop" || statement=="pop2")
16071607
{
1608-
// these are skips
1609-
c=code_skipt();
1610-
1611-
// pop2 removes two single-word items from the stack (e.g. two
1612-
// integers, or an integer and an object reference) or one
1613-
// two-word item (i.e. a double or a long).
1614-
// http://cs.au.dk/~mis/dOvs/jvmspec/ref-pop2.html
1615-
if(statement=="pop2" &&
1616-
get_bytecode_type_width(op[0].type())==32)
1617-
pop(1);
1608+
c = convert_pop(statement, op);
16181609
}
16191610
else if(statement=="instanceof")
16201611
{
@@ -1884,6 +1875,22 @@ codet java_bytecode_convert_methodt::convert_instructions(
18841875
return code;
18851876
}
18861877

1878+
codet java_bytecode_convert_methodt::convert_pop(
1879+
const irep_idt &statement,
1880+
const exprt::operandst &op)
1881+
{
1882+
// these are skips
1883+
codet c = code_skipt();
1884+
1885+
// pop2 removes two single-word items from the stack (e.g. two
1886+
// integers, or an integer and an object reference) or one
1887+
// two-word item (i.e. a double or a long).
1888+
// http://cs.au.dk/~mis/dOvs/jvmspec/ref-pop2.html
1889+
if(statement == "pop2" && get_bytecode_type_width(op[0].type()) == 32)
1890+
pop(1);
1891+
return c;
1892+
}
1893+
18871894
codet java_bytecode_convert_methodt::convert_switch(
18881895
java_bytecode_convert_methodt::address_mapt &address_map,
18891896
const std::vector<java_bytecode_parse_treet::instructiont>::const_iterator

jbmc/src/java_bytecode/java_bytecode_convert_method_class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,5 +468,7 @@ class java_bytecode_convert_methodt:public messaget
468468
const std::vector<java_bytecode_parse_treet::instructiont>::const_iterator
469469
&i_it,
470470
const exprt::operandst &op);
471+
472+
codet convert_pop(const irep_idt &statement, const exprt::operandst &op);
471473
};
472474
#endif

0 commit comments

Comments
 (0)