Skip to content

Commit 110461d

Browse files
Extract convert_pop function
1 parent 6a79aa2 commit 110461d

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
@@ -1624,16 +1624,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
16241624
}
16251625
else if(statement=="pop" || statement=="pop2")
16261626
{
1627-
// these are skips
1628-
c=code_skipt();
1629-
1630-
// pop2 removes two single-word items from the stack (e.g. two
1631-
// integers, or an integer and an object reference) or one
1632-
// two-word item (i.e. a double or a long).
1633-
// http://cs.au.dk/~mis/dOvs/jvmspec/ref-pop2.html
1634-
if(statement=="pop2" &&
1635-
get_bytecode_type_width(op[0].type())==32)
1636-
pop(1);
1627+
c = convert_pop(statement, op);
16371628
}
16381629
else if(statement=="instanceof")
16391630
{
@@ -1903,6 +1894,22 @@ codet java_bytecode_convert_methodt::convert_instructions(
19031894
return code;
19041895
}
19051896

1897+
codet java_bytecode_convert_methodt::convert_pop(
1898+
const irep_idt &statement,
1899+
const exprt::operandst &op)
1900+
{
1901+
// these are skips
1902+
codet c = code_skipt();
1903+
1904+
// pop2 removes two single-word items from the stack (e.g. two
1905+
// integers, or an integer and an object reference) or one
1906+
// two-word item (i.e. a double or a long).
1907+
// http://cs.au.dk/~mis/dOvs/jvmspec/ref-pop2.html
1908+
if(statement == "pop2" && get_bytecode_type_width(op[0].type()) == 32)
1909+
pop(1);
1910+
return c;
1911+
}
1912+
19061913
codet java_bytecode_convert_methodt::convert_switch(
19071914
java_bytecode_convert_methodt::address_mapt &address_map,
19081915
const exprt::operandst &op,

jbmc/src/java_bytecode/java_bytecode_convert_method_class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,5 +471,7 @@ class java_bytecode_convert_methodt:public messaget
471471
const exprt::operandst &op,
472472
const java_bytecode_parse_treet::instructiont::argst &args,
473473
const source_locationt &location);
474+
475+
codet convert_pop(const irep_idt &statement, const exprt::operandst &op);
474476
};
475477
#endif

0 commit comments

Comments
 (0)