Skip to content

Commit 3d3a892

Browse files
Multi-path checker for Java requires preprocessing
1 parent 97e04cf commit 3d3a892

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

jbmc/src/java_bytecode/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SRC = bytecode_info.cpp \
2525
java_enum_static_init_unwind_handler.cpp \
2626
java_entry_point.cpp \
2727
java_local_variable_table.cpp \
28+
java_multi_path_symex_checker.cpp \
2829
java_multi_path_symex_only_checker.cpp \
2930
java_object_factory.cpp \
3031
java_object_factory_parameters.cpp \
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*******************************************************************\
2+
3+
Module: Goto Checker using Bounded Model Checking for Java
4+
5+
Author: Daniel Kroening, Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Goto Checker using Bounded Model Checking for Java
11+
12+
#include "java_multi_path_symex_checker.h"
13+
14+
#include <java_bytecode/java_enum_static_init_unwind_handler.h>
15+
16+
java_multi_path_symex_checkert::java_multi_path_symex_checkert(
17+
const optionst &options,
18+
ui_message_handlert &ui_message_handler,
19+
abstract_goto_modelt &goto_model)
20+
: multi_path_symex_checkert(options, ui_message_handler, goto_model)
21+
{
22+
// unwinds <clinit> loops to number of enum elements
23+
if(options.get_bool_option("java-unwind-enum-static"))
24+
{
25+
// clang-format off
26+
// (it asks for the body to be at the same indent level as the parameters
27+
// for some reason)
28+
symex.add_loop_unwind_handler(
29+
[&goto_model](
30+
const goto_symex_statet::call_stackt &context,
31+
unsigned loop_num,
32+
unsigned unwind,
33+
unsigned &max_unwind)
34+
{ // NOLINT (*)
35+
return java_enum_static_init_unwind_handler(
36+
context, loop_num, unwind, max_unwind, goto_model.get_symbol_table());
37+
});
38+
// clang-format on
39+
}
40+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*******************************************************************\
2+
3+
Module: Goto Checker using Bounded Model Checking for Java
4+
5+
Author: Daniel Kroening, Peter Schrammel
6+
7+
\*******************************************************************/
8+
9+
/// \file
10+
/// Goto Checker using Bounded Model Checking for Java
11+
12+
#ifndef CPROVER_JAVA_BYTECODE_JAVA_MULTI_PATH_SYMEX_CHECKER_H
13+
#define CPROVER_JAVA_BYTECODE_JAVA_MULTI_PATH_SYMEX_CHECKER_H
14+
15+
#include <goto-checker/multi_path_symex_checker.h>
16+
17+
class java_multi_path_symex_checkert : public multi_path_symex_checkert
18+
{
19+
public:
20+
java_multi_path_symex_checkert(
21+
const optionst &options,
22+
ui_message_handlert &ui_message_handler,
23+
abstract_goto_modelt &goto_model);
24+
};
25+
26+
#endif // CPROVER_JAVA_BYTECODE_JAVA_MULTI_PATH_SYMEX_CHECKER_H

0 commit comments

Comments
 (0)