Skip to content

Commit 7f5589c

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 8f93163 commit 7f5589c

File tree

15 files changed

+28
-16
lines changed

15 files changed

+28
-16
lines changed

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Author: Daniel Kroening, kroening@kroening.com
4444
void java_bytecode_languaget::get_language_options(const cmdlinet &cmd)
4545
{
4646
assume_inputs_non_null=cmd.isset("java-assume-inputs-non-null");
47-
string_refinement_enabled=cmd.isset("refine-strings");
47+
string_refinement_enabled=!cmd.isset("no-refine-strings");
4848
throw_runtime_exceptions=cmd.isset("java-throw-runtime-exceptions");
4949
assert_uncaught_exceptions = !cmd.isset("disable-uncaught-exception-check");
5050
throw_assertion_error = cmd.isset("throw-assertion-error");
@@ -68,7 +68,7 @@ void java_bytecode_languaget::get_language_options(const cmdlinet &cmd)
6868
max_user_array_length=std::stoi(cmd.get_value("java-max-vla-length"));
6969
if(cmd.isset("symex-driven-lazy-loading"))
7070
lazy_methods_mode=LAZY_METHODS_MODE_EXTERNAL_DRIVER;
71-
else if(cmd.isset("lazy-methods"))
71+
else if(!cmd.isset("no-lazy-methods"))
7272
lazy_methods_mode=LAZY_METHODS_MODE_CONTEXT_INSENSITIVE;
7373
else
7474
lazy_methods_mode=LAZY_METHODS_MODE_EAGER;

jbmc/src/java_bytecode/java_bytecode_language.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Author: Daniel Kroening, kroening@kroening.com
3636
"(java-max-input-tree-depth):" \
3737
"(java-max-vla-length):" \
3838
"(java-cp-include-files):" \
39-
"(lazy-methods)" \
39+
"(no-lazy-methods)" \
4040
"(lazy-methods-extra-entry-point):" \
4141
"(java-load-class):" \
4242
"(java-no-load-class):"
@@ -56,9 +56,11 @@ Author: Daniel Kroening, kroening@kroening.com
5656
" --java-max-vla-length limit the length of user-code-created arrays\n" /* NOLINT(*) */ \
5757
" --java-cp-include-files regexp or JSON list of files to load (with '@' prefix)\n" /* NOLINT(*) */ \
5858
" --lazy-methods only translate methods that appear to be reachable from\n" /* NOLINT(*) */ \
59-
" the --function entry point or main class\n" /* NOLINT(*) */ \
59+
" the --function entry point or main class (default)\n" /* NOLINT(*) */ \
6060
" Note --show-symbol-table/goto-functions/properties output\n"/* NOLINT(*) */ \
6161
" will be restricted to loaded methods in this case\n" /* NOLINT(*) */ \
62+
" --no-lazy-methods load and translate all methods given on the command line\n" /* NOLINT(*) */ \
63+
" and in --classpath\n" /* NOLINT(*) */ \
6264
" --lazy-methods-extra-entry-point METHODNAME\n" /* NOLINT(*) */ \
6365
" treat METHODNAME as a possible program entry point for\n" /* NOLINT(*) */ \
6466
" the purpose of lazy method loading\n" /* NOLINT(*) */ \

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 3 additions & 2 deletions
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,8 @@ 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+
" --refine-strings use string refinement (default)\n"
1140+
" --no-refine-strings turn off string refinement\n"
11401141
" --string-printable add constraint that strings are printable (experimental)\n" // NOLINT(*)
11411142
" --string-max-length add constraint on the length of strings\n" // NOLINT(*)
11421143
" --string-max-input-length add constraint on the length of input strings\n" // NOLINT(*)

jbmc/src/jbmc/jbmc_parse_options.h

Lines changed: 2 additions & 1 deletion
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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
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)"

0 commit comments

Comments
 (0)