Skip to content

Commit fb61109

Browse files
Make --lazy-methods and --refine-strings default
These options are always required in practical use cases. They can be disabled with --no-lazy-methods and --no-refine-strings if needed for regression tests.
1 parent 8f6dab8 commit fb61109

File tree

16 files changed

+40
-27
lines changed

16 files changed

+40
-27
lines changed

jbmc/regression/jbmc-strings/char_escape/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Test.class
33
--refine-strings --function Test.test --cover location --trace --json-ui
44
^EXIT=0$
55
^SIGNAL=0$
6-
20 of 23 covered \(87.0%\)|30 of 44 covered \(68.2%\)
6+
20 of 22 covered \(90.9%\)|30 of 44 covered \(68.2%\)

jbmc/regression/jbmc/annotations1/show_annotation_symbol.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE
22
annotations.class
3-
--verbosity 10 --show-symbol-table --function annotations.main
3+
--no-lazy-methods --verbosity 10 --show-symbol-table --function annotations.main
44
^EXIT=0$
55
^SIGNAL=0$
66
^Type\.\.\.\.\.\.\.\.: @java::ClassAnnotation struct annotations

jbmc/regression/jbmc/generic_class_bound1/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE symex-driven-lazy-loading-expected-failure
22
Gn.class
3-
--cover location
3+
--cover location --no-lazy-methods --no-refine-strings
44
^EXIT=0$
55
^SIGNAL=0$
66
.*file Gn.java line 6 function java::Gn.\<init\>:\(\)V bytecode-index 1 block .: FAILED

jbmc/regression/jbmc/lambda2/test_no_crash.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE symex-driven-lazy-loading-expected-failure
22
SymStream.class
3-
--verbosity 10 --show-goto-functions
3+
--no-lazy-methods --verbosity 10 --show-goto-functions
44
^EXIT=0
55
^SIGNAL=0
66
--

jbmc/regression/jbmc/lazyloading_synthetic_method_cleanup1/check_clinit_normally_present.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE symex-driven-lazy-loading-expected-failure
22
Test.class
3-
--show-goto-functions --function Test.main
3+
--no-lazy-methods --show-goto-functions --function Test.main
44
java::Unused::clinit_wrapper
55
Unused\.<clinit>\(\)
66
^EXIT=0$

jbmc/regression/jbmc/lazyloading_synthetic_method_cleanup2/check_clinit_normally_present.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE symex-driven-lazy-loading-expected-failure
22
Test.class
3-
--show-goto-functions --function Test.main
3+
--no-lazy-methods --show-goto-functions --function Test.main
44
java::Unused1::clinit_wrapper
55
java::Unused2::clinit_wrapper
66
Unused2\.<clinit>\(\)

jbmc/regression/jbmc/lazyloading_synthetic_method_cleanup3/check_clinit_normally_present.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE symex-driven-lazy-loading-expected-failure
22
Test.class
3-
--show-goto-functions --function Test.main
3+
--no-lazy-methods --show-goto-functions --function Test.main
44
java::Opaque\.<clinit>:\(\)V
55
java::Opaque::clinit_wrapper
66
^EXIT=0$

jbmc/regression/jbmc/lvt-groovy/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE symex-driven-lazy-loading-expected-failure
22
DetectSplitPackagesTask.class
3-
--show-symbol-table
3+
--show-symbol-table --no-lazy-methods --no-refine-strings
44
^EXIT=0$
55
^SIGNAL=0$
66
--

jbmc/regression/jbmc/provide_object_implementation/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE symex-driven-lazy-loading-expected-failure
22
java/lang/Object.class
3-
3+
--no-lazy-methods
44
^EXIT=6$
55
^SIGNAL=0$
66
^the program has no entry point$

jbmc/src/java_bytecode/java_bytecode_language.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Author: Daniel Kroening, [email protected]
4545
void java_bytecode_languaget::get_language_options(const cmdlinet &cmd)
4646
{
4747
assume_inputs_non_null=cmd.isset("java-assume-inputs-non-null");
48-
string_refinement_enabled=cmd.isset("refine-strings");
48+
string_refinement_enabled = !cmd.isset("no-refine-strings");
4949
throw_runtime_exceptions=cmd.isset("java-throw-runtime-exceptions");
5050
assert_uncaught_exceptions = !cmd.isset("disable-uncaught-exception-check");
5151
throw_assertion_error = cmd.isset("throw-assertion-error");
@@ -69,7 +69,7 @@ void java_bytecode_languaget::get_language_options(const cmdlinet &cmd)
6969
max_user_array_length=std::stoi(cmd.get_value("java-max-vla-length"));
7070
if(cmd.isset("symex-driven-lazy-loading"))
7171
lazy_methods_mode=LAZY_METHODS_MODE_EXTERNAL_DRIVER;
72-
else if(cmd.isset("lazy-methods"))
72+
else if(!cmd.isset("no-lazy-methods"))
7373
lazy_methods_mode=LAZY_METHODS_MODE_CONTEXT_INSENSITIVE;
7474
else
7575
lazy_methods_mode=LAZY_METHODS_MODE_EAGER;

jbmc/src/java_bytecode/java_bytecode_language.h

+7-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ Author: Daniel Kroening, [email protected]
3636
"(java-max-input-tree-depth):" \
3737
"(java-max-vla-length):" \
3838
"(java-cp-include-files):" \
39-
"(lazy-methods)" \
39+
"(lazy-methods)" /* will go away */ \
40+
"(no-lazy-methods)" \
4041
"(lazy-methods-extra-entry-point):" \
4142
"(java-load-class):" \
4243
"(java-no-load-class):"
@@ -55,10 +56,12 @@ Author: Daniel Kroening, [email protected]
5556
" the object\n" /* NOLINT(*) */ \
5657
" --java-max-vla-length limit the length of user-code-created arrays\n" /* NOLINT(*) */ \
5758
" --java-cp-include-files regexp or JSON list of files to load (with '@' prefix)\n" /* NOLINT(*) */ \
58-
" --lazy-methods only translate methods that appear to be reachable from\n" /* NOLINT(*) */ \
59-
" the --function entry point or main class\n" /* NOLINT(*) */ \
59+
" --no-lazy-methods load and translate all methods given on the command line\n" /* NOLINT(*) */ \
60+
" and in --classpath\n" /* NOLINT(*) */ \
61+
" Default is to load methods that appear to be\n" /* NOLINT(*) */ \
62+
" reachable from the --function entry point or main class\n" /* NOLINT(*) */ \
6063
" Note --show-symbol-table/goto-functions/properties output\n"/* NOLINT(*) */ \
61-
" will be restricted to loaded methods in this case\n" /* NOLINT(*) */ \
64+
" are restricted to loaded methods by default\n" /* NOLINT(*) */ \
6265
" --lazy-methods-extra-entry-point METHODNAME\n" /* NOLINT(*) */ \
6366
" treat METHODNAME as a possible program entry point for\n" /* NOLINT(*) */ \
6467
" the purpose of lazy method loading\n" /* NOLINT(*) */ \

jbmc/src/jbmc/jbmc_parse_options.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ void jbmc_parse_optionst::get_command_line_options(optionst &options)
241241
options.set_option("refine-arithmetic", true);
242242
}
243243

