Skip to content

Commit 6b519ad

Browse files
Add identifier and rename statement to java_new_array_data
This will be used as an alternative to java_new_array. This is to distinguish the statement before and after symex: java_new_array is used before symex, it is then transformed into some instrtuction containing a java_new_array_data by symex. Symex use to add a new java_new_array statement which was confusing.
1 parent ebabdb9 commit 6b519ad

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

src/goto-programs/builtin_functions.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,8 @@ void goto_convertt::do_java_new_array(
705705
else
706706
allocate_data_type=data.type();
707707

708-
side_effect_exprt data_java_new_expr(ID_java_new_array, allocate_data_type);
708+
side_effect_exprt data_java_new_expr(
709+
ID_java_new_array_data, allocate_data_type);
709710

710711
// The instruction may specify a (hopefully small) upper bound on the
711712
// array size, in which case we allocate a fixed-length array that may

src/goto-programs/goto_convert.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,10 @@ void goto_convertt::convert_assign(
760760

761761
do_java_new_array(lhs, to_side_effect_expr(rhs), dest);
762762
}
763-
else if(rhs.id()==ID_side_effect &&
764-
rhs.get(ID_statement)==ID_malloc)
763+
else if(
764+
rhs.id() == ID_side_effect &&
765+
(rhs.get(ID_statement) == ID_malloc ||
766+
rhs.get(ID_statement) == ID_java_new_array_data))
765767
{
766768
// just preserve
767769
Forall_operands(it, rhs)

src/goto-symex/symex_assign.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ void goto_symext::symex_assign(
5959

6060
throw "symex_assign: unexpected function call: "+id2string(identifier);
6161
}
62-
else if(statement==ID_cpp_new ||
63-
statement==ID_cpp_new_array ||
64-
statement==ID_java_new_array)
62+
else if(
63+
statement == ID_cpp_new || statement == ID_cpp_new_array ||
64+
statement == ID_java_new_array_data)
6565
symex_cpp_new(state, lhs, side_effect_expr);
6666
else if(statement==ID_malloc)
6767
symex_malloc(state, lhs, side_effect_expr);

src/goto-symex/symex_builtin_functions.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,9 @@ void goto_symext::symex_cpp_new(
376376
if(code.type().id()!=ID_pointer)
377377
throw "new expected to return pointer";
378378

379-
do_array=(code.get(ID_statement)==ID_cpp_new_array ||
380-
code.get(ID_statement)==ID_java_new_array);
379+
do_array =
380+
(code.get(ID_statement) == ID_cpp_new_array ||
381+
code.get(ID_statement) == ID_java_new_array_data);
381382

382383
dynamic_counter++;
383384

@@ -393,7 +394,7 @@ void goto_symext::symex_cpp_new(
393394
if(code.get(ID_statement)==ID_cpp_new_array ||
394395
code.get(ID_statement)==ID_cpp_new)
395396
symbol.mode=ID_cpp;
396-
else if(code.get(ID_statement)==ID_java_new_array)
397+
else if(code.get(ID_statement) == ID_java_new_array_data)
397398
symbol.mode=ID_java;
398399
else
399400
INVARIANT_WITH_IREP(false, "Unexpected side effect expression", code);

src/util/irep_ids.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ IREP_ID_TWO(cpp_new_array, cpp_new[])
217217
IREP_ID_TWO(cpp_delete_array, cpp_delete[])
218218
IREP_ID_ONE(java_new)
219219
IREP_ID_ONE(java_new_array)
220+
IREP_ID_ONE(java_new_array_data)
220221
IREP_ID_ONE(java_string_literal)
221222
IREP_ID_ONE(printf)
222223
IREP_ID_ONE(input)

0 commit comments

Comments
 (0)