Skip to content

Commit ba6f552

Browse files
Extract convert_dup2_x1 function
1 parent 1f67b6c commit ba6f552

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
@@ -1479,14 +1479,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
14791479
else if(statement=="dup2_x1")
14801480
{
14811481
PRECONDITION(!stack.empty() && results.empty());
1482-
1483-
if(get_bytecode_type_width(stack.back().type())==32)
1484-
op=pop(3);
1485-
else
1486-
op=pop(2);
1487-
1488-
results.insert(results.end(), op.begin()+1, op.end());
1489-
results.insert(results.end(), op.begin(), op.end());
1482+
convert_dup2_x1(op, results);
14901483
}
14911484
else if(statement=="dup2_x2")
14921485
{
@@ -1949,6 +1942,19 @@ void java_bytecode_convert_methodt::convert_dup2(
19491942
results.insert(results.end(), op.begin(), op.end());
19501943
}
19511944

1945+
void java_bytecode_convert_methodt::convert_dup2_x1(
1946+
exprt::operandst &op,
1947+
exprt::operandst &results)
1948+
{
1949+
if(get_bytecode_type_width(stack.back().type()) == 32)
1950+
op = pop(3);
1951+
else
1952+
op = pop(2);
1953+
1954+
results.insert(results.end(), op.begin() + 1, op.end());
1955+
results.insert(results.end(), op.begin(), op.end());
1956+
}
1957+
19521958
exprt::operandst &java_bytecode_convert_methodt::convert_const(
19531959
const irep_idt &statement,
19541960
exprt &arg0,

src/java_bytecode/java_bytecode_convert_method_class.h

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

458+
void convert_dup2_x1(exprt::operandst &op, exprt::operandst &results);
459+
458460
void convert_dup2(exprt::operandst &op, exprt::operandst &results);
459461
};
460462
#endif

0 commit comments

Comments
 (0)