Skip to content

Commit c486bb0

Browse files
Extract convert_dup2_x1 function
1 parent eba0631 commit c486bb0

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,14 +1507,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
15071507
else if(statement=="dup2_x1")
15081508
{
15091509
PRECONDITION(!stack.empty() && results.empty());
1510-
1511-
if(get_bytecode_type_width(stack.back().type())==32)
1512-
op=pop(3);
1513-
else
1514-
op=pop(2);
1515-
1516-
results.insert(results.end(), op.begin()+1, op.end());
1517-
results.insert(results.end(), op.begin(), op.end());
1510+
convert_dup2_x1(op, results);
15181511
}
15191512
else if(statement=="dup2_x2")
15201513
{
@@ -1977,6 +1970,19 @@ void java_bytecode_convert_methodt::convert_dup2(
19771970
results.insert(results.end(), op.begin(), op.end());
19781971
}
19791972

1973+
void java_bytecode_convert_methodt::convert_dup2_x1(
1974+
exprt::operandst &op,
1975+
exprt::operandst &results)
1976+
{
1977+
if(get_bytecode_type_width(stack.back().type()) == 32)
1978+
op = pop(3);
1979+
else
1980+
op = pop(2);
1981+
1982+
results.insert(results.end(), op.begin() + 1, op.end());
1983+
results.insert(results.end(), op.begin(), op.end());
1984+
}
1985+
19801986
exprt::operandst &java_bytecode_convert_methodt::convert_const(
19811987
const irep_idt &statement,
19821988
const exprt &arg0,

jbmc/src/java_bytecode/java_bytecode_convert_method_class.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,9 @@ class java_bytecode_convert_methodt:public messaget
459459
const exprt &arg0,
460460
exprt::operandst &results) const;
461461

462+
void
463+
convert_dup2_x1(exprt::operandst &op, exprt::operandst &results);
464+
462465
void convert_dup2(exprt::operandst &op, exprt::operandst &results);
463466
};
464467
#endif

0 commit comments

Comments
 (0)