Skip to content

Commit 1f67b6c

Browse files
Extract convert_dup2 function
1 parent 9de8f23 commit 1f67b6c

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

src/java_bytecode/java_bytecode_convert_method.cpp

+14-8
Original file line numberDiff line numberDiff line change
@@ -1474,14 +1474,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
14741474
else if(statement=="dup2")
14751475
{
14761476
PRECONDITION(!stack.empty() && results.empty());
1477-
1478-
if(get_bytecode_type_width(stack.back().type())==32)
1479-
op=pop(2);
1480-
else
1481-
op=pop(1);
1482-
1483-
results.insert(results.end(), op.begin(), op.end());
1484-
results.insert(results.end(), op.begin(), op.end());
1477+
convert_dup2(op, results);
14851478
}
14861479
else if(statement=="dup2_x1")
14871480
{
@@ -1943,6 +1936,19 @@ codet java_bytecode_convert_methodt::convert_instructions(
19431936
return code;
19441937
}
19451938

1939+
void java_bytecode_convert_methodt::convert_dup2(
1940+
exprt::operandst &op,
1941+
exprt::operandst &results)
1942+
{
1943+
if(get_bytecode_type_width(stack.back().type()) == 32)
1944+
op = pop(2);
1945+
else
1946+
op = pop(1);
1947+
1948+
results.insert(results.end(), op.begin(), op.end());
1949+
results.insert(results.end(), op.begin(), op.end());
1950+
}
1951+
19461952
exprt::operandst &java_bytecode_convert_methodt::convert_const(
19471953
const irep_idt &statement,
19481954
exprt &arg0,

src/java_bytecode/java_bytecode_convert_method_class.h

+2
Original file line numberDiff line numberDiff line change
@@ -454,5 +454,7 @@ class java_bytecode_convert_methodt:public messaget
454454
const irep_idt &statement,
455455
exprt &arg0,
456456
exprt::operandst &results) const;
457+
458+
void convert_dup2(exprt::operandst &op, exprt::operandst &results);
457459
};
458460
#endif

0 commit comments

Comments
 (0)