Skip to content

Commit 7fee670

Browse files
committed
extract java bytecode convert method class
This extracts the convert method class into an extra file.
1 parent af23573 commit 7fee670

6 files changed

+340
-58
lines changed

src/java_bytecode/java_bytecode_convert_class.cpp

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class java_bytecode_convert_classt:public messaget
2727
java_bytecode_convert_classt(
2828
symbol_tablet &_symbol_table,
2929
message_handlert &_message_handler,
30-
const bool &_disable_runtime_checks,
31-
int _max_array_length):
30+
const bool _disable_runtime_checks,
31+
size_t _max_array_length):
3232
messaget(_message_handler),
3333
symbol_table(_symbol_table),
3434
disable_runtime_checks(_disable_runtime_checks),
@@ -51,8 +51,8 @@ class java_bytecode_convert_classt:public messaget
5151

5252
protected:
5353
symbol_tablet &symbol_table;
54-
const bool &disable_runtime_checks;
55-
int max_array_length;
54+
const bool disable_runtime_checks;
55+
size_t max_array_length;
5656

5757
// conversion
5858
void convert(const classt &c);
@@ -127,8 +127,12 @@ void java_bytecode_convert_classt::convert(const classt &c)
127127
// now do methods
128128
for(const auto &method : c.methods)
129129
java_bytecode_convert_method(
130-
*class_symbol, method, symbol_table, get_message_handler(),
131-
disable_runtime_checks, max_array_length);
130+
*class_symbol,
131+
method,
132+
symbol_table,
133+
get_message_handler(),
134+
disable_runtime_checks,
135+
max_array_length);
132136

133137
// is this a root class?
134138
if(c.extends.empty())
@@ -271,9 +275,6 @@ void java_bytecode_convert_classt::add_array_types()
271275
// we have the base class, java.lang.Object, length and data
272276
// of appropriate type
273277
struct_type.set_tag(symbol_type.get_identifier());
274-
<<<<<<< d8b7f7885387d26f7031f56b237aa96e25733f6d
275-
276-
struct_type.components().reserve(3);
277278
struct_typet::componentt
278279
comp0("@java.lang.Object", symbol_typet("java::java.lang.Object"));
279280
struct_type.components().push_back(comp0);
@@ -284,18 +285,6 @@ void java_bytecode_convert_classt::add_array_types()
284285
struct_typet::componentt
285286
comp2("data", pointer_typet(java_type_from_char(l)));
286287
struct_type.components().push_back(comp2);
287-
=======
288-
struct_type.components().resize(3);
289-
struct_type.components()[0].set_name("@java.lang.Object");
290-
struct_type.components()[0].type()=symbol_typet("java::java.lang.Object");
291-
struct_type.components()[1].set_name("length");
292-
struct_type.components()[1].set_pretty_name("length");
293-
struct_type.components()[1].type()=java_int_type();
294-
struct_type.components()[2].set_name("data");
295-
struct_type.components()[2].set_pretty_name("data");
296-
struct_type.components()[2].type()=
297-
pointer_typet(java_type_from_char(letters[i]));
298-
>>>>>>> class conversion runtime checks / array handling
299288

300289
symbolt symbol;
301290
symbol.name=symbol_type.get_identifier();
@@ -320,16 +309,16 @@ Function: java_bytecode_convert_class
320309

321310
bool java_bytecode_convert_class(
322311
const java_bytecode_parse_treet &parse_tree,
323-
const bool &disable_runtime_checks,
324312
symbol_tablet &symbol_table,
325313
message_handlert &message_handler,
326-
int max_array_length)
314+
const bool disable_runtime_checks,
315+
size_t max_array_length)
327316
{
328317
java_bytecode_convert_classt java_bytecode_convert_class(
329-
symbol_table,
330-
message_handler,
331-
disable_runtime_checks,
332-
max_array_length);
318+
symbol_table,
319+
message_handler,
320+
disable_runtime_checks,
321+
max_array_length);
333322

334323
try
335324
{

src/java_bytecode/java_bytecode_convert_class.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ Author: Daniel Kroening, [email protected]
1616

1717
bool java_bytecode_convert_class(
1818
const java_bytecode_parse_treet &parse_tree,
19-
const bool &disable_runtime_checks,
2019
symbol_tablet &symbol_table,
2120
message_handlert &message_handler,
22-
int max_array_length);
21+
const bool disable_runtime_checks,
22+
size_t max_array_length);
2323

2424
#endif // CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_CONVERT_CLASS_H

0 commit comments

Comments
 (0)