Skip to content

Commit 1b47689

Browse files
committed
Improve documentation and omit two unused parameters
No functional changes intended here.
1 parent 4fc60e7 commit 1b47689

File tree

3 files changed

+27
-54
lines changed

3 files changed

+27
-54
lines changed

src/java_bytecode/java_bytecode_instrument.cpp

Lines changed: 21 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,11 @@ class java_bytecode_instrumentt:public messaget
2929
java_bytecode_instrumentt(
3030
symbol_tablet &_symbol_table,
3131
const bool _throw_runtime_exceptions,
32-
message_handlert &_message_handler,
33-
const size_t _max_array_length,
34-
const size_t _max_tree_depth):
32+
message_handlert &_message_handler):
3533
messaget(_message_handler),
3634
symbol_table(_symbol_table),
3735
throw_runtime_exceptions(_throw_runtime_exceptions),
38-
message_handler(_message_handler),
39-
max_array_length(_max_array_length),
40-
max_tree_depth(_max_tree_depth)
36+
message_handler(_message_handler)
4137
{
4238
}
4339

@@ -47,8 +43,6 @@ class java_bytecode_instrumentt:public messaget
4743
symbol_tablet &symbol_table;
4844
const bool throw_runtime_exceptions;
4945
message_handlert &message_handler;
50-
const size_t max_array_length;
51-
const size_t max_tree_depth;
5246

5347
codet throw_exception(
5448
const exprt &cond,
@@ -570,28 +564,23 @@ void java_bytecode_instrumentt::operator()(exprt &expr)
570564
/// runtime exceptions or corresponding assertions.
571565
/// Exceptions are thrown when the `throw_runtime_exceptions` flag is set.
572566
/// Otherwise, assertions are emitted.
573-
/// \par parameters: `symbol_table`: global symbol table (may gain exception type
574-
/// stubs and similar)
575-
/// `symbol`: the symbol to instrument
576-
/// `throw_runtime_exceptions`: flag determining whether we instrument the code
577-
/// with runtime exceptions or with assertions. The former applies if this flag
578-
/// is set to true.
579-
/// `max_array_length`: maximum array length; the only reason we need this is
580-
/// in order to be able to call the object factory to create exceptions.
581-
void java_bytecode_instrument(
567+
/// \param symbol_table: global symbol table (may gain exception type stubs and
568+
/// similar)
569+
/// \param symbol: the symbol to instrument
570+
/// \param throw_runtime_exceptions: flag determining whether we instrument the
571+
/// code with runtime exceptions or with assertions. The former applies if
572+
/// this flag is set to true.
573+
/// \param message_handler: stream to report status and warnings
574+
void java_bytecode_instrument_symbol(
582575
symbol_tablet &symbol_table,
583576
symbolt &symbol,
584577
const bool throw_runtime_exceptions,
585-
message_handlert &message_handler,
586-
const size_t max_array_length,
587-
const size_t max_tree_depth)
578+
message_handlert &message_handler)
588579
{
589580
java_bytecode_instrumentt instrument(
590581
symbol_table,
591582
throw_runtime_exceptions,
592-
message_handler,
593-
max_array_length,
594-
max_tree_depth);
583+
message_handler);
595584
INVARIANT(
596585
symbol.value.id()==ID_code,
597586
"java_bytecode_instrument expects a code-typed symbol");
@@ -602,25 +591,21 @@ void java_bytecode_instrument(
602591
/// runtime exceptions or corresponding assertions.
603592
/// Exceptions are thrown when the `throw_runtime_exceptions` flag is set.
604593
/// Otherwise, assertions are emitted.
605-
/// \par parameters: `symbol_table`: the symbol table to instrument
606-
/// `throw_runtime_exceptions`: flag determining whether we instrument the code
607-
/// with runtime exceptions or with assertions. The former applies if this flag
608-
/// is set to true.
609-
/// `max_array_length`: maximum array length; the only reason we need this is
610-
/// in order to be able to call the object factory to create exceptions.
594+
/// \param symbol_table: global symbol table, all of whose code members
595+
/// will be annotated (may gain exception type stubs and similar)
596+
/// \param throw_runtime_exceptions: flag determining whether we instrument the
597+
/// code with runtime exceptions or with assertions. The former applies if
598+
/// this flag is set to true.
599+
/// \param message_handler: stream to report status and warnings
611600
void java_bytecode_instrument(
612601
symbol_tablet &symbol_table,
613602
const bool throw_runtime_exceptions,
614-
message_handlert &message_handler,
615-
const size_t max_array_length,
616-
const size_t max_tree_depth)
603+
message_handlert &message_handler)
617604
{
618605
java_bytecode_instrumentt instrument(
619606
symbol_table,
620607
throw_runtime_exceptions,
621-
message_handler,
622-
max_array_length,
623-
max_tree_depth);
608+
message_handler);
624609

625610
std::vector<irep_idt> symbols_to_instrument;
626611
forall_symbols(s_it, symbol_table.symbols)
@@ -632,9 +617,5 @@ void java_bytecode_instrument(
632617
// instrument(...) can add symbols to the table, so it's
633618
// not safe to hold a reference to a symbol across a call.
634619
for(const auto &symbol : symbols_to_instrument)
635-
{
636-
exprt value=symbol_table.lookup(symbol).value;
637-
instrument(value);
638-
symbol_table.lookup(symbol).value=value;
639-
}
620+
instrument(symbol_table.lookup(symbol).value);
640621
}

src/java_bytecode/java_bytecode_instrument.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,15 @@ Date: June 2017
1111
#ifndef CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_INSTRUMENT_H
1212
#define CPROVER_JAVA_BYTECODE_JAVA_BYTECODE_INSTRUMENT_H
1313

14-
void java_bytecode_instrument(
14+
void java_bytecode_instrument_symbol(
1515
symbol_tablet &symbol_table,
1616
symbolt &symbol,
1717
const bool throw_runtime_exceptions,
18-
message_handlert &_message_handler,
19-
const size_t max_array_length,
20-
const size_t max_depth);
18+
message_handlert &_message_handler);
2119

2220
void java_bytecode_instrument(
2321
symbol_tablet &symbol_table,
2422
const bool throw_runtime_exceptions,
25-
message_handlert &_message_handler,
26-
const size_t max_array_length,
27-
const size_t max_depth);
23+
message_handlert &_message_handler);
2824

2925
#endif

src/java_bytecode/java_bytecode_language.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,7 @@ bool java_bytecode_languaget::typecheck(
459459
java_bytecode_instrument(
460460
symbol_table,
461461
throw_runtime_exceptions,
462-
get_message_handler(),
463-
max_nondet_array_length,
464-
max_nondet_tree_depth);
462+
get_message_handler());
465463

466464
// now typecheck all
467465
if(java_bytecode_typecheck(
@@ -748,13 +746,11 @@ void java_bytecode_languaget::replace_string_methods(
748746
symbol.value=generated_code;
749747
// Specifically instrument the new code, since this comes after the
750748
// blanket instrumentation pass called before typechecking.
751-
java_bytecode_instrument(
749+
java_bytecode_instrument_symbol(
752750
context,
753751
symbol,
754752
throw_runtime_exceptions,
755-
get_message_handler(),
756-
max_nondet_array_length,
757-
max_nondet_tree_depth);
753+
get_message_handler());
758754
}
759755
}
760756
}

0 commit comments

Comments
 (0)