Rename mmc and mgnuc options that set this grade component to --c-debug-grade.
Let the options named --c-debug of both mmc and mgnuc enable C level debugging
of only the module being compiled.
runtime/mercury_grade.h:
Rename the .ll_debug grade component to .c_debug. Also rename the C macro
that controls the presence or absence of this grade component
from MR_LL_DEBUG to MR_C_DEBUG_GRADE.
runtime/mercury_conf_param.h:
runtime/mercury_debug.c:
runtime/mercury_debug.h:
runtime/mercury_engine.c:
runtime/mercury_label.c:
runtime/mercury_memory_zones.c:
runtime/mercury_memory_zones.h:
runtime/mercury_overflow.c:
runtime/mercury_std.h:
runtime/mercury_wrapper.c:
Rename the MR_LOWLEVEL_DEBUG macro to MR_DEBUG_THE_RUNTIME.
Previously, the name of this macro wrongly implied that it had
something to do with the old .ll_debug grade component, even though
- the MR_LOWLEVEL_DEBUG macro was designed to debug LLDS grades,
since only these existed when it was created, while
- the .ll_debug grade component (now .c_debug) is useful only for
MLDS grades targeting C.
compiler/options.m:
Rename the old confusingly named low_level_debug option to c_debug_grade.
Move it to the list of grade options, and fix its documentation, which
was completely wrong:
- code in compile_target_code.m treated it as being a synonym of
the .ll_debug (now .c_debug) grade component, while
- its (commented out) documentation here in options.m said it called for
the enabling of what is now MR_DEBUG_THE_RUNTIME.
compiler/compile_target_code.m:
Conform to the rename just above.
Define MR_C_DEBUG_GRADE instead of MR_LL_DEBUG if c_debug_grade is enabled.
Pass -g to the C compiler if either c_debug_grade or target_debug
is enabled.
Add an XXX about a missing safety check for an obsolete experimental
feature.
compiler/compute_grade.m:
When given a grade with a .c_debug grade component, set only the
c_debug_grade option; don't set the target_debug option, which is NOT
a grade option. The change to compile_target_code.m above handles the
only situation in which this implication was formerly required.
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Look for and process the .c_debug grade component instead of .ll_debug.
Use a sh variable named c_debug_grade to record its absence/presence.
Look for and process the --c-debug-grade grade-component option,
setting the same sh variable, c_debug_grade. (All grade components
can be set piecemeal using sh options to the scripts using these
subroutines.) This replaces the old, confusingly named option
--low-level-debug.
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
Consistently use the sh variable c_debug to record the presence of
the (non-grade) --c-debug option to mgnuc, and the sh variable
c_debug_grade to record the presence of the .c_debug grade component.
Stop looking for and handling the --low-level-debug option, which
mgnuc used to document, even though this duplicated the same documentation
in init_grade_options.sh-subr, which mgnuc includes. The difference was
that init_grade_options.sh-subr meant it to represent the old .ll_debug
MLDS grade component, while mgnuc treated it as specifying what is now
MR_DEBUG_THE_RUNTIME for LLDS grades. It didn't help that two sh variables
with quite different semantics had names that differed only in an
underscore: LLDEBUG_OPTS vs LL_DEBUG_OPTS.
scripts/Mmakefile:
Add a missing dependency to force the rebuild of mgnuc after each update
of its sh subroutine mgnuc_file_ops.sh-subr.
doc/user_guide.texi:
Document the --c-debug-grade option of mmc. This option was not publicly
documented under its original misleading name (--low-level-debug), but
its documentation is now possible without contorted dancing around the
name.
Clarify the documentation of mgnuc's --c-debug option.
README.sanitizers:
configure.ac:
Conform to the rename of the grade component.
grade_lib/grade_spec.m:
grade_lib/grade_string.m:
grade_lib/grade_structure.m:
grade_lib/try_all_grade_structs.m:
Conform to the rename of the grade component .ll_debug to .c_debug.
Don't allow the .c_debug grade component in LLDS grades.
In grade_string.m, add some obvious implications of some grade components.
grade_lib/choose_grade.m:
grade_lib/grade_lib.m:
grade_lib/test_grades.m:
grade_lib/var_value_names.m:
Fix white space.
scripts/ml.in:
tools/lmc.in:
tools/test_mercury:
Conform to the change in compile_target_code.m to the naming of
Boehm gc library variants.
grade_lib/GRADE_LIB_FLAGS.in:
A new file with default options for the grade_lib directory.
configure.ac:
Create GRADE_LIB_FLAGS from GRADE_LIB_FLAGS.in.
grade_lib/Mmakefile:
Make building GRADE_LIB_FLAGS possible.
Require building GRADE_LIB_FLAGS before any Mercury module is compiled.
Use GRADE_LIB_FLAGS as a source of default flags.
Use a directory-specific params file if it exists.
grade_lib/choose_grade.m:
grade_lib/grade_setup.m:
grade_lib/grade_structure.m:
grade_lib/grade_vars.m:
grade_lib/test_grades.m:
grade_lib/try_all_grade_structs.m:
Fix issues revealed by the flags in GRADE_LIB_FLAGS.
mdbcomp/MDBCOMP_FLAGS.in:
browser/Mmakefile:
Fix aesthetics.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
grade_lib/try_all_grade_structs.m:
A new program which checks whether all possible ways of filling out
a grade structure are valid. It does this by generating all possible
values of the grade_structure type, and checking, for each value,
whether
- converting it to a grade string,
- converting the grade string to a grade specification,
- solving that specification, and
- converting the solution (if any) back to a grade structure
yields the exact same grade structure that we started with.
Besides testing whether the grade structure type is "tight" in the
sense of being unable to express invalid grades, this round-trip test
also stress-tests all the parts of the grade library except those
that explain the inconsistencies in invalid grade specifications.
Most of the changes to the other files are fixes to problems revealed
by this testing.
grade_lib/Mmakefile:
Add the new program as an executable to build.
grade_lib/grade_structure.m:
Tighten up the grade structure type by encoding in types the
incompatibility of minimal model tabling with trailing, thread safety
performance profiling, and the history gc.
grade_lib/grade_spec.m:
Loosen a restriction: minimal model tabling is compatible with no gc
at all.
Loosen a restriction: history gc works on the LLDS backend (in the
absence of minimal model tabling, at least).
The original specs reflected the proposed new defaults for gc and stack
segments (boehm gc and yes, respectively), but the round-trip test
requires the defaults of the current spec (no gc and no stack segments).
Make the specification version to be used in constraint solving selectable.
grade_lib/choose_grade.m:
grade_lib/grade_setup.m:
grade_lib/grade_string.m:
grade_lib/test_grades.m:
Conform to the changes above.
grade_lib/grade_string.m:
New module for converting a solution from the grade library
into a grade string.
grade_lib/grade_solver.m:
Change the representation of a solution to a map to express the invariant
that no solver var may be associated with more than one value.
grade_lib/grade_spec.m:
Fix some documentation bugs.
grade_lib/test_grades.m:
Print the grade strings on each success.
grade_lib/grade_state.m:
This new module contains the representation of the state solver.
It is imported by both grade_setup.m (which initializes that state) and
grade_solver.m (which uses and updates that state).
Make this state refer to solver vars and their values using the values
of two enum types, not strings. This makes it much harder to accidentally
use the wrong name for a solver var or value.
grade_lib/grade_spec.m:
When specifying the set of solver variables and requirements, use
types designed for that purpose, instead of parts of the solver state
with the fields filled in with dummies.
grade_lib/choose_grade.m:
grade_lib/grade_setup.m:
grade_lib/grade_solver.m:
grade_lib/test_grades.m:
Conform to the changes above.
grade_lib/test_grades.m:
This program can repeatedly invoke the library with all possible
combinations of selected sets of settings, and print the result.
grade_lib/Mmakefile:
Add the new executable as a Mercury main module.
grade_lib/grade_setup.m:
Make the library easier to use by packaging all components of the solver
state into a single data structure.
grade_lib/grade_solver.m:
Conform to the change in grade_setup.m.
Provide a mechanism to put a prefix before each line when printing things
out.
grade_lib/choose_grade.m:
Conform to the change in grade_setup.m.
grade_lib/grade_spec.m:
Avoid using the same name ("none") as a solver var value for more than one
solver var.