Skip to content

Commit 66cf709

Browse files
Extract convert_dup2_x1 function
1 parent e0735af commit 66cf709

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

+14-8
Original file line numberDiff line numberDiff line change
@@ -1509,14 +1509,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
15091509
else if(statement=="dup2_x1")
15101510
{
15111511
PRECONDITION(!stack.empty() && results.empty());
1512-
1513-
if(get_bytecode_type_width(stack.back().type())==32)
1514-
op=pop(3);
1515-
else
1516-
op=pop(2);
1517-
1518-
results.insert(results.end(), op.begin()+1, op.end());
1519-
results.insert(results.end(), op.begin(), op.end());
1512+
convert_dup2_x1(op, results);
15201513
}
15211514
else if(statement=="dup2_x2")
15221515
{
@@ -1979,6 +1972,19 @@ void java_bytecode_convert_methodt::convert_dup2(
19791972
results.insert(results.end(), op.begin(), op.end());
19801973
}
19811974

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

jbmc/src/java_bytecode/java_bytecode_convert_method_class.h

+2
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ class java_bytecode_convert_methodt:public messaget
457457
const exprt &arg0,
458458
exprt::operandst &results) const;
459459

460+
void convert_dup2_x1(exprt::operandst &op, exprt::operandst &results);
461+
460462
void convert_dup2(exprt::operandst &op, exprt::operandst &results);
461463
};
462464
#endif

0 commit comments

Comments
 (0)