tools/bootcheck:
Set the diff options to strip trailing carriage returns on all native
Windows configurations, not just the ones available through MSYS2.
compiler/switch_detection.m:
Add conditionally-enabled code to gather statistics about
what happens when a switch candidate has disjuncts left over,
and we test whether these leftovers form a switch on another variable.
(The results show that after 99.91% of switch candidates,
there are *no* disjuncts left over.)
compiler/mercury_compile_main.m:
Invoke the predicate that writes out any statistics we gathered.
tools/switch_depth:
This new summarizes the results.
MSYS2's MSYS environment is similar to Cygwin and shares a lot of its
underlying code. Executables in this environment are linked with
msys-2.0.dll, which is a POSIX-emulation layer similar to cygwin1.dll.
The change of configuration triple for this environment last year from
x86_64-pc-msys to x86_64-pc-cygwin means that we can trivially support
Mercury in it by virtue of the fact that we already support Cygwin.
This diff makes some changes required to allow Mercury to bootcheck in
the MSYS2 MSYS environment.
configure.ac:
Modify the error message we print if we detect *-pc-msys
architecture.
tools/bootcheck:
Do not abort if we detect the MSYS2 MSYS environment.
Extend the comment describing the handling of the different MSYS2
environment.
Give a variable a more accurate name.
Mmake.common.in:
RELEASE_NOTES:
configure.ac:
scripts/mgnuc.in:
tools/bootcheck:
tools/configure_cross:
tools/copy_mercury_binaries:
Conform to the recent change that moved most of the README files into the
Documentation directory.
tools/bootcheck:
With --no-bootcheck in the Java grade, do not pass any runtime
options. The Java version of the runtime only supports a very
small subset of the options.
Mmake.common.in:
Before this diff, there were a whole bunch of definitions between
the inclusion of Mmake.workspace and the inclusion of Mmake.params.
Move all those definitions elsewhere. Specifically, move the definitions
whose right hand sides are autoconfigured values, and which are NOT
also set by Mmake.workspace, to before both inclusions, moving related
non-autoconfigure variable definitions with them, while moving
other definitions to after both inclusions.
Document the cause of the "phasing problem" that kept the inclusion
of Mmake.params after the inclusion of Mmake.workspace (the definition
of MC), and a possible solution.
tools/stdlines_for_sh:
Add a version of stdlines for sh scripts.
runtime/mercury_grade.h:
Rename the grade modifier, and the C macro that represents it.
compiler/options.m:
Rename the --c-debug-grade option to --target-debug-grade.
compiler/compute_grade.m:
Rename the grade modifier, and the option that represents it.
Restrict the .target_debut grade modifier to MLDS grades.
compiler/handle_options.m:
Implement --target-debug-grade by having it imply --target-debug.
compiler/compile_target_code.m:
compiler/link_target_code.m:
Pay attention to either --target-debug-grade (for purposes related
to the grade itself) and to --target-debug (for all other purposes).
scripts/canonical_grade.in:
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Parse target_debug grade modifiers and --target-debug-grade options
instead of c_debug grade modifiers and --c-debug-grade options.
Add (normally commented-out) infrastructure to make it easier
to debug changes.
Restrict the .target_debut grade modifier to MLDS grades.
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
Rename some variables to clarify the distinction between the
--target-debug option (which, like -g, enabled debugging of only one file)
and the --target-debug-grade option (which enables it for the whole
program).
configure.ac:
Make it easier to debug grade-related changes by recording
both autoconfigured and user-supplied grades that the rejected by
the canonical_grade script.
Conform to the changes above.
README.sanitizers:
doc/user_guide.texi:
grade_lib/grade_spec.m:
grade_lib/grade_string.m:
scripts/ml.in:
tests/warnings/help_text.err_exp:
tools/lmc.in:
tools/test_mercury:
Conform to the changes above.
scripts/Mmake.vars.in:
Add some XXXs about style.
compiler/hlds_out_module.m:
If a new control boolean is set, then dump the contents of the cons_table.
Add a comment containing summary information derived from such dumps.
compiler/hlds_out_util.m:
Add this new control boolean.
compiler/check_options.m:
Allow the specification of this new control boolean.
compiler/hlds_cons.m:
Provide a utility predicate for giving hlds_out_module.m the info
it needs without making the structure of the cons_table public.
compiler/mercury_compile_llds_back_end.m:
Rename the final dump stage of the LLDS backend to "final", since
that is what the user guide documents. (The MLDS backend already had
this right.)
tools/cons_table.awk:
Add this script for summarizing dumped cons_tables.
tests/Mmake.common:
Bootchecks in the csharp and java grades, which use mmc --make
and --use-subdirs, have traditionally left all the Mercury directories
they constructed in tests/*. These screwed up any subsequent bootchecks
in other grades, because the mere presence of those directories
told the compiler to put their results in there, which was not always
what was wanted.
Fix this by
- deleting any Mercury directories before we start runtests in a test
directory,
- deleting any Mercury directories after runtests succeeds in a test
directory, and
- rename any Mercury directories after runtests fails in a test
directory, to Mercury.failed.
This last part allows any failures to be investigated and debugged,
without interfering with later bootchecks. (Though those later bootchecks
will delete any Mercury.failed directories, so they should be moved
elsewhere first if they may be needed later.)
tools/bootcheck:
Delete the temporary code that helped me track down this issue
and to conform its fix.
Fix too-long lines.
... including the --inline-linear-tail-rec-sccs-max-extra option
that was its parameter.
This option was added as a quick-and-dirty workaround before we taught
the MLDS backend how to implement tail recursion for mutually recursive
predicates, and has not been needed since that capability has proven itself.
compiler/options.m:
Delete both options from the option table.
tools/make_optimization_options_db:
Delete both options from the opt_tuple.
compiler/inlining.m:
Delete the implementation of this option.
compiler/mercury_compile_middle_passes.m:
compiler/optimization_options.m:
doc/user_guide.texi:
Conform to the changes above.
... to the user guide entries of the affected optimization options.
compiler/print_help.m:
Implement the above.
doc/user_guide.texi:
Expect the additions, both from this diff, and earlier ones.
tools/make_optimization_options_middle:
compiler/optimization_options.m:
To make the above slightly simpler to implement, add a subtype
of the option_data type, and change the type of the predicate
that returns the options enabled at each optimization level
to use this subtype.
configure.ac:
Require the installed compiler to support the fix without which
the subtype definition would make the automatically-generated
contents of libs.optimization_options.int2 invalid.
... which are managed by tools/make_optimization_options.
tools/make_optimization_options_middle:
When creating compiler/optimization_options.m, put into it
a new predicate that records, for each bool_special option
managed by this module, its initial value.
compiler/print_help.m:
Handle bool_special options whose initial value this new predicate
makes known the same way we now handle plain bool options.
The difference this makes is that bool_special options that
default to "yes" will now have their --no-xyz form listed as
the user-visible form of the option, not their --xyz form.
tools/make_optimization_options_db:
tools/make_optimization_options_end:
Fix a discrepancy that made documenting the smart indexing
unnecessarily complicated. The first such option defaulted to "no",
but was switched to "yes" at -O0, while the others all defaulted
to "yes". Allow these options to be documented in the same manner
by making them *all* default to "no", and switch them all on at -O0.
compiler/optimization_options.m:
Rebuilt with the updated make_optimization_options.
compiler/options.m:
Many of the bool_special options that default to "yes" had
help text that already assumed that this text followed
the option name being printed as --no-xyz.
For the others, which assumed that they followed --xyz,
change the help text to be appropriate when following
the --no-xyz form.
tests/warnings/help_text.err_exp:
Expect the updated help texts.
doc/user_guide.texi:
Expect the updated help texts, from this and earlier commits.
tests/warnings/help_opt_level.err_exp:
Expect the added level-enabled options.
... and delete their second name.
compiler/options.m:
The internal names of many optimization options have traditionally
given no clue about which backend(s) they apply to, which made it
hard to document them. Change this by including either llds or mlds
in the names of these options, unless the rest of the name already
ruled out one or the other backend.
In one case, this exercise relevaled that an option that was classified
as MLDS-only is used by the LLDS backend as well. Reclassify this option.
Also, rename many options to the names they have in the opt_tuple.
Those names are more recent, and their naming is more consistent
(e.g. they are all verb phrases).
tools/make_optimization_options_db:
Delete the different-from-the-opt-tuple name alternatives.
tools/make_optimization_options_end:
Conform to the option renames.
Also, fix a bug. The list of options enabled at each optimization
level lists each option twice, once by its name in the opt_tuple
(which is what we use to actually implement optimization levels)
and once by its name in options.m (which we use to implement
the option that prints out the optimization levels). In one case,
the two names did not match; fix this.
compiler/optimization_options.m:
Rebuild this module with tools/make_optimization_options.
compiler/add_trail_ops.m:
compiler/global_data.m:
compiler/handle_options.m:
compiler/ite_gen.m:
compiler/jumpopt.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/ml_optimize.m:
compiler/optimize.m:
compiler/options.m:
compiler/proc_gen.m:
compiler/stack_layout.m:
Conform to the option renames.
tests/warnings/help_opt_levels.err_exp:
Expect the fix to make_optimization_options_end.
tests/warnings/help_text.err_exp:
Expect the option reclassification.
compiler/options.m:
Add two new options.
The new bool option --output-optimization-options asks the compiler
to output a list of all optimization levels, with their descriptions
and associated lists of options.
The new int option --output-optimization-options-upto=N does the same job
up to and including -ON.
compiler/op_mode.m:
Add a new op_mode for that corresponds to these options.
compiler/mercury_compile_main.m:
Given the new op_mode, call the new code in print_help.m.
compiler/print_help.m:
Implement the new op_mode.
tools/make_optimization_options_end:
Delete the "Optimization level N:" part of each level's description,
to allow print_help.m to use that text as a heading.
compiler/handle_options.m:
compiler/optimization_options.m:
Conform to the changes above.
tests/warnings/help_opt_levels.m:
tests/warnings/help_text.m:
New test cases for "mmc --output-optimization-options-upto=N",
and for "mmc --help-alt" respectively. Their code does not matter,
because the compiler never looks at them; they are only a vehicle
to hang tests of help text on.
tests/warnings/Mmakefile:
Invoke the two new tests with their intended options.
tests/warnings/help_opt_levels.err_exp:
tests/warnings/help_text.err_exp:
The expected outputs of those two invocations.
... by having the automatically-generated optimization_options.m module
export the information we will need for that documentation.
tools/make_optimization_options_end:
Modify the predicate that lists the options at each optimization level
in two distinct ways:
- by turning the existing comments documenting the meaning of each
optimization level into strings that we can include the documentation,
and
- by adding next to each optimization_option setting, which cannot be
easily turned into the user-facing names of the options being set,
the option and its new value, which can be turned into that.
There was another possible way to get the second job done. This was
to have tools/make_optimization_options_middle generate TWO versions
of the code that is now bodily included in options.m between
INCLUDE_HANDLER_FILE_{START,END}: the one we have there now,
and one that can do the conversion in the reverse direction.
I judged this extra 500+ lines of code to be too much, even if
automatically generated.
(Putting the code as the body of a predicate with two modes would work,
but this would separate the parts of switch on Option inside the
special_handler that are automatically generated from the parts
which are hand-written, and would therefore allow any accidental
duplicate arms (options handled in both parts) to be undetected.
I judged this to be unacceptable also.)
The method I chose does duplicate some code (each level lists the
same info in two different ways), but since the consistency is trivial
to check visually, and we update levels so rarely, this should not matter.
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
Conform to the changes above.
tools/make_optimization_options_db:
compiler/options.m:
Rename the optopt_everything_in_one_c_function option to the name
it has inside optimization_options.m, optopt_use_just_one_c_func.
Since this did not break anything, move the option to the
oc_unused category.
compiler/optimization_options.m:
Automatic update after the changes in tools/make_optimization_options*.
compiler/options.m:
... based on what data structures (HLDS, MLDS, LLDS, target code)
they take as input and generate as output. This defines the effective
domain of applicability of each option.
Rename the oc_spec_opt category as oc_opt_hh_exp, with _exp being
short for experimental.
The optopt_optimize and optopt_peep internal options each had
separate user-facing names (such as "llds-optimize" and "mlds-optimize)
that implied different and separate functions, but mapping the different
user-facing option names to the same internal option linked them together.
This could manifest itself as e.g. "--mlds-optimize --no-llds-optimize"
switching off mlds optimizations after the user explicitly switched
them on. The same issue also arose for peephole optimizations. Fix this
by using internal options that form a bijection with the user facing
names (modulo spelling).
tools/make_optimization_options_db:
tools/make_optimization_options_end:
Conform to the split of the optimize and peep options.
compiler/handle_options.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_compile_mlds_back_end.m:
compiler/ml_optimize.m:
compiler/optimization_options.m:
compiler/optimize.m:
compiler/peephole.m:
Conform to the changes above.
There are no algorithmic changes.
compiler/options.m:
tools/make_optimization_options_db:
As above.
tools/make_optimization_options_db_start:
Update the copyright years we put into optimization_options.m.
compiler/optimization_options.m:
Regenerated with the new make_optimization_options_db.
compiler/inlining.m:
compiler/mercury_compile_middle_passes.m:
Conform to the changes above.
tools/generate_errno_name:
Use a secondary switch to handle errno names that may be defined to
the same value as other names.
runtime/mercury_errno_name.c:
Regenerate this file.
On AIX, both ENOTEMPTY and EEXIST are defined to the same value,
which caused the code generated for MR_errno_name() to fail to compile.
tools/generate_errno_name:
Handle the case that ENOTEMPTY == EEXIST in the generated function.
Likewise for other errno name aliases.
runtime/mercury_errno_name.c:
Regenerate this file.
These caused the tests in the mmc_make directory to be executed even
when they shouldn't have been, because the bootcheck did not specify
the --use-subdirs option. The root cause was probably the existence
of unintended Mercury directories, since this would cause mmake
to set MMAKE_USE_SUBDIRS to yes even without --use-subdirs.
tests/invalid/Mmakefile:
Clean up the Mercury directory created by a test case here.
tests/mmc_make/Mmakefile:
Clean up the Mercury directory created by all the test cases here.
Make a rule more robust.
Add a note about a currently unenabled test case.
tests/mmc_make/Mmakefile:
tests/valid_make_int/Mmakefile:
Test for --use-subdirs being enabled via the new variable
set by tools/bootcheck.
tools/bootcheck:
Record the value of --use subdirs in a variable, TESTS_USE_SUBDIRS,
that mmake does not know about and therefore will not touch.
Fix three unrelated issues that came up in bootchecks for testing
the above diff. They all involve the same small piece of code
whose job is to clean up .data and .procrep files left by bootchecks
in deep profiling grades.
- One issue was the lack of an update for the somewhat-recent change
in the naming of deep profiling data files;
- another was the lack of required parentheses on the find command line;
- and the third was the lack of protection for version-controlled files
that we do NOT want to delete.
When this new runtime option is specified, the runtime system will use
Deep.{data,procrep} as the names of the files it writes out.
runtime/mercury_engine.h:
Add a flag to the engine that records whether this option has been
specified or not.
runtime/mercury_wrapper.c:
Set the flag if/when we see the --deep-std-name option.
runtime/mercury_deep_profiling.c:
If the new flag is set, use Deep.{data,procrep} as filenames.
doc/user_guide.texi:
Document the new option.
tools/bootcheck:
Specify the new option for bootchecks.
tests/debugger/Mmakefile:
tests/declarative_debugger/Mmakefile:
tests/hard_coded/Mmakefile:
tests/par_conj/Mmakefile:
tests/stm/Mmakefile:
When specifying a value of MERCURY_OPTIONS that overrides the value
set by tools/bootcheck, include --deep-std-name in that value.
tools/configure_cross:
Include config values for clang targeting Linux/Aarch64.
Loosen matches on linux target triples in case a vendor is included,
e.g. on Alpine Linux the target triple is aarch64-alpine-linux-musl.
README.cross.md:
Update documentation.
Put .mh files into a Mercury/mhs subdirectory when --use-subdirs
or --use-grade-subdirs is used.
compiler/file_names.m:
Replace ext_cur_mh with ext_cur_ngs_max_cur_mh, in the new category
ext_cur_ngs_max_cur. The new category is similar to that for .mih
files, except that .mh files are never placed in grade-specific
subdirectories.
compiler/handle_options.m:
Add Mercury/mhs subdirs to list of C include directories
when --use-subdirs or --use-grade-subdirs is in effect.
compiler/write_deps_file.m:
Add $(mhs_subdir) prefix before %.mh patterns.
Create a Mercury/mhs -> .. symlink when installing.
This is required by mmc --make and mmake --use-subdirs.
Conform to the changes above.
compiler/export.m:
compiler/make.file_names.m:
compiler/make.program_target.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mlds_to_c_file.m:
Conform to the changes above.
scripts/Mmake.vars.in:
Define the variable mhs_subdir.
scripts/Mmake.rules:
Add -I option to find .mh files when --use-subdirs is used.
browser/.mgnuc_copts:
browser/MDB_FLAGS.in:
compiler/.mgnuc_copts:
compiler/COMP_FLAGS.in:
deep_profiler/.mgnuc_copts:
deep_profiler/DEEP_FLAGS.in:
extras/EXTRAS_FLAGS.in:
grade_lib/.mgnuc_copts:
grade_lib/GRADE_LIB_FLAGS.in:
library/.mgnuc_copts:
mdbcomp/.mgnuc_copts:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/.mgnuc_copts:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/.mgnuc_copts:
profiler/PROF_FLAGS.in:
slice/.mgnuc_copts:
slice/SLICE_FLAGS.in:
ssdb/.mgnuc_copts:
ssdb/SSDB_FLAGS.in:
tests/.mgnuc_copts.ws:
tests/WS_FLAGS.ws:
trace/.mgnuc_copts:
tools/lmc.in:
Add -I options to find .mh files when the workspace is built
with mmake --use-subdirs.
samples/c_interface/standalone_c/Makefile:
Add option to let the C compiler find the .mh file.
NEWS.md:
Announce change.
Delete trailing whitespace.
Add options to the bootcheck script to help with testing of grades
in which the stage 2 compiler would be very slow, i.e. java and csharp.
tools/bootcheck:
Add --skip-stage-3, which skips building the stage 3 directory.
Add --test-with-stage-1-compiler, which causes the stage 1 compiler
to be used when executing the test suite, instead of the stage 2
compiler.
Rename the existing mmake_stage_2 variable to build_stage_2.
compiler/mercury_compile_main.m:
If this new environment variable is set to always/never/1/0,
then enable or disable the use of color as directed. Do this regardless
of the setting of the NO_COLOR environment variable, since NO_COLOR
is a general setting while MERCURY_ENABLE_COLOR is a specific setting.
NO_COLOR is still consulted if MERCURY_ENABLE_COLOR is either not set,
or is set to a value we don't recognize.
compiler/globals.m:
Now that color diagnostics can be disabled using this new purpose-specific
envvar, stop taking an "" or "none" value of the MERCURY_COLOR_SCHEME
envvar as a request to disable colors in diagnostics.
compiler/options.m:
Shorten the name of the --enable-color-diagnostics option to just
--color-diagnostics.
compiler/handle_options.m:
Conform to the changes above.
tools/bootcheck:
Set MERCURY_ENABLE_COLOR to "always". Delete the unset of NO_COLOR,
since it should not be needed.
tests/invalid/Mmakefile:
tests/invalid_make_int/Mmakefile:
tests/invalid_nodepend/Mmakefile:
tests/invalid_onlydepend/Mmakefile:
tests/invalid_purity/Mmakefile:
tests/invalid_submodules/Mmakefile:
tests/recompilation/Mmakefile:
tests/warnings/Mmakefile:
Update the references to ---enable-color-diagnostics. Bootchecks would
work even if we deleted them, but keeping them slightly simplifies
running the tests outside of bootcheck.
compiler/error_spec.m:
Replace the possible_cause color name with the hint and inconsistent
color names, as agreed on m-rev.
compiler/globals.m:
compiler/write_error_spec.m:
Update the code handling color names and their mapping to color shades.
compiler/options.m:
Update the invisible options that record that mapping.
tools/bootcheck:
Update the color scheme used for the test suite.
compiler/accumulator.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_type.m:
compiler/check_typeclass.m:
compiler/equiv_type.m:
compiler/format_call_errors.m:
compiler/inst_check.m:
compiler/make_hlds_error.m:
compiler/make_hlds_passes.m:
compiler/make_hlds_warn.m:
compiler/mode_errors.m:
compiler/module_qual.qual_errors.m:
compiler/parse_item.m:
compiler/parse_mutable.m:
compiler/parse_pragma.m:
compiler/parse_type_defn.m:
compiler/post_typecheck.m:
compiler/simplify_goal_call.m:
compiler/simplify_proc.m:
compiler/split_parse_tree_src.m:
compiler/state_var.m:
compiler/termination.m:
compiler/typecheck_error_overload.m:
compiler/typecheck_error_undef.m:
compiler/typecheck_errors.m:
Replace uses of the possible_cause color with one of its replacements.
In a few cases, adjust some other colors as well.
tests/invalid/bad_statevar_bad_context.err_exp:
tests/invalid/bind_in_negated.err_exp:
tests/invalid/bug197.err_exp:
tests/invalid/bug487.err_exp:
tests/invalid/coerce_disambig.err_exp:
tests/invalid/coerce_implied_mode.err_exp:
tests/invalid/coerce_infer.err_exp:
tests/invalid/coerce_non_du.err_exp:
tests/invalid/coerce_type_error.err_exp:
tests/invalid/coerce_unify_tvars.err_exp:
tests/invalid/conflicting_tabling_pragmas.err_exp:
tests/invalid/dcg_context.err_exp:
tests/invalid/default_ho_inst_2.err_exp:
tests/invalid/fbnf.err_exp:
tests/invalid/freefree.err_exp:
tests/invalid/functor_ho_inst_bad_1.err_exp:
tests/invalid/functor_ho_inst_bad_3.err_exp:
tests/invalid/higher_order_mode_mismatch.err_exp:
tests/invalid/ho_type_mode_bug.err_exp:
tests/invalid/merge_inst_error.err_exp:
tests/invalid/mode_inf.err_exp:
tests/invalid/modes_erroneous.err_exp:
tests/invalid/multimode_dcg.err_exp:
tests/invalid/partial_implied_mode.err_exp:
tests/invalid/quant_constraint_1.err_exp:
tests/invalid/quant_constraint_2.err_exp:
tests/invalid/string_format_bad.err_exp:
tests/invalid/string_format_unknown.err_exp:
tests/invalid/test_may_duplicate.err_exp:
tests/invalid/test_may_export_body.err_exp:
tests/invalid/type_diff.err_exp:
tests/invalid/typeclass_dup_method_mode.err_exp:
tests/invalid_make_int/bad_mutable_int.int_err_exp:
tests/invalid_nodepend/duplicate_modes.err_exp:
tests/invalid_nodepend/errors_2.err_exp:
tests/invalid_nodepend/occurs.err_exp:
tests/invalid_nodepend/require_tailrec_invalid.err_exp:
tests/invalid_nodepend/test_with_type.err_exp:
tests/invalid_nodepend/unbound_type_vars.err_exp:
tests/invalid_purity/impure_pred_t1_fixed.err_exp:
tests/invalid_purity/impure_pred_t2.err_exp:
tests/invalid_purity/purity_nonsense_1.err_exp:
tests/invalid_purity/purity_nonsense_2.err_exp:
tests/warnings/foreign_term_invalid.err_exp:
tests/warnings/format_call_multi.err_exp:
tests/warnings/format_call_warning.err_exp:
tests/warnings/table_with_inline.err_exp:
tests/warnings/warn_succ_ind.err_exp:
tests/warnings/warn_succ_ind.err_exp2:
tests/warnings/warn_succ_ind.err_exp3:
Expect updated diagnostics.
compiler/write_error_spec.m:
Delete the code that fills in the default colors for each role.
compiler/globals.m:
Move that code here, into the implementation of
convert_color_spec_options, which is the function that
write_error_spec.m uses to set up the color database it uses
by looking up the right options in the option_table.
The main part of this diff is the addition of a new predicate,
record_color_scheme_in_options, whose job is to *set up* those
options.
It does so by allowing the user to specify a *color scheme*,
which may be a builtin scheme (of which we now support four,
{dark,light}{16,256}), or a scheme that the user specifies directly
using a string of the form
specified@subject=C:correct=C:incorrect=C:possible_cause:C
where each C is either a color name, or an SGR color number in 0..255.
(And possibly something like rgb-R-G-B later.)
There is also the pseudo-color-scheme named none, which is not a
color scheme at all, but rather a way to turn off all use of color.
compiler/handle_options.m:
Add code to allow the user to specify a color scheme using either
- a new maybe_string option named --color-scheme, or
- an environment variable named MERCURY_COLOR_SCHEME.
Also add code to allow an environment variable named NO_COLOR
to turn off the use of color regardless of any other color settings.
Add a mechanism to avoid getting stuck in an infinite loop
in the presence of errors in the values of environment variables
that we use to set up the first globals structure.
compiler/options.m:
Add the options needed by the new code in handle_options.m.
Some are not yet documented, the rest are intended never to be documented,
so there is no corresponding change to doc/user_guidet.texi (yet).
tools/bootcheck:
Set the MERCURY_COLOR_SCHEME environment variable to specify
the colors now in .err_exp files.
Compilation of the stage 3 library currently results in a segmentation fault on
Windows. Since this can affect users who follow the advice of the configuration
script and attempt to re-install Mercury in a more efficient grades, disable
the use of the asm_fast grades until this is fixed.
configure.ac:
tools/configure_cross:
As above.
tools/configure_cross:
Update the script to check for a Mercury compiler by running
"mmc --version", as "mmc -v" no longer outputs version information
after 2023-09-09.
They turned out to have a zero hit rate, making them useless.
compiler/make.dependencies.m:
Add code to use the two new caches, indirect_imports_non_intermod
and anc0_dir1_indir2_non_intermod. I got statistics on their
performance while they were enabled, but since their hit rate was zero,
this diff includes them only in a commented-out form.
Note that adding the second cache required adding a new dep_spec,
which remains, since it shouldn't affect performance at all.
compiler/make.deps_cache.m:
Disable the those two caches.
Fix an issue where the original statistics-gathering code
mixed up hits and misses.
Include the statistics gathered in course of implementing this diff.
tools/make_deps_cache_stats:
Update this script to fix the hit/miss issue, and to print more info.
compiler/make.deps_cache.m:
Add conditionally-compiled code to count the search and addition
operations on each cache, as well as code to write out these counts.
Where a cache has two versions, one for intermod and non-intermod
operations, put the non-intermod version first, since it is more basic.
Add two new non-intermod cache versions that are not used yet,
but whose intermod versions are used: one for non-intermod
indirect imports, and one for non-intermod anc0_dir1_indir2.
For the latter, include "intermod" in the name of the old cache,
which uses intermodule information.
compiler/make.make_info.m:
Add those two caches, and follow the updated order and names of the caches.
compiler/mercury_compile_main.m:
Call make.deps_cache.m to dump out its cache, it it was enabled
and gathered any info.
compiler/make.m:
Make make.deps_cache.m visible from outside the make package,
in order to make possible the change top mercury_compile_main.m above.
compiler/make.dependencies.m:
Conform to the changes above.
tools/make_deps_cache_stats:
A new script to summarize the information recorded by the new code.
... instead of building a bunch of .c files.
Our tradition of adding an "s" at the end of a suffix to mean "all of the
files with the original suffix" had a problem when we added C# as a target
language. Until then, just as "os" stood for ".o files" when it occurred
as either a mmake target, mmc --make target, or mmake variable name component.
"cs" likewise stood for ".c files", but was now also needed to mean ".cs file".
We coped by keeping "cs" meaning ".c files", and adding "csharp" as a target
name synonym to mean ".cs file".
This diff keeps that synonym, but it changes
- the name needed to refer to ".c files" from "cs" to "all_cs"
- the name needed to refer to ".o files" from "os" to "all_os"
- the name needed to refer to ".pic_o files" from "pic_os" to "all_pic_os"
- the name needed to refer to ".cs files" from "css" to "all_css"
- the name needed to refer to ".java files" from "javas" to "all_javas"
- the name needed to refer to ".opt files" from "opts" to "all_opts"
- the name needed to refer to ".trans_opt files"
from "trans_opts" to "all_trans_opts"
It would be nice if we could apply this same change to all other similar
target names and mmake variable name suffixes, such as "ints" and "int3s",
but some of those names are already in use to mean semantically different
things. All of the names above that used to have the form "<ext>s" and
now have the form "all_<ext>s" stood for all the files with extension
".<ext>" that are prerequisites for building a linked target, i.e.
an executable or a library. But the mmake variable name suffixes
".all_mihs", ".all_mhs" and ".all_int0s" each stand for something subtly
different: the names of files that *may or may not exist", but which,
if they do exist, should be deleted by a clean or realclean target.
To make this breaking change easier to handle by users, this diff does
not simply redefine the meaning of ".all_int0s". (It does change the meaning
of the "cs" target, but the fact this will happen at some time has been
announced ages ago.) Instead, it defines three new mmake var suffixes,
".mihs_to_clean", ".mhs_to_clean" and ".int0s_to_clean", which are
synonyms for ".all_mihs", ".all_mhs" and ".all_int0s" respectively,
and announces that ".all_mihs", ".all_mhs" and ".all_int0s" are being
deprecated, and will have the above change of semantics applied to them
in the future.
NEWS.md:
Announce the breaking change.
compiler/make.top_level.m:
Stop treating the target "cs" as meaning "build all the .c files
for this program".
The code of classify_target_2 has long been semidet, but only in a way
that was not apparent to the compiler. Change the code to allow the
compiler to see its semidet nature while keeping the algorithm the same,
except for the change in the paragraph above.
This includes keeping e.g. "ints" as meaning "build all the .int/.int2
files needed by this program".
compiler/write_deps_file.m:
Stop generating mmake variables with suffixes ".cs", ".os", ".pic_os",
".javas" and ".css". The mmake variables with suffixes ".all_cs",
".all_os", ".all_pic_os", ".all_javas" and ".all_css" already existed.
All had the same value as the mmake variable without the "all",
with one exception: ".cs". However, in this case, the old (and still
current) value of ".all_cs" is what the value of ".cs" *should* have been.
Simplify some code.
The following changes in compiler/*.m are only cosmetic, but they helped me
rule out possible sources of problems with incomplete versions of this diff.
compiler/file_names.m:
Add a version of a fact_table_file_name_return_dirs which does not
return directories, since most of its callers don't need that info.
compiler/make.program_target.m:
Clarify code by making variable names more descriptive,
compiler/make.file_names.m:
compiler/make.module_target.m:
Conform to the changes above,
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
grade_lib/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
Rename os to all_os, cs to all_cs, css to all_css, javas to all_javas,
and opts to all_opts. (There were no occurrences of trans_opts to rename.)
Replace [s as sh command names in actions.
scripts/Mmake.vars.in:
Specify the names of mmake variables holding the names of sets of files
with a given extension directly, since for some of them, adding an "s"
at the end of the name of the extension does not generate the name
of the corresponding mmake variable anymore.
scripts/Mmake.rules:
Use the directly specified mmake variable names from Mmake.vars.in
in the rule for installing lbraries. Temporarily add some debugging
output to make suree that the updated nested mmake variable references
work as intended.
tools/bootcheck:
Specify the names of mmake targets for making all the files in a program
with a given extension directly, since adding an "s" at the end of the
name of the extension does not generate the name of the corresponding
mmake target anymore.
Print timestamps around the action of checking namespace cleanliness,
to allow the time taken by that action to be measured. (I kept track
of bootchecks as they happened while working on this diff, and found
this time to be nontrivial.)
compiler/make.dependencies.m:
The task of this module is to find which source files are needed
to build each target file of an "mmc --make" invocation.
(In this case, "source" and "target" files mean the files
on the right and left hand sides of a make rule respectively.)
The original machinery used for this purpose used three-level towers
of closures, which made the code hard to read and to understand, and
also made it effectively impossible to change the argument list
of any of the predicates involved without also making the same change
to all the other predicates used at the same tower level.
This diff implements new machinery that replaces the towers of closures
with
- explicit data structures, to take over for the data in the closures, and
- simple code walking over those data structures, to take over for
the code in the closures.
The new machinery is intended to replace the old machinery after
a trial period of a week or two. Until then, we execute all operations
using both the old and the new machinery, and compare their outputs.
During a bootcheck in csharp grade, the comparisons detect differences
only in about half a dozen test cases, and it is not clear whether
they are actually due to the new machinery doing different things
than the old machinery, or due to the same actions being repeated.
Note that some of the infrastructure used by both sets of machinery
still uses the old approach; switching it over to the new approach
is future work.
The new machinery also lacks (most of) the caches used by
the old machinery. Adding caches to the new machinery is also future work,
because the new machinery is more flexible in *what* can be cached
reasonably conveniently, and therefore it is not clear whether the
set of things cached by the old machinery is also the best set of
things for the new machinery to cache.
The execution of both machineries and this lack of caching by
the new machinery will affect performance for probably a couple of weeks.
Add comments marked with "XXX MDNEW" about ideas for future improvements.
Add infrastructure to debug both this diff, and some other issues.
compiler/make.find_local_modules.m:
Add infrastructure to debug some other issues.
tools/bootcheck:
Delete the tests/*/Mercury directories before starting the execution
of the test suite. Without this, the files left in there by one bootcheck
can influence the outcome of the next bootcheck.
Change the naming scheme we use to record the timestamp of files
in the TEST_FAILS directory. The old scheme included colon characters,
which don't play nice with some of my personal scripts :-(
compiler/write_deps_file.m:
Move the filename creation code to the end of the file. Expand it
with conditionally-enabled code that gathers statistics about the
hit rate of the file name cache for each extension, and document
its result, which validates the existing approach.
Document an approach that looks like would speed up the file name
creation process, but does not.
compiler/mercury_compile_main.m:
Call a new predicate in write_deps_file.m to dump out the statistics
it gathered, if there are any.
tools/write_deps_file_stats:
A new script to summarize the raw data dumped out by write_deps_file.m.
library/dir.m:
Improve indentation.