Skip to content

Commit 27af4a2

Browse files
Extract convert_putfield function
1 parent f1edff9 commit 27af4a2

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

jbmc/src/java_bytecode/java_bytecode_convert_method.cpp

+17-10
Original file line numberDiff line numberDiff line change
@@ -1794,15 +1794,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
17941794
else if(statement=="putfield")
17951795
{
17961796
PRECONDITION(op.size() == 2 && results.empty());
1797-
code_blockt block;
1798-
save_stack_entries(
1799-
"stack_field",
1800-
op[1].type(),
1801-
block,
1802-
bytecode_write_typet::FIELD,
1803-
arg0.get(ID_component_name));
1804-
block.copy_to_operands(code_assignt(to_member(op[0], arg0), op[1]));
1805-
c=block;
1797+
c = convert_putfield(arg0, op);
18061798
}
18071799
else if(statement=="putstatic")
18081800
{
@@ -2433,8 +2425,23 @@ codet java_bytecode_convert_methodt::convert_instructions(
24332425
return code;
24342426
}
24352427

2428+
codet java_bytecode_convert_methodt::convert_putfield(
2429+
const exprt &arg0,
2430+
const exprt::operandst &op)
2431+
{
2432+
code_blockt block;
2433+
save_stack_entries(
2434+
"stack_field",
2435+
op[1].type(),
2436+
block,
2437+
bytecode_write_typet::FIELD,
2438+
arg0.get(ID_component_name));
2439+
block.copy_to_operands(code_assignt(to_member(op[0], arg0), op[1]));
2440+
return block;
2441+
}
2442+
24362443
void java_bytecode_convert_methodt::convert_getstatic(
2437-
exprt &arg0,
2444+
const exprt &arg0,
24382445
const symbol_exprt &symbol_expr,
24392446
const bool is_assertions_disabled_field,
24402447
codet &c,

jbmc/src/java_bytecode/java_bytecode_convert_method_class.h

+2
Original file line numberDiff line numberDiff line change
@@ -387,5 +387,7 @@ class java_bytecode_convert_methodt:public messaget
387387
bool is_assertions_disabled_field,
388388
codet &c,
389389
exprt::operandst &results);
390+
391+
codet convert_putfield(const exprt &arg0, const exprt::operandst &op);
390392
};
391393
#endif

0 commit comments

Comments
 (0)