mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 12:23:44 +00:00
083d376e6598628362ee91c2da170febd83590f4
16 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5a3fa03843 |
Improve programming style in the mdbcomp directory.
mdbcomp/mdbcomp.goal_path.m:
Replace clauses with an explicit switch.
mdbcomp/mdbcomp.m:
Provide C# and Java definitions of the version predicate.
Mdb needs this library only in C grades, but the compiler
has access to it even in C# and Java grades.
mdbcomp/shared_utilities.m:
Fix style.
mdbcomp/slice_and_dice.m:
Replace if-then-else chains with switches.
mdbcomp/sym_name.m:
Document a predicate.
|
||
|
|
06f81f1cf0 |
Add end_module declarations ...
.. to modules which did not yet have them. |
||
|
|
d465fa53cb |
Update the COPYING.LIB file and references to it.
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.
|
||
|
|
700a855efd |
Do not include mdbcomp modules in coverage reports by default.
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.
|
||
|
|
88bc250ca9 |
Note a couple of other places where you have to list new mdbcomp modules.
mdbcomp/mdbcomp.m:
Note a couple of other places where you have to list new mdbcomp modules.
deep_profiling/.gitignore:
slice/.gitignore:
Mention the recently added mdbcomp modules, to stop up git from listing
their copies in these directories as unknown files.
|
||
|
|
500948d549 |
Break up mdbcomp/prim_data.m. The new modules have much better cohesion.
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.
|
||
|
|
0d1ac0f053 |
Prevent not just the deep profiler, but also the other programs in the
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. |
||
|
|
d43239d6a7 |
Move some of the goal path code from compiler/goal_path.m to the mdbcomp
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.
|
||
|
|
8a28e40c9b |
Add the predicates sorry, unexpected and expect to library/error.m.
Estimated hours taken: 2 Branches: main Add the predicates sorry, unexpected and expect to library/error.m. compiler/compiler_util.m: library/error.m: Move the predicates sorry, unexpected and expect from compiler_util to error. Put the predicates in error.m into the same order as their declarations. compiler/*.m: Change imports as needed. compiler/lp.m: compiler/lp_rational.m: Change imports as needed, and some minor cleanups. deep_profiler/*.m: Switch to using the new library predicates, instead of calling error directly. Some other minor cleanups. NEWS: Mention the new predicates in the standard library. |
||
|
|
01d145ab8f |
Introduce a feedback system that allows analysis tools to feed information
Estimated hours taken: 8 Branches: main Introduce a feedback system that allows analysis tools to feed information back into the compiler. This can be used with the deep profiler to improve many optimizations. Tools update information in the feedback file rather than clobbering existing un-related information. Modify the implicit parallelism work to make use of the new feedback system. mdprof_feedback updates a feedback file and in the future will be able to collect more information from the deep profiler. mdbcomp/feedback.m: Created a new module for the feedback system, types representing feedback information and predicates for reading and writing feedback files, and manipulating feedback information are defined here. mdbcomp/mdbcomp.m: Updated to include the mdbcomp/feedback.m in this library. mdbcomp/program_representation.m: Created a new type to describe a call. This is used by the current implicit parallelism implementation. deep_profiler/mdprof_feedback.m: Updated to use the new feedback system. The old feedback file code has been removed. --program-name option has been added, a program name must be provided to be included in the header of the feedback file. Conform to changes in mdbcomp/program_representation.m compiler/globals.m: Added feedback data to globals structure. Added predicates to get and set the feedback information stored in the globals structure. Modified predicates that create the globals structure. compiler/handle_options.m: Set feedback information in globals structure when it is created in postprocess_options. Read feedback information in from file in check_option_values. Code added to postprocess_options2 to check the usage of the --implicit-parallelism option. compiler/implicit_parallelism.m: This module no-longer reads the feedback file it's self, this code has been removed, as has the IO state. Information from the feedback state is retrieved and used to control implicit parallelism. compiler/mercury_compile.m: No-longer checks options for implicit parallelization, this is now done in compiler/handle_options.m. Conform to changes in implicit_parallelism.m deep_profiler/Mmakefile: slice/Mmakefile: Modified to include mdbcomp/feedback.m for compilation in this directory. |
||
|
|
b82b599ec3 |
Implement coverage testing. The output format is a bit crude, but people
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. |
||
|
|
74ce85d476 |
Provide a mechanism for collecting statistics about tabling operations,
Estimated hours taken: 60
Branches: main
Provide a mechanism for collecting statistics about tabling operations,
and provide a much more convenient mechanism for resetting tables.
Since it would too complex to do this while preserving the capability
of setting --tabling-via-extra-args to no, eliminate that capability
and the option. That option was useful only for measurements of the
performance boost from setting --tabling-via-extra-args to yes in any case,
so users lose no functionality.
Previously, the only way to debug the low level details of the tabling
mechanism was to build a runtime with a specific C macro (MR_TABLE_DEBUG)
and link with that runtime; this was cumbersome. Change that so that
every one of the debuggable tabling macros has a bool argument that says
whether debugging is enabled or not. The compiler can then set this to
MR_TRUE if the new option --table-debug is given, and to MR_FALSE otherwise.
If set to MR_FALSE, the C compiler should optimize away the debug code,
with zero impact on program size or speed.
Since these changes to macros require nontrivial bootstrapping, which we don't
want to do unnecessarily, modify the interface of the tabling macros as
required to support size limits on tables. This diff also implements the
parsing of size limit specifications on tables, but does not implement them
yet; that is for a future change.
To make the syntax simpler, this diff deletes the free-standing fast_loose_memo
pragma. The same functionality is now available with a fast_loose annotation
on an ordinary memo pragma.
Make a bunch of changes to improve readability and maintainability
in the process. These mostly take the form of renaming ambiguous and/or
not sufficiently expressive function symbols.
runtime/mercury_stack_layout.h:
runtime/mercury_tabling.h:
Move the description of structure of tables from mercury_stack_layout.h
to mercury_tabling.h, since we now need it for statistics even if
execution tracing is not enabled.
Modify those data structures to have room for the statistics.
Don't distinguish "strict", "fast_loose" and "specified" memoing
as separate eval methods; treat them as just different kinds
of the same eval method: "memo".
Remove underscores from the names of some types that the style guide
says shouldn't be there.
runtime/mercury_tabling_preds.h:
runtime/mercury_tabling_macros.h:
Modify the approach we use for macros that implement the predicates
of library/table_builtin.m. Instead of selecting between debug and
nondebug based on whether MR_TABLE_DEBUG is defined or not, add
an explicit argument controlling this to each debuggable macro.
The advantage of the new arrangement is that it scales. Another
argument controls whether we are computing statistics (and if yes,
where do we put it), and a third argument controls whether we maintain
back links in the tries and hash tables (this last argument is present
but is ignored for now).
Since the values of the arguments will be known when the .c files
containing calls to these macros are compiled, we pay the space and
time cost of debugging, statistics gathering and the maintenance of
back links if and only we need the revelant functionality.
Provide macros for limited backward compatibility with the old set
of macros; these allow workspaces created by old compilers to work
with the new macros in the runtime. The old macros followed the
naming scheme MR_table_*, the new ones are named MR_tbl_*.
runtime/mercury_table_int_fix_index_body.h:
runtime/mercury_table_int_start_index_body.h:
runtime/mercury_table_type_body.h:
New files containing parts of the old mercury_tabling.c. Each of these
files contains the body of the functions that used to be in
mercury_tabling.c. The new mercury_tabling.c #includes each of these
files more than once, to provide more than one variant of the old
function. These variants differ in aspects such as whether debugging
is enabled or statistics is being collected. Each variant therefore
incurs only the time costs it needs to. (We pay the space cost of
having all these variants all the time of course, but this cost
is negligible.)
runtime/mercury_tabling_stats_defs.h:
runtime/mercury_tabling_stats_nodefs.h:
runtime/mercury_tabling_stats_undefs.h:
New files that serve as wrappers around the newly #included files,
controlling how they handle statistics.
runtime/mercury_tabling.c:
Delete functions now in the new files, and #include them instead.
Delete the data structures that used to contain summary statistics;
the new approach keeps statistics in compiler-generated,
procedure-specific data structures.
runtime/mercury_trace_base.c:
Use the new versions of the tabling macros to access the I/O table.
runtime/mercury_type_info.h:
Update some documentation for the movement of code out of
mercury_tabling.c.
runtime/mercury_types.h:
Provide forward declarations of the identifiers denoting the new types
in mercury_tabling.h.
runtime/mercury_grade.h:
Increment the exec trace version number, since we have changed
a part of the exec trace structure.
runtime/mercury_bootstrap.h:
Fix some temporary issues that arise from some renames above.
runtime/mercury_hash_lookup_or_add_body.h:
Fix comment.
runtime/Mmakefile:
Mention the new files and the dependencies that involve them.
library/table_builtin.m:
Provide a type for representing statistics and a predicate for
printing statistics.
Use the updated versions of the macros in
runtime/mercury_tabling_preds.h.
compiler/prog_item.m:
Change representation of tabling pragmas to allow room for the new
attributes.
Allow an item to be marked as being generated by the compiler
as a result of a pragma memo attribute. We use this for the reset
and statistics predicates.
compiler/mercury_to_mercury.m:
Write out the new attributes of the tabling pragma.
compiler/prog_data.m:
compiler/hlds_data.m:
Change the cons_id that used to refer to a procedure's call table root
to refer to the entirety of the new data structure now containing it.
The compiler now needs a way to refer to the other components of this
new data structure, since it contains the statistics.
As in the runtime, don't distinguish "strict", "fast_loose" and
"specified" memoing as separate eval methods; treat them as just
different kinds of the same eval method: "memo".
Rename some of the uses of the function symbols "c", "java", "il".
compiler/hlds_pred.m:
Add an extra field in proc_infos for storing any tabling attributes.
Change the existing proc_info field that records information about
the kinds of arguments of tabled procedures to record the information
needed by the debugger too. This was needed to allow us to shift all
the RTTI for procedure-specific tables (as opposed to the RTTI for
the global I/O table) from mercury_stack_layout.h to mercury_tabling.h
without duplicating the data (which would be a maintenance problem).
Reformat some comments to make them easier to read.
compiler/layout.m:
compiler/layout_out.m:
Delete the part of the exec trace information that used to record
RTTI for tables, since this information is not generated only as
part of the debugger data structures anymore.
compiler/prog_io_pragma.m:
Recognize the updated syntax for tabling pragmas.
compiler/add_pragma.m:
When processing tabling pragmas for inclusion in the HLDS, create
any reset and statistics predicates they ask for.
compiler/make_hlds_passes.m:
Export a predicate now needed by add_pragma.m.
Handle the new attributes on tabling pragmas
compiler/globals.m:
Change the function symbols of the types describing backends and
foreign languages to say what they are. Previously, both types (as well
as several others) included the function symbol "c"; now, they are
target_c and lang_c respectively.
compiler/table_gen.m:
Implement the changes described at the top.
When passing around varsets and vartypes, pass the arguments in the
standard order.
compiler/goal_util.m:
compiler/hlds_goal.m:
When passing around varsets and vartypes, pass the arguments in the
standard order.
compiler/rtti.m:
Provide types for representing the runtime's data structures for
tabling (which are now significantly more complex than a single word)
and predicates for manipulating them, for use by both the ml and ll
backends.
compiler/llds.m:
Replace the comp_gen_c_var type with the tabling_info_struct type,
which contains the information needed to create the per-procedure
tabling data structures.
Replace references to call tables with references to the various
components of the new tabling data structures.
compiler/llds_out.m:
Add code to write out tabling_info_structs.
Delete the code required for the old, hacky way of resetting tables.
Reorder some code more logically.
compiler/proc_gen.m:
Generate tabling_info_structs.
compiler/stack_layout.m:
Don't generate the information now generated in proc_gen.m.
compiler/mlds.m:
Give mlds_proc_labels their own function symbols, instead of using
a pair. Rename some other function symbols to avoid ambiguity and add
expressiveness.
Provide for the representation of references to the various components
of the new tabling data structures, and for the representation of their
types.
compiler/ml_code_gen.m:
When generating code for a tabled procedure, generate also the data
structures required for its table.
compiler/rtti_to_mlds.m:
compiler/ml_util.m:
Move some predicates from rtti_to_mlds.m to ml_util.m, since we
now also want to call them from ml_code_gen.m.
compiler/name_mangle.m:
Add some utility predicates.
compiler/options.m:
Delete the old --allow-table-reset option.
Add the new --table-debug option.
Comment out an implementor-only option.
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_trail_ops.m:
compiler/add_type.m:
compiler/bytecode_gen.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/dependency_graph.m:
compiler/det_report.m:
compiler/export.m:
compiler/fact_table.m:
compiler/foreign.m:
compiler/global_data.m:
compiler/globals.m:
compiler/handle_options.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/hlds_out.m:
compiler/inlining.m:
compiler/intermod.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_elim_nested.m:
compiler/ml_optimize.m:
compiler/ml_switch_gen.m:
compiler/ml_tailcall.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/modes.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/proc_label.m:
compiler/prog_data.m:
compiler/prog_foreign.m:
compiler/prog_item.m:
compiler/prog_mutable.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_util.m:
compiler/recompilation.version.m:
compiler/size_prof.m:
compiler/special_pred.m:
compiler/switch_util.m:
compiler/transform_llds.m:
compiler/tupling.m:
compiler/type_ctor_info.m:
compiler/unify_gen.m:
Conform to the changes above, and/or improve some comments.
mdbcomp/prim_data.m:
Make the names of the function symbols of the proc_label type more
expressive and less ambiguous.
mdbcomp/prim_data.m:
mdbcomp/mdbcomp.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/trace_counts.m:
Use . instead of __ as module qualifier.
Conform to the change to prim_data.m.
browser/declarative_execution.m:
browser/declarative_oracle.m:
browser/declarative_tree.m:
Conform the change to mdbcomp/prim_data.m.
tests/debugger/Mercury.options:
Don't specify --allow-table-reset for fib.m, since that option
doesn't exist anymore.
tests/debugger/fib.m:
Use the new mechanism for resetting the table.
tests/debugger/print_table.m:
Use the new syntax for pragma memo attributes.
tests/invalid/specified.{m,err_exp}:
Use to the new syntax and reset method for pragma memo attributes.
Test the handling of errors in the new attribute syntax.
tests/tabling/Mercury.options:
Don't specify --allow-table-reset for specified.m, since that option
doesn't exist anymore.
tests/tabling/specified.m:
Use the new syntax for pragma memo attributes, and use the new
mechanism for resetting tables. We could also use this test case
for testing the printing of statistics, but the format of that
output is still not final.
tests/tabling/fast_loose.m:
Use the new syntax for pragma memo attributes, and use the new
mechanism for resetting tables.
trace/mercury_trace.c:
trace/mercury_trace_cmd_developer.c:
Conform to the changes in the RTTI data structures regarding tabling.
Remove underscores from the names of some types that the style guide
says shouldn't be there.
library/robdd.m:
Comment out the tabling pragma until this change is bootstrapped.
Without this, the conflict between the old calls to macros generated
by the existing compiler and the new definition of those macros
in the runtime would cause errors from the C compiler.
|
||
|
|
d7554de953 |
Convert a bunch more modules to four-space indentation.
Estimated hours taken: 5 Branches: main browser/*.m: compiler/*.m: mdbcomp/*.m: Convert a bunch more modules to four-space indentation. |
||
|
|
fefcf468a0 |
Use dicing information in the declarative debugger.
Estimated hours taken: 30 Branches: main Use dicing information in the declarative debugger. Each label in the program is assigned a suspicion based on a supplied dice. A new search mode then performs divide and query using the total suspicion of a subtree as the weighting of the subtree. browser/declarative_analyser.m: Parameterize the divide and query search mode by allowing it to work with an arbitrary weighting heuristic. Support two weighting heuristics: number of events and suspicion. Since there is still only one weight field for each suspect, if the weighting heuristic changes, then update all the weights of all the suspects. Return a different reason for asking a divide and query question, depending on the weighting heuristic. Some information (specifically how many suspect events remain and the estimated number of questions remaining for divide and query) returned by the info command depends on the current weighting heuristic being the number of events. If the current weighting heuristic is not the number of events then do not show this information. browser/declarative_debugger.m: Pass the trace node store to set_fallback_search_mode so that the weights can be recalculated if the search strategy changes. browser/declarative_edt.m: In the mercury_edt typeclass, rename the edt_weight method to edt_number_of_events and add a new method edt_subtree_suspicion. The weight field of each suspect in the search space can either be based on suspicion or number of events. Add a field to the search_space type to determine which weighting heuristic to use. Export predicates to get and set the current weighting heuristic being used. If the weighting heuristic changes the recalculate the weights of all the suspects. When calculating the weight of a suspect use the current weighting heuristic. browser/declarative_execution.m: Record a suspicion accumulator at each interface event which can be used to calculate the suspicion of a subtree in the EDT. Move the label_layout and proc_layout types as well as all utility predicates for those types to a new module, mdbcomp.label_layout. browser/declarative_oracle.m: browser/declarative_user.m: browser/debugger_interface.m: Import mdbcomp.label_layout. browser/declarative_tree.m: Adjust for the extra field in interface nodes in the annotated trace. Look at the weighting heuristic when calculating the weight of a subtree. browser/util.m: mdbcomp/program_representation.m: Move goal_path_string to mdbcomp.program_representation since it is needed in mdbcomp.label_layout. doc/user_guide.texi: Document the new search mode. mdbcomp/label_layout.m: This module contains the types label_layout and proc_layout and supporting predicates which were in mdb.declarative_execution. These types are needed in the mdbcomp.slice_and_dice module. mdbcomp/mdbcomp.m: Include label_layout. mdbcomp/slice_and_dice.m: Add functions for calculating different suspicion formulas. The intention is to experiment with different formulas in the future. Export predicates for reading a dice from the C backend. Export a predicate for retrieving the suspicion of a label given a dice. This predicate uses the suspicion_ratio_binary formula, since that seems most effective in my (as yet very limited) experience. I will implement better ways to control and customise the formula used in the future. mdbcomp/trace_counts.m: Add a function for constructing a path_port given a goal path and a trace port. If there is an unexpected exception when reading a trace counts file then print the unexpected exception. Add a predicate to convert trace count file types to a string and vica versa. runtime/mercury_stack_layout.h: Fix a typo. runtime/mercury_trace_base.c: runtime/mercury_trace_base.h: Export a function to look up the trace count slot for a label. Use this function when recording trace counts. This function will also be used in the declarative debugger backend to look up suspicions for labels. Add a function to initialise the array which records which ports need a goal path to uniquely identifiy the label. Initially I used this array elsewhere which is why I exported it. I didn't actually end up needing to use it in the final version, but I'm still exporting it, since it might be useful in the future. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/dice.exp: tests/debugger/declarative/dice.inp: tests/debugger/declarative/dice.m: Test the new search mode. tests/debugger/declarative/info.exp: tests/debugger/declarative/change_search.exp: The weigting heuristic is now printed with the info command. Also some information, such as the number of suspect events, is no longer printed if the weigthing heuristic is not the number of events (since then that information is not available). trace/mercury_trace_declarative.c: Add a function to setup the trace counts array with a suspicion for each label. For efficiency the suspicion is converted from a float to an integer between 0 and 100. If a flag is set, then increment an accumulator with the suspicion of each label executed as the annotated trace is being constructed. Store the value of the accumulator at interface events, so that the frontend can efficiently calculate the suspicion of any subtree. Remove a redundant variable and comment: the goal path is no longer passed to the frontend, because the frontend has access to the label_layout from which it can get the goal path (the variable and comment are artifacts of a previous change). When checking if a search mode is valid also check if failing and passing trace counts are required for the search mode. Allow abbreviations for the search mode arguments. trace/mercury_trace_declarative.h: Export the predicate to set up the suspicions for each label. trace/mercury_trace_internal.c: Allow passing and failing test case(s) to be passed as arguments to the dd command. If passing and failing test case(s) are supplied then record suspicions in the annotated trace even if the sdq search mode is not specified. The user could switch to the sdq search mode later on. Initialise some values which were causing warnings from the C compiler. browser/debugger_interface.m: browser/declarative_analyser.m: browser/declarative_debugger.m: browser/declarative_edt.m: browser/declarative_execution.m: browser/declarative_oracle.m: browser/declarative_tree.m: browser/declarative_user.m: browser/util.m: doc/user_guide.texi: mdbcomp/mdbcomp.m: mdbcomp/program_representation.m: mdbcomp/rtti_access.m: mdbcomp/slice_and_dice.m: mdbcomp/trace_counts.m: runtime/mercury_stack_layout.h: runtime/mercury_trace_base.c: runtime/mercury_trace_base.h: tests/debugger/declarative/Mmakefile: tests/debugger/declarative/dice.exp: tests/debugger/declarative/dice.inp: tests/debugger/declarative/dice.m: tests/debugger/declarative/info.exp: trace/mercury_trace_declarative.c: trace/mercury_trace_declarative.h: trace/mercury_trace_internal.c: |
||
|
|
83f8deb354 |
Add two new command line tools "mslice" and "mdice", which manipulate slices
Estimated hours taken: 24 Branches: main Add two new command line tools "mslice" and "mdice", which manipulate slices and dices respectively. The functionality of "mdice" duplicates the functionality of mdb's current "dice" command, while the functionality of "mslice" is new. runtime/mercury_trace_base.[ch]: When generating trace count files, include information about the context of each execution count. While mdb has access to this information in the running program, mslice and mdice do not. In any case, the code in mdb for looking up this information was terribly inefficient. Provide a mechanism for recording all execution counts, even the zero ones, for use in coverage testing. This mechanism is not used yet. Put a header on trace counts files, to make them recognizable as such. Make this header indicate whether we are including zero trace counts. runtime/mercury_wrapper.c: Provide a flag in MERCURY_OPTIONS for turning on recording of zero execution counts. browser/dice.m: mdbcomp/slice_and_dice.m: Move most of the code of browser/dice.m to mdbcomp/slice_and_dice.m, much modified; browser/dice.m is now empty. The modifications are as follows. Factor out the code for reading dices, since dices are useful independent of mdb's dice command. Generalize the code for computing dices to allow either or both of the slices being subtracted to be specified as the union of one or more trace counts files. Add two more sort conditions for comparing the execution counts in two slices: ascending and descending versions of simple execution count differences. For each operation we have so far performed on dices, add code for performing that operation on slices. browser/mdb.m: Delete the include of dice.m, since it is now empty. Delete a duplicate include_module of term_rep, and delete the now unnecessary include_modules of set_cc and tree234_cc. mdbcomp/mdbcomp.m: Add slice_and_dice.m as a submodule. mdbcomp/trace_counts.m: Provide a mechanism to allow a slice to be specified as coming not from a single trace count file but from the union operation on a set of trace count files. Convert to four-space indentation to eliminate some excessively indented lines. slice/mdice.m: slice/mslice.m: The main modules of two new commands. Their functionality is almost entirely in mdbcomp/slice_and_dice.m and mdbcomp/trace_counts.m. slice/Mmakefile: New Mmakefile for building mslice and mdice. It is modelled on profiler/Mmakefile. slice/Mercury.options: Empty file, for use in the future. slice/.nocopyright: Don't require copyright notice in Mercury.options. Mmakefile: Process the slice directory at appropriate points when processing other directories. compiler/tupling.m: Conform to the updated interface of mdbcomp/trace_counts. library/list.m: Add versions of list__map for some more arities, for use in the code above. trace/mercury_trace_internal.c: Generalize the code for specifying dices to allow either or both of the slices being subtracted to be specified as the union of one or more trace counts files. Fix several places where we weren't checking the return value of malloc. Fix two places where we could conceivably free strings that were still alive. Fix some places where we could pass NULL strings to Mercury code, and some places where we could free NULL pointers (which, once upon a time, was not guaranteed to work on all platforms). Use existing functions such as MR_copy_string where appropriate. tests/run_one_test: Fix two small bugs in this script: make the filenames more user friendly, and make sure that gzip isn't asked to overwrite an existing file, since that causes it to ask a question on stdout and to wait for an answer. tools/bootcheck: Copy or link the slice directory into stage 2. Rename the --copy-profiler option as --copy-profilers, since it now copies three directories containing performance engineering tools: profiler, deep_profiler and slice. |
||
|
|
6b0fb566ce |
Move the mdbcomp library to its own directory.
Estimated hours taken: 12 Branches: main Move the mdbcomp library to its own directory. To make this change less painful to test, improve the way we handle installs. browser/mdbcomp.m: browser/mer_mdbcomp.m: browser/prim_data.m: browser/program_representation.m: browser/trace_counts.m: Move these files to the mdbcomp directory. browser/Mmakefile: browser/Mercury.options: mdbcomp/Mmakefile: mdbcomp/Mercury.options: Split the contents of the old Mmakefile and Mercury.options file in the browser directory between these files as appropriate. Simplify away the stuff not needed now that there is only one library per directory. Make the browser directory see the relevant files from the mdbcomp directory. Mmake.common.in: Separate out the prefixes allowed in the browser and the mdbcomp directories. Mmake.workspace: Set up a make variable to refer to the mdbcomp directory. Adjust references to the mdbcomp library to point to its new location. Mmakefile: Make invocations visit the mdbcomp library as necessary. Improve the way we install grades. Making temporary backups of the directories modified by the install process is unsatisfactory for two reasons. First, if the install fails, the cleanup script, which is necessary for user friendliness, destroys any evidence of the cause. Second, the restore of the backup wasn't perfect, e.g. it left the .d files modified to depend on .mih files, which don't exist in LLDS grades, and also left altered timestamps. This diff changes the install process to make a single tmp_dir subdirectory of the workspace, with all the work of install_grade being done inside tmp_dir. The original directories aren't touched at all. */Mmakefile: Adjust references to the browser directory to refer to the mdbcomp directory instead or as well. scripts/Mmake.rules: */Mmakefile: Make it easier to debug Mmakefiles. Previously, creating a Mmake.makefile with mmake -s and invoking "make -d" ignored the most fundamental rules of mmake, because Mmake.rules was treating an unset MMAKE_USE_MMC_MAKE as if it were set to "yes", simply because it was different from "no". This diff changes it to treat an unset MMAKE_USE_MMC_MAKE as if it were set to "no", which is a more sensible default. scripts/prepare_tmp_dir_fixed_part.in: scripts/scripts/prepare_tmp_dir_grade_part: Two new scripts that each do half the work of preparing tmp_dir for the real work of the install_grade make target. The fixed_part script prepares the parts of tmp_dir that are grade-independent, while the grade_part scripts prepares the parts that are grade-dependent. configure.in: Test C files in the mdbcomp directory to see whether they need to be recompiled after reconfiguration. Create prepare_tmp_dir_fixed_part from prepare_tmp_dir_fixed_part.in. compiler/*.m: runtime/mercury_wrapper.c: Update the references to the moved files. compiler/notes/overall_design.html: Mention the new directory. |