244-
if(cmdline.isset("refine-strings"))
244+
if(!cmdline.isset("no-refine-strings"))
245245
{
246246
options.set_option("refine-strings", true);
247247
options.set_option("string-printable", cmdline.isset("string-printable"));
@@ -1136,7 +1136,7 @@ void jbmc_parse_optionst::help()
11361136
" --yices use Yices\n"
11371137
" --z3 use Z3\n"
11381138
" --refine use refinement procedure (experimental)\n"
1139-
" --refine-strings use string refinement (experimental)\n"
1139+
" --no-refine-strings turn off string refinement\n"
11401140
" --string-printable add constraint that strings are printable (experimental)\n" // NOLINT(*)
11411141
" --string-max-length add constraint on the length of strings\n" // NOLINT(*)
11421142
" --string-max-input-length add constraint on the length of input strings\n" // NOLINT(*)

jbmc/src/jbmc/jbmc_parse_options.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class optionst;
5555
"(no-sat-preprocessor)" \
5656
"(beautify)" \
5757
"(dimacs)(refine)(max-node-refinement):(refine-arrays)(refine-arithmetic)"\
58-
"(refine-strings)" \
58+
"(refine-strings)" /* will go away */ \
59+
"(no-refine-strings)" \
5960
"(string-printable)" \
6061
"(string-max-length):" \
6162
"(string-max-input-length):" \

jbmc/src/jdiff/jdiff_parse_options.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ void jdiff_parse_optionst::get_command_line_options(optionst &options)
8787
exit(1);
8888
}
8989

90+
// TODO: improve this when language front ends have been
91+
// disentangled from command line parsing
92+
// we always require these options
93+
cmdline.set("no-lazy-methods");
94+
cmdline.set("no-refine-strings");
95+
9096
if(cmdline.isset("cover"))
9197
parse_cover_options(cmdline, options);
9298

jbmc/src/jdiff/jdiff_parse_options.h

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class optionst;
3535
OPT_GOTO_CHECK \
3636
"(cover):" \
3737
"(verbosity):(version)" \
38+
"(no-lazy-methods)" /* should go away */ \
39+
"(no-refine-strings)" /* should go away */ \
3840
OPT_TIMESTAMP \
3941
"u(unified)(change-impact)(forward-impact)(backward-impact)" \
4042
"(compact-output)"

jbmc/unit/java-testing-utils/load_java_class.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,10 @@ symbol_tablet load_java_class_lazy(
3838
const std::string &class_path,
3939
const std::string &main)
4040
{
41-
free_form_cmdlinet lazy_command_line;
42-
lazy_command_line.add_flag("lazy-methods");
43-
4441
register_language(new_java_bytecode_language);
4542

4643
return load_java_class(
47-
java_class_name,
48-
class_path,
49-
main,
50-
get_language_from_mode(ID_java),
51-
lazy_command_line);
44+
java_class_name, class_path, main, get_language_from_mode(ID_java));
5245
}
5346

5447
/// Go through the process of loading, type-checking and finalising loading a
@@ -65,10 +58,18 @@ symbol_tablet load_java_class(
6558
const std::string &class_path,
6659
const std::string &main)
6760
{
61+
free_form_cmdlinet command_line;
62+
command_line.add_flag("no-lazy-methods");
63+
command_line.add_flag("no-refine-strings");
64+
6865
register_language(new_java_bytecode_language);
6966

7067
return load_java_class(
71-
java_class_name, class_path, main, get_language_from_mode(ID_java));
68+
java_class_name,
69+
class_path,
70+
main,
71+
get_language_from_mode(ID_java),
72+
command_line);
7273
}
7374

7475
/// Go through the process of loading, type-checking and finalising loading a

0 commit comments

Comments
 (0)