Skip to content

Commit e996563

Browse files
Extract convert_dup2_x1 function
1 parent 3f789a5 commit e996563

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,14 +1492,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
14921492
else if(statement=="dup2_x1")
14931493
{
14941494
PRECONDITION(!stack.empty() && results.empty());
1495-
1496-
if(get_bytecode_type_width(stack.back().type())==32)
1497-
op=pop(3);
1498-
else
1499-
op=pop(2);
1500-
1501-
results.insert(results.end(), op.begin()+1, op.end());
1502-
results.insert(results.end(), op.begin(), op.end());
1495+
convert_dup2_x1(op, results);
15031496
}
15041497
else if(statement=="dup2_x2")
15051498
{
@@ -1962,6 +1955,19 @@ void java_bytecode_convert_methodt::convert_dup2(
19621955
results.insert(results.end(), op.begin(), op.end());
19631956
}
19641957

1958+
void java_bytecode_convert_methodt::convert_dup2_x1(
1959+
exprt::operandst &op,
1960+
exprt::operandst &results)
1961+
{
1962+
if(get_bytecode_type_width(stack.back().type()) == 32)
1963+
op = pop(3);
1964+
else
1965+
op = pop(2);
1966+
1967+
results.insert(results.end(), op.begin() + 1, op.end());
1968+
results.insert(results.end(), op.begin(), op.end());
1969+
}
1970+
19651971
exprt::operandst &java_bytecode_convert_methodt::convert_const(
19661972
const irep_idt &statement,
19671973
exprt &arg0,

jbmc/src/java_bytecode/java_bytecode_convert_method_class.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ class java_bytecode_convert_methodt:public messaget
457457
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)