deep_profiler/analysis_utils.m:
deep_profiler/autopar_find_best_par.m:
deep_profiler/autopar_reports.m:
deep_profiler/autopar_search_callgraph.m:
deep_profiler/autopar_search_goals.m:
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
deep_profiler/cliques.m:
deep_profiler/coverage.m:
deep_profiler/dump.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
deep_profiler/profile.m:
deep_profiler/read_profile.m:
deep_profiler/recursion_patterns.m:
deep_profiler/startup.m:
deep_profiler/var_use_analysis.m:
Replace implicit streams with explicit streams.
In some places, simplify some code, often using constructs such as
string.format that either did not exist or were too expensive to use
when the original code was written.
Consistenly use the spelling StdErr over Stderr.
In mdbprof_dump.m, put filename and reason-for-failing-to-open-that-file
in the right order in an error message.
deep_profiler/DEEP_FLAGS.in:
Turn on --warn-implicit-stream-calls for the entire deep_profiler
directory.
mdbcomp/program_representation.m:
mdbcomp/trace_counts.m:
Replace implicit streams with explicit streams. These are the two mdbcomp
modules that (a) used to use implicit streams, and (2) are used by the
deep profiler.
mdbcomp/Mercury.options:
Turn on --warn-implicit-stream-calls for these two modules.
slice/mcov.m:
slice/mtc_union.m:
Conform to the changes in mdbcomp.
... using an approach proposed by Peter, with an extra twist from Julien.
Instead of having two modules, getopt.m and getopt_io.m, with the former
defining predicates that do not take an I/O state pair, and the latter
defining predicates that do take an I/O state pair, put both kinds of
predicates into a single module. The versions with an I/O state pair
have an "_io" suffix added to their names for disambiguation.
Both versions are a veneer on top of a common infrastructure,
which relies on a simple type class to implement the operation
"give the contents of the file with this name". The predicate versions
with I/O state pairs have a normal implementation of this typeclass,
while the predicate versions that do not have I/O state pairs
have an implementation that always returns an error indication.
The above change just about doubles the number of exported predicates.
We already had two versions of most exported predicates that differed
in whether we returned errors in the form of a string, or in the form
of a structured representation, with names of the latter having
an "_se" suffix. Since we agreed that the structured representation
is the form we want to encourage, this diff deletes the string versions,
and deletes the "_se" suffix from the predicate names that used to have them.
(It still remains at the end of the name of a type.) This "undoubling"
should offset the effect of the doubling in the previous paragraph.
Eventually, we want to have just one module, getopt.m, containing
the updated code described above, but for now, we put the same code
into both getopt_io.m and getopt.m to prevent too big a shock to
people with existing code that uses getopt_io.m.
library/getopt.m:
library/getopt_io.m:
Make the changes described above.
library/Mmakefile:
Instead of building both getopt_io.m and getopt.m from getopt_template,
build getopt.m from getopt_io.m.
tools/bootcheck:
Delete references to getopt_template.
compiler/typecheck_errors.m:
When a type error involves one of the getopt/getopt_io predicates
whose interfaces are changed by this diff, tell the user about
how these changes could have caused the error, and thus what the
probable fix is.
compiler/handle_options.m:
browser/parse.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
tests/hard_coded/space.m:
Use the updated getopt interface.
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/deforest.m:
compiler/det_report.m:
compiler/format_call.m:
compiler/globals.m:
compiler/goal_expr_to_goal.m:
compiler/make.build.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/ml_top_gen.m:
compiler/module_cmds.m:
compiler/op_mode.m:
compiler/optimization_options.m:
compiler/options.m:
compiler/write_module_interface_files.m:
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
Replace references to getopt_io.m with references to getopt.m.
tests/invalid/getopt_io_old.{m,err_exp}:
tests/invalid/getopt_old.{m,err_exp}:
tests/invalid/getopt_old_se.{m, err_exp}:
New test cases for the extra help
tests/invalid/Mmakefile:
Enable the new test cases.
slice/mcov.m:
Filter trace counts from mdbcomp modules by default. Add a
a new developer-only option, --no-ignore-mdbcomp, that causes
them to be included -- doing so may be useful for those working
on the Mercury compiler itself.
Update copyright messages.
mdbcomp/mdbcomp.m:
mdbcomp/builtin_modules.m:
Add predicates for testing whether a module is part of the mdbcomp
library.
slice/mcov.m:
Do not include labels from the standard library in coverage reports by
default. Add a new command line option that can be used to force mcov
to include these labels.
XXX TODO: labels for opt_imported standard library procedures are still
showing up -- I will address this in a separate change.
Change the usage message to use the same format that mmc and mprof
use.
Set the exit status to a non-zero value if an error occurs.
Use io.format in more places.
Replace calls to error/1 with unexpected/3.
Add a new option, --flags-file, that allows options to be read
from a file (as with the identically named mmc option).
mdbcomp/sym_name.m:
New module, containing the part of the old prim_data.m that
dealt with sym_names.
mdbcomp/builtin_modules.m:
New module, containing the part of the old prim_data.m that
dealt with builtin modules.
mdbcomp/prim_data.m:
Remove the things that are now in the two new modules.
mdbcomp/mdbcomp.m:
deep_proiler/Mmakefile:
slice/Mmakefile:
Add the two new modules.
browser/*.m:
compiler/*.m:
deep_proiler/*.m:
mdbcomp/*.m:
slice/*.m:
Conform to the above changes.
Estimated hours taken: 1
Branches: main
Prevent not just the deep profiler, but also the other programs in the
Mercury system from running out of stack in hlc grades.
mdbcomp/shared_utilities.m:
A new module to contain the predicate that increases OS limits
on stack usage as much as possible.
mdbcomp/mdbcomp.m:
Include the new module in this package.
deep_profiler/startup.m:
Remove the stack unlimit predicate that is now in
mdbcomp/shared_utilities.m.
deep_profiler/Mmakefile:
slice/Mmakefile:
Copy the new file over from mdbcomp, along with the rest of the files
in the mdbcomp package.
compiler/mercury_compile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
Invoke the stack unlimit predicate.
mdbcomp/prim_data.m:
Fix a missing divider.
Branches: main
Change the argument order of many of the predicates in the map, bimap, and
multi_map modules so they are more conducive to the use of state variable
notation, i.e. make the order the same as in the sv* modules.
Prepare for the deprecation of the sv{bimap,map,multi_map} modules by
removing their use throughout the system.
library/bimap.m:
library/map.m:
library/multi_map.m:
As above.
NEWS:
Announce the change.
Separate out the "highlights" from the "detailed listing" for
the post-11.01 NEWS.
Reorganise the announcement of the Unicode support.
benchmarks/*/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
extras/*/*.m:
mdbcomp/*.m:
profiler/*.m:
tests/*/*.m:
ssdb/*.m:
samples/*/*.m
slice/*.m:
Conform to the above change.
Remove any dependencies on the sv{bimap,map,multi_map} modules.
library where it can be used by the deep profiler.
Also move the goal path code from program_representation.m to the new module,
goal_path.m in mdbcomp/
mdbcomp/goal_path.m:
New module containing goal path code.
mdbcomp/program_representation.m:
Original location of goal path code.
compiler/goal_path.m:
Move some of this goal_path code into mdbcomp/goal_path.m
mdbcomp/feedback.automatic_parallelisation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/trace_counts.m:
browser/debugger_interface.m:
browser/declarative_execution.m:
browser/declarative_tree.m:
compiler/build_mode_constraints.m:
compiler/call_gen.m:
compiler/code_info.m:
compiler/continuation_info.m:
compiler/coverage_profiling.m:
compiler/deep_profiling.m:
compiler/format_call.m:
compiler/goal_path.m:
compiler/goal_util.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_pred.m:
compiler/hlds_pred.m:
compiler/interval.m:
compiler/introduce_parallelism.m:
compiler/layout_out.m:
compiler/llds.m:
compiler/mode_constraint_robdd.m:
compiler/mode_constraints.m:
compiler/mode_ordering.m:
compiler/ordering_mode_constraints.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/prog_rep.m:
compiler/prop_mode_constraints.m:
compiler/push_goals_together.m:
compiler/rbmm.condition_renaming.m:
compiler/smm_common.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/trace_gen.m:
compiler/tupling.m:
compiler/type_constraints.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unneeded_code.m:
deep_profiler/Mmakefile:
deep_profiler/analysis_utils.m:
deep_profiler/coverage.m:
deep_profiler/create_report.m:
deep_profiler/display_report.m:
deep_profiler/dump.m:
deep_profiler/mdprof_fb.automatic_parallelism.m:
deep_profiler/message.m:
deep_profiler/old_query.m:
deep_profiler/profile.m:
deep_profiler/program_representation_utils.m:
deep_profiler/read_profile.m:
deep_profiler/recursion_patterns.m:
deep_profiler/report.m:
deep_profiler/var_use_analysis.m:
slice/Mmakefile:
slice/mcov.m:
Conform to the move of the goal path code.
Estimated hours taken: 80
Branches: main
The existing representation of goal_paths is suboptimal for several reasons.
- Sometimes we need forward goal paths (e.g. to look up goals), and sometimes
we need reverse goal paths (e.g. when computing goal paths in the first
place). We had two types for them, but
- their names, goal_path and goal_path_consable, were not expressive, and
- we could store only one of them in goal_infos.
- Testing whether goal A is a subgoal of goal B is quite error-prone using
either form of goal paths.
- Using a goal path as a key in a map, which several compiler passes want to
do, requires lots of expensive comparisons.
This diff replaces most uses of goal paths with goal ids. A goal id is an
integer, so it can be used as a key in faster maps, or even in arrays.
Every goal in the body of a procedure gets its id allocated in a depth first
search. Since we process each goal before we dive into is descendants,
the goal representing the whole body of a procedure always gets goal id 0.
The depth first traversal also builds up a map (the containing goal map)
that tells us the parent goal of ever subgoal, with the obvious exception
of the root goal itself. From the containing goal map, one can compute
both reverse and forward goal paths. It can also serve as the basis of an
efficient test of whether the goal identified by goal id A is an ancestor
of another goal identified by goal id B. We don't yet use this test,
but I expect we will in the future.
mdbcomp/program_representation.m:
Add the goal_id type.
Replace the existing goal_path and goal_path_consable types
with two new types, forward_goal_path and reverse_goal_path.
Since these now have wrappers around the list of goal path steps
that identify each kind of goal path, it is now ok to expose their
representations. This makes several compiler passes easier to code.
Update the set of operations on goal paths to work on the new data
structures.
Add a couple of step types to represent lambdas and try goals.
Their omission prior to this would have been a bug for constraint-based
mode analysis, or any other compiler pass prior to the expansion out
of lambda and try goals that wanted to use goal paths to identify
subgoals.
browser/declarative_tree.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/trace_counts.m:
slice/mcov.m:
deep_profiler/*.m:
Conform to the changes in goal path representation.
compiler/hlds_goal:
Replace the goal_path field with a goal_id field in the goal_info,
indicating that from now on, this should be used to identify goals.
Keep a reverse_goal_path field in the goal_info for use by RBMM and
CTGC. Those analyses were too hard to convert to using goal_ids,
especially since RBMM uses goal_paths to identify goals in multi-pass
algorithms that should be one-pass and should not NEED to identify
any goals for later processing.
compiler/goal_path:
Add predicates to fill in goal_ids, and update the predicates
filling in the now deprecated reverse goal path fields.
Add the operations needed by the rest of the compiler
on goal ids and containing goal maps.
Remove the option to set goal paths using "mode equivalent steps".
Constraint based mode analysis now uses goal ids, and can now
do its own equivalent optimization quite simply.
Move the goal_path module from the check_hlds package to the hlds
package.
compiler/*.m:
Conform to the changes in goal path representation.
Most modules now use goal_ids to identify goals, and use a containing
goal map to convert the goal ids to goal paths when needed.
However, the ctgc and rbmm modules still use (reverse) goal paths.
library/digraph.m:
library/group.m:
library/injection.m:
library/pprint.m:
library/pretty_printer.m:
library/term_to_xml.m:
Minor style improvements.
Estimated hours taken: 4
Branches: main
Change the representation of goal paths to use cords of steps instead of lists
of steps. With the list of steps representation, we always had to worry about
whether the list was reversed or not, since the usual operations on goal paths
operate mostly on the last step, not the first. With cords, this concern
disappears.
mdbcomp/program_representation.m:
Make the change mentioned above.
Standardize some utility operations on goal paths, now that the
reversed/unreversed distinction is gone.
Add some new utility operations.
library/cord.m:
Add operations to get the first and last elements of a cord,
to split the last element from a cord, and to test whether a cord
is empty.
NEWS:
Mention the new predicates in cord.m.
browser/*.m:
compiler/*.m:
mdbcomp/*.m:
slice/*.m:
Conform to the change to program_representation.m.
compiler/unneeded_code.m:
Add some debugging infrastructure I used to track down a bug I
accidentally inserted while making this module use cords.
compiler/options.m:
Add the options controlling the infrastructure in unneeded_code.m.
Estimated hours taken: 12
Branches: main
Fix a bug that caused bootchecks with --optimize-constructor-last-call to fail.
The problem was not in lco.m, but in follow_code.m. In some cases,
(specifically, the LCMC version of insert_2 in sparse_bitset.m),
follow_code.m moved an impure goal (store_at_ref) into the arms of an
if-then-else without marking those arms, or the if-then-else, as impure.
The next pass, simplify, then deleted the entire if-then-else, since it
had no outputs. (The store_at_ref that originally appeared after the
if-then-else was the only consumer of its only output.)
The fix is to get follow_code.m to make branched control structures such as
if-then-elses, as well as their arms, semipure or impure if a goal being moved
into them is semipure or impure, or if they came from an semipure or impure
conjunction.
Improve the optimization of the LCMC version of sparse_bitset.insert_2, which
had a foreign_proc invocation of bits_per_int in it: replace such invocations
with a unification of the bits_per_int constant if not cross compiling.
Add a new option, --optimize-constructor-last-call-null. When set, LCMC will
assign NULLs to the fields not yet filled in, to avoid any junk happens to be
there from being followed by the garbage collector's mark phase.
This diff also makes several other changes that helped me to track down
the bug above.
compiler/follow_code.m:
Make the fix described above.
Delete all the provisions for --prev-code; it won't be implemented.
Don't export a predicate that is not now used anywhere else.
compiler/simplify.m:
Make the optimization described above.
compiler/lco.m:
Make sure that the LCMC specialized procedure is a predicate, not a
function: having a function with the mode LCMC_insert_2(in, in) = in
looks wrong.
To avoid name collisions when a function and a predicate with the same
name and arity have LCMC applied to them, include the predicate vs
function status of the original procedure included in the name of the
new procedure.
Update the sym_name of calls to LCMC variants, not just the pred_id,
because without that, the HLDS dump looks misleading.
compiler/pred_table.m:
Don't have optimizations like LCMC insert new predicates at the front
of the list of predicates. Maintain the list of predicates in the
module as a two part list, to allow efficient addition of new pred_ids
at the (logical) end without using O(N^2) algorithms. Having predicates
in chronological order makes it easier to look at HLDS dumps and
.c files.
compiler/hlds_module.m:
Make module_info_predids return a module_info that is physically
updated though logically unchanged.
compiler/options.m:
Add --optimize-constructor-last-call-null.
Make the options --dump-hlds-pred-id, --debug-opt-pred-id and
--debug-opt-pred-name into accumulating options, to allow the user
to specify more than one predicate to be dumped (e.g. insert_2 and
its LCMC variant).
Delete --prev-code.
doc/user_guide.texi:
Document the changes in options.m.
compiler/code_info.m:
Record the value of --optimize-constructor-last-call-null in the
code_info, to avoid lookup at every cell construction.
compiler/unify_gen.m:
compiler/var_locn.m:
When deciding whether a cell can be static or not, make sure that
we never make static a cell that has some fields initialized with
dummy zeros, to be filled in for real later.
compiler/hlds_out.m:
For goals that are semipure or impure, note this fact. This info was
lost when I changed the representation of impurity from markers to a
field.
mdbcomp/prim_data.m:
Rename some ambiguous function symbols.
compiler/intermod.m:
compiler/trans_opt.m:
Rename the main predicates (and some function symbols) of these modules
to avoid ambiguity and to make them more expressive.
compiler/llds.m:
Don't print line numbers for foreign_code fragments if the user has
specified --no-line-numbers.
compiler/make.dependencies.m:
compiler/mercury_to_mercury.m:
compiler/recompilation.usage.m:
Don't use io.write to write out information to files we may need to
parse again, because this is vulnerable to changes to the names of
function symbols (e.g. the one to mdbcomp/prim_data.m).
The compiler still contains some uses of io.write, but they are
for debugging. I added an item to the todo list of the one exception,
ilasm.m.
compiler/recompilation.m:
Rename a misleading function symbol name.
compiler/parse_tree.m:
Don't import recompilation.m here. It is not needed (all the components
of parse_tree that need recompilation.m already import it themselves),
and deleting the import avoids recompiling almost everything when
recompilation.m changes.
compiler/*.m:
Conform to the changes above.
compiler/*.m:
browser/*.m:
slice/*.m:
Conform to the change to mdbcomp.
library/sparse_bitset.m:
Use some better variable names.
Estimated hours taken: 2
Branches: main
Eliminate some code duplication by unifying the two goal_path types have had
until now: one in mdbcomp/program_representation.m and compiler/hlds_goal.m,
which differed in only one detail (whether we record the total number of arms
in a switch). The new type is in program_representation.m, but with the
definition from goal_path.m.
Add a "step_" prefix to the function symbols of the goal_path_step type,
to avoid ambiguity with the hlds goals the steps describe.
Turn the predicates operating on goal_paths into functions for greater
convenience of use.
mdbcomp/program_representation.m:
compiler/hlds_goal.m:
Make the change described above.
browser/*.m:
compiler/*.m:
mdbcomp/*.m:
slice/*.m:
Conform to the change above.
tests/debugger/*.exp:
Expect the extra information now available for goal path steps
describing switches.
Estimated hours taken: 6
Branches: main
Document my recent change implementing coverage testing. At the same time,
eliminate the old hack that allowed a file containing a list of file names to
be considered a trace count file. We haven't needed it since the addition of
mtc_union, and it can lead to incomprensible error messages. (The presence
of the old hack made documenting coverage testing harder.)
In the process, fix the tools code for rerunning failed test cases only.
doc/user_guide.texi:
Document my recent change implementing coverage testing, and the
elimination of the old hack.
mdbcomp/trace_counts.m:
Modify the predicates for reading in trace count files along the lines
above.
mdbcomp/slice_and_dice.m:
Modify the predicates for reading in slices and dices along the lines
above.
Rename some function symbols to avoid ambiguities.
compiler/tupling.m:
slice/mcov.m:
slice/mtc_diff.m:
slice/mtc_union.m:
trace/mercury_trace_declarative.c:
Conform to the changes above.
slice/mcov.m:
Fix the usage message, which referred to this program by its old name
mct.
Allow the output to be restricted to a set of named modules only.
This is to make testing easier.
slice/mtc_diff.m:
Rename the long form of the -o option from --out to --output-file,
to make it consistent with the other programs.
tests/run_one_test:
tools/bootcheck:
Modify the algorithm we use to gather trace counts for the Mercury
compiler from both passed and failed test cases to run mtc_union
periodically instead of gathering all the trace counts file and keeping
them to the end (which takes far too much disk space).
Fix an old bug: gather trace counts from executions of the Mercury
compiler only.
tests/debugger/Mmakefile:
tests/debugger/dice.passes:
Modify the dice test case to compute the union of the trace counts for
the passed versions of this test case to use mtc_union to create
dice.passes, instead of having dice.passes statically contain the list
of the names of the passed trace count files (since that capability
is deleted by this diff).
tools/bootcheck:
tests/Mmake.common:
Fix the code for rerunning failed tests only.
mdbcomp/prim_data.m:
Eliminate some ambiguities in predicate names.
compiler/*.m:
Conform to the change to prim_data.m.
compiler/error_util.m:
Add reading files as a phase in error messages.
compiler/mercury_compile.m:
Use the new facilities in error_util for printing an error message.
Estimated hours taken: 24
Branches: main
This diff is the second step in implementing trace events. It modifies
label layouts to include room for solver-event-specific information, and
modifies the compiler to generate this information. Modifications to the
debugger to use this information, user-level documentation and test cases
will come later.
runtime/mercury_stack_layout.h:
Modify label layouts to allow them to hold information about solver
events.
Modify the macros creating label layouts to include a null pointer
as the value of the label layout's solver event field. For each such
macro, add a version that puts a pointer to the label's solver event
structure in that field.
Modify the definition of the MR_Long_Lval type to allow the
representation of constants, since without this capability solver
events would often need to be preceded by code to put constant
values (e.g. solver ids) into lvals. To make it easier to locate
all the places where MR_Long_Lvals are used (which need to be updated),
change the type MR_Long_Lval from a synonym for an int to a structure
containing an int.
runtime/mercury_types.h:
Add the typedefs now required for mercury_stack_layout.h.
runtime/mercury_goto.h:
Add a macro needed by mercury_stack_layout.h.
runtime/mercury_grade.h:
Change the binary compatibility version number for debug grades,
due to the change to label layouts.
runtime/mercury_layout_util.c:
Update the functions interpreting MR_Long_Lvals to conform to the
change in mercury_stack_layout.h.
runtime/mercury_deep_profiling_hand.h:
Fix a bug, possibly the bug preventing us from bootchecking in deep
profiling grades: stack slot numbers of ProcStatic structures are
supposed to be plain integers, not MR_Long_Lvals.
runtime/mercury_stack_trace.c:
library/exception.m:
trace/mercury_trace.c:
Conform the change in MR_Long_Lval.
runtime/mercury_trace_base.[ch]:
Add a new port: the solver event port.
Add a macro and a function for solver events: MR_SOLVER_EVENT and
MR_solver_trace. For now, they do the same thing as MR_EVENT and
MR_trace, but in future, they can do something else (e.g. generate
information for a visualization tool).
mdbcomp/prim_data.m:
Add a new port: the solver event port.
Rename all ports to eliminate clashes with language keywords such as
"call".
mdbcmp/trace_counts.m:
browser/declarative_execution.m:
slice/mcov.m:
compiler/tupling.m:
Conform to the change in port names, and to the addition of the new
port.
compiler/trace_params.m:
Conform to the change in port names, and to the addition of the new
port.
Rename some function symbols to avoid some ambiguities.
trace/mercury_trace_declarative.c:
Ignore the solver port when building the annotated trace, since it
doesn't fit into it.
compiler/prog_event.m:
Extend the representation of events to include names for the event
attributes.
compiler/call_gen.m:
Implement event goals. The implementation consists of a call to
MR_SOLVER_EVENT with a layout structure whose solver event field
points to a solver event structure giving the event goal's arguments.
Rename some function symbols to avoid some ambiguities.
compiler/trace_gen.m:
Add a predicate for generating solver events.
Conform to the change in port names.
Rename some function symbols to avoid some ambiguities.
compiler/code_info.m:
When recording trace layout information for a label, take an extra
argument describing the label layout's associated solver event, if any.
compiler/continuation_info.m:
Extend the first representation of label layouts to include room
for solver events.
compiler/stack_layout.m:
Convert the representation of solver events in continuation_info.m's
data structure to the data structure required by layout_out.m.
Conform to the changes in MR_Long_Lvals.
compiler/layout.m:
Extend the compiler's internal representation of the contents of label
layout structures to accommodate the optional solver event field.
compiler/layout_out.m:
Generate the extended label layout structures, using the new macros
in mercury_stack_layout.h if necessary.
Conform to the change in the MR_Long_Lval type.
Conform to the change in port names.
Rename some function symbols to avoid some ambiguities.
compiler/global_data.m:
Modify rval_type_as_arg to require only the value of the relevant
option, not a package of such options. This is for the new code
in stack_layout.m.
compiler/var_locn.m:
Conform to the change in global_data.m.
compiler/llds_out.m:
Conform to the change in continuation_info.m.
Delete this module's unused definition of rval_type_as_arg.
compiler/opt_debug.m:
Conform to the change in continuation_info.m.
Estimated hours taken: 60
Branches: main
Implement coverage testing. The output format is a bit crude, but people
have been asking for this capability.
The main problem tackled in this diff is that coverage testing requires
gathering information from a lot of program executions, and the execution count
files for all these executions require a huge amount of disk space. We now
therefore put a limit on the number of files we keep; when this limit is
exceeded, the program execution that reaches the limit will automatically
summarize all these files back into a single file before it exits.
This diff also tackles the same problem along a different axis by changing
the format of execution count files to make them smaller. One way is to factor
out and represent just once some information that is common to many procedures:
the file name and the module name. Another is to abbreviate some keywords,
e.g. "fproc" instead of "proc function". The third is not to write out the
defining module's name unless it differs from the declaring module's name,
which it almost never does. (The two differ only when the compiler is invoked
with intermodule optimization, and creates a specialized version of a predicate
in a module other than its home module.)
Since we are changing the trace count file format anyway, make another change
useful for coverage testing: record the entire provenance of the trace counts
in the file, including the name of the program and what files went into unions
and diffs of trace count files.
When doing coverage testing of the compiler, the compiler *must* be in a debug
grade. However, the tools for summarizing trace files, invoked from the
compiler executable when the compiler is being coverage tested, *cannot* be
in debug grade, because debug grade disables tail recursion, and without tail
recursion the summarization program runs out of stack space. This diff
therefore arranges for the slice directory to not be affected by the parameters
applying to the rest of the workspace (including the top level Mmake.params).
Mmakefile:
Don't apply the top level mmake's parameters to recursive mmakes in
the slice directory.
Factor out some common code.
configure.in:
Require that the installed compiler contain the renamed standard
library function names installed by my diff on Sep 20, since the
slice directory needs them, and cannot get them from the workspace.
mdbcomp/trace_counts.m:
Update the parsing code to parse the new format for trace count files,
and update the code for writing out trace counts to generate the new
format.
Replace the proc_label_and_filename type with the proc_label_in_context
type, which makes it easier to keep track of the current module as well
as the current file (this is required by the new, more compact format
for trace count files).
When considering the union of multiple trace counts files, keep track
of whether they contained all counts or just the nonzero counts. This
requires keeping track of this info for single files as well.
Provide ways to represent and to compute differences between trace
count files, to support the new program in slice/mtc_diff.m.
mdbcomp/slice_and_dice.m:
Reformat to conform to our Mercury style guide.
Conform to the change to trace_counts.m.
compiler/tupling.m:
Conform to the change to mdbcomp.
runtime/mercury_wrapper.c:
Implement the new option values used to implement coverage testing.
These allow control of the limit on the number of execution count
files, and collecting execution counts only from a specified
executable.
Add MR_ prefixes.
runtime/mercury_trace_base.[ch]:
Provide the mechanism for summarizing execution counts when we reach
the limit on the number of execution counts files.
Update the code that writes out trace counts files to generate
the new format for trace counts files. Make this code take the boolean
that says whether to include labels with zero counts in the output
as an explicit parameter, not as a global variable.
Break up an excessively large function.
scripts/mtc:
Add the options needed to control the process of automatic
summarization of trace counts files.
slice/.mgnuc_copts:
slice/.mgnuc_opts:
slice/SLICE_FLAGS.in:
Make these files empty, since we don't want to refer to the rest of the
workspace. (We could delete them as well, but CVS doesn't handle
resurrection of deleted files very well, and we don't want to burn any
bridges.)
slice/Mmakefile:
Add the new executables, and make the code in this directory
independent of the other directories in the workspace.
Since we need the code of the modules in the mdbcomp directory
but don't want to link to the object files in that directory (since
the grades may differ), make copies of those modules in this directory.
slice/mcov.m:
Add this module, the code for the Mercury coverage test tool.
slice/mtc_diff.m:
Add this module, the code for computing the diff between two trace
counts files. The intended use is to compare two trace counts files
dumped at different stages of execution. (Since foreign_procs can be
used to invoke the C functions in the runtime that write out the trace
counts files in the middle of a program's execution, not just the end.)
slice/mdice.m:
slice/mslice.m:
slice/mtc_union.m:
Convert to four space indentation.
tools/bootcheck:
Since the slice directory's grade is independent of the grade of the
other directories, don't copy it to the stage2 and stage3 by default.
If it is copied, then still compile it (and otherwise handle it)
separate from the other directories.
Add an option for gathering coverage test data during bootchecking.