deep_profiler/measurement_units.m:
When writing out floats with given numbers of decimal places
after the dot, use fixed format strings that the compiler can check.
deep_profiler/Mercury.options:
Stop specifying --no-warn-unknown-format-calls for measurement_units.m.
deep_profiler/display.m:
deep_profiler/display_report.m:
Conform to the change in measurement_units.m.
deep_profiler/html_format.m:
Style fix.
deep_profiler/*.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most modules, either the order of the declarations or the order
of the definitions made sense, and I changed the other to match.
In some modules, neither made sense, so I changed *both* to an order
that *does* make sense (i.e. it has related predicates together).
In query.m, put the various commands in the same sensible order
as the code processing them.
In html_format.m, merge two exported functions together, since
they can't be used separately.
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style.
deep_profiler/DEEP_FLAGS.in:
Since all the modules in this directory are now free from any warnings
generated by --warn-inconsistent-pred-order-clauses, specify that option
by default in this directory to keep it that way.
All of these places were pointed out by the new --inform-incomplete-switch
option.
compiler/add_pred.m:
compiler/goal_form.m:
compiler/intermod.m:
compiler/ml_elim_nested.m:
compiler/post_term_analysis.m:
compiler/prog_mode.m:
compiler/prog_type.m:
compiler/unneeded_code.m:
compiler/var_locn.m:
As above. In some cases, this meant adding the missing cons_ids
with a simple `fail' as the goal. In other cases, it meant adding
comments on the `fail'. In yet other cases, it involved replacing
semidet predicates with functions returning bools.
In a few places, the code for the previously-missing cons_id
throws an exception.
In prog_mode.m and var_locn.m, the code for some previously-missing
cons_ids is neither `fail' nor an abort, but code that does the actual
job of the predicate it is in. In these cases, the fact that this code
was previously missing seems to have been a bug.
compiler/lp_rational.m:
Delete unnecessary module qualification on pred and func declarations.
Fix some comments.
compiler/rtti_to_mlds.m:
deep_profiler/html_format.m:
Fix some comments.
browser/browse.m:
browser/declarative_edt.m:
compiler/continuation_info.m:
compiler/hlds_out_goal.m:
compiler/llds_out_file.m:
compiler/make.dependencies.m:
compiler/ml_closure_gen.m:
compiler/ml_elim_nested.m:
compiler/options_file.m:
compiler/prog_io_pragma.m:
deep_profiler/html_format.m:
Delete some dead predicates that won't be needed anymore.
compiler/hlds_goal.m:
compiler/jumpopt.m:
Comment out some dead predicates that may be needed later.
compiler/matching.m:
compiler/typecheck.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
Convert some dead predicates into live predicates by adding calls to them
at their intended call sites. In some cases the missing call was a sort-of
bug (the code worked, but not as well as it should have). In others, the
call was intended only for debugging, and the new call is in a trace scope
that is disabled by default.
compiler/ml_foreign_proc_gen.m:
Add an XXX comment about a dead procedure.
deep_profiler/*.m:
Replace ( C -> T ; E ) if-then-elses with (if C then T else E ).
Replace calls to error/1 with calls to unexpected/3.
Add some module qualifications where this makes the code easier to read.
*/*_FLAGS.in:
Specify that by default, the compiler should generate warnings
for unknown format strings and bad known format strings.
*/Mercury.options:
Override this default setting for a few modules that have legitimate
reasons for calling e.g. string.format with unknown format strings.
compiler/fact_table.m:
deep_profiler/html_format.m:
Minor changes to avoid calling string.format with unknown format strings.
Estimated hours taken: 120
Branches: main
The algorithm that decides whether the order independent state update
transformation is applicable in a given module needs access to the list
of oisu pragmas in that module, and to information about the types
of variables in the procedures named in those pragmas. This diff
puts this information in Deep.procrep files, to make them available
to the autoparallelization feedback program, to which that algorithm
will later be added.
Compilers that have this diff will generate Deep.procrep files in a new,
slightly different format, but the deep profiler will be able to read
Deep.procrep files not just in the new format, but in the old format as well.
runtime/mercury_stack_layout.h:
Add to module layout structures the fields holding the new information
we want to put into Deep.procrep files. This means three things:
- a bytecode array in module layout structures encoding the list
of oisu pragmas in the module;
- additions to the bytecode arrays in procedure layout structures
mapping the procedure's variables to their types; and
- a bytecode array containing the encoded versions of those types
themselves in the module layout structure. This allows us to
represent each type used in the module just once.
Since there is now information in module layout structures that
is needed only for deep profiling, as well as information that is
needed only for debugging, the old arrangement that split a module's
information between two structures, MR_ModuleLayout (debug specific
info) and MR_ModuleCommonLayout (info used by both debugging and
profiling), is no longer approriate. We could add a third structure
containing profiling-specific info, but it is simpler to move
all the info into just one structure, some of whose fields
may not be used. This wastes only a few words of memory per module,
but allows the runtime system to avoid unnecessary indirections.
runtime/mercury_types.h:
Remove the type synonym for the deleted type.
runtime/mercury_grade.h:
The change in mercury_stack_layout.h destroys binary compatibility
with previous versions of Mercury for debug and deep profiling grades,
so bump their grade-component-specific version numbers.
runtime/mercury_deep_profiling.c:
Write out the information in the new fields in module layout
structures, if they are filled in.
Since this changes the format of the Deep.procrep file, bump
its version number.
runtime/mercury_deep_profiling.h:
runtime/mercury_stack_layout.c:
Conform to the change to mercury_stack_layout.h.
mdbcomp/program_representation.m:
Add to module representations information about the oisu pragmas
defined in that module, and the type table of the module.
Optionally add to procedure representations a map mapping
the variables of the procedure to their types.
Rename the old var_table type to be the var_name_table type,
since it contains just names. Make the var to type map separate,
since it will be there only for selected procedures.
Modify the predicates reading in module and procedure representations
to allow them to read in the new representation, while still accepting
the old one. Use the version number in the Deep.procrep file to decide
which format to expect.
mdbcomp/rtti_access.m:
Add functions to encode the data representations that this module
also decodes.
Conform to the changes above.
mdbcomp/feedback.automatic_parallelism.m:
Conform the changes above.
mdbcomp/prim_data.m:
Fix layout.
compiler/layout.m:
Update the compiler's representation of layout structures
to conform to the change to runtime/mercury_stack_layout.h.
compiler/layout_out.m:
Output the new parts of module layout structures.
compiler/opt_debug.m:
Allow the debugging of code referring to the new parts of
module layout structures.
compiler/llds_out_file.m:
Conform to the move to a single module layout structure.
compiler/prog_rep_tables.m:
This new module provided mechanisms for building the string table
and the type table components of module layouts. The string table
part is old (it is moved here from stack_layout.m); the type table
part is new.
Putting this code in a module of its own allows us to remove
a circular dependency between prog_rep.m and stack_layout.m;
instead, both now just depend on prog_rep_tables.m.
compiler/ll_backend.m:
Add the new module.
compiler/notes/compiler_design.html:
Describe the new module.
compiler/prog_rep.m:
When generating the representation of a module for deep profiling,
include the information needed by the order independent state update
analysis: the list of oisu pragmas in the module, if any, and
information about the types of variables in selected procedures.
To avoid having these additions increasing the size of the bytecode
representation too much, convert some fixed 32 bit numbers in the
bytecode to use variable sized numbers, which will usually be 8 or 16
bits.
Do not use predicates from bytecode_gen.m to encode numbers,
since there is nothing keeping these in sync with the code that
reads them in mdbcomp/program_representation.m. Instead, use
new predicates in program_representation.m itself.
compiler/stack_layout.m:
Generate the new parts of module layouts.
Remove the code moved to prog_rep_tables.m.
compiler/continuation_info.m:
compiler/proc_gen.m:
Make some more information available to stack_layout.m.
compiler/prog_data.m:
Fix some formatting.
compiler/introduce_parallelism.m:
Conform to the renaming of the var_table type.
compiler/follow_code.m:
Fix the bug that used to cause the failure of the
hard_coded/mode_check_clauses test case in deep profiling grades.
deep_profiler/program_representation_utils.m:
Output the new parts of module and procedure representations,
to allow the correctness of this change to be tested.
deep_profiler/mdprof_create_feedback.m:
If we cannot read the Deep.procrep file, print a single error message
and exit, instead of continuing with an analysis that will generate
a whole bunch of error messages, one for each attempt to access
a procedure's representation.
deep_profiler/mdprof_procrep.m:
Give this program an option that specifies what file it is to
look at; do not hardwire in "Deep.procrep" in the current directory.
deep_profiler/report.m:
Add a report type that just prints the representation of a module.
It returns the same information as mdprof_procrep, but from within
the deep profiler, which can be more convenient.
deep_profiler/create_report.m:
deep_profiler/display_report.m:
Respectively create and display the new report type.
deep_profiler/query.m:
Recognize a query asking for the new report type.
deep_profiler/autopar_calc_overlap.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/autopar_types.m:
deep_profiler/branch_and_bound.m:
deep_profiler/coverage.m:
deep_profiler/display.m:
deep_profiler/html_format.m:
deep_profiler/mdprof_test.m:
deep_profiler/measurements.m:
deep_profiler/query.m:
deep_profiler/read_profile.m:
deep_profiler/recursion_patterns.m:
deep_profiler/top_procs.m:
deep_profiler/top_procs.m:
Conform to the changes above.
Fix layout.
tests/debugger/declarative/dependency.exp2:
Add this file as a possible expected output. It contains the new
field added to module representations.
in the table for the calls into the procedure from its parent call sites.
Note that since this report shows proc static data parent call sites are
defined as calls to the procedure from other procedures (they may include
mutual recursion). As this may be a point of confusion this information is
only shown in developer mode.
report.m:
As above.
We also count the number of calls into this procedure, including the
numbers of unique ProcStatic and ProcDynamic structures seen.
The later is trivially the number of calls into the procedure.
create_report.m:
Generate this data.
display_report.m:
Handle the new report data.
display.m:
So that we only show this table row in developer mode, add a new table
row type (table_developer_row) that contains the real table row.
html_format.m:
Handle the new table row type.
Branches: main
Change the argument ordering of predicates in the set module.
library/set.m:
Change predicate argument orders to match the versions
in the svset module.
Group function definitions with the corresponding predicates
rather than at the end of the file.
Delete Ralph's comments regarding the argument order in the
module interface: readers of the library reference guide are
unlikely to be interested in his opinion of the argument ordering
ten or so years ago.
Add extra modes for set.map/3 and set.map_fold/5.
library/svset.m:
library/eqvclass.m:
library/tree234.m:
library/varset.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
mdbcomp/trace_counts.m:
extras/moose/grammar.m:
extras/moose/lalr.m:
extras/moose/moose.m:
tests/hard_coded/bitset_tester.m:
Conform to the above change.
NEWS:
Announce the above changes.
Branches: main
Change places where we create an empty map and the immediately do a det_insert
into it to use the recently added singleton map function.
compiler/add_pragma.m:
compiler/common.m:
compiler/dep_par_conj.m:
compiler/higher_order.m:
compiler/hlds_data.m:
compiler/inst_match.m:
compiler/lco.m:
compiler/modecheck_goal.m:
compiler/modules.m:
compiler/polymorphism.m:
compiler/pred_table.m:
compiler/rbmm.region_resurrection_renaming.m:
compiler/simplify.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/stm_expand.m:
compiler/switch_util.m:
compiler/term_pass2.m:
compiler/tupling.m:
compiler/type_constraints.m:
compiler/type_ctor_info.m:
compiler/unneeded_code.m:
deep_profiler/autopar_search_callgraph.m:
deep_profiler/html_format.m:
As above.
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.
Estimated hours taken: 2
deep_profiler/autopar_calc_overlap.m:
New module for calculating the overlap between the conjuncts of a
parallelised conjunction. Its contents are taken from the old
autopar_search_callgraph.m.
deep_profiler/autopar_costs.m:
New module for calculating the costs of goals. Its contents
are taken from the old autopar_search_callgraph.m.
deep_profiler/autopar_reports.m:
New module for creating reports. Its contents are taken from
the old autopar_search_callgraph.m.
deep_profiler/autopar_search_goals.m:
New module for searching goals for parallelizable conjunctions.
Its contents are taken from the old autopar_search_callgraph.m.
deep_profiler/autopar_search_callgraph.m:
Remove the code moved to other modules.
deep_profiler/mdprof_fb.automatic_parallelism.m:
Add the new modules.
deep_profiler/*.m:
Remove unnecessary imports.
Fix copyright years on the new modules.
browser/*.m:
compiler/*.m:
mdbcomp/*.m:
Remove unnecessary imports.
library/Mercury.options:
Make it possible to compile a whole workspace with
--warn-unused-imports by turning that option off for type_desc.m
(which has a necessary import that --warn-unused-imports thinks
is unused).
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.
This patch separates the coverage annotated procedure report into two
reports, one with dynamic coverage data and one with static coverage data.
This restores the functionality of the static coverage report since my last
change, and provides access to the dynamic report via new controls only
visible to developers.
deep_profiler/query.m:
In the cmd data-type:
Rename deep_cmd_procrep_coverage constructor to
deep_cmd_static_procrep_coverage.
Add deep_cmd_procrep_dynamic_coverage.
In the preferences data-type:
Add a new field pref_developer_mode which indicates if developer-only
options are visible or not.
Add code to parse and print the new command and preference option.
deep_profiler/create_report.m:
Specialise create_procrep_coverage_report/3 into
create_{static,dynamic}_coverage_report/4.
Created a new exported function deep_get_maybe_procrep. This is useful for
getting a procedure representation from the deep data-structure in one
step.
deep_profiler/display.m:
Add a new display item, display_developer. This wraps another display
item but is only displayed when developer mode is active.
deep_profiler/display_report.m:
Add a control to the main screen that enables or disabled developer mode.
This control has been placed at the bottom of the screen so that it's out
of the way.
Put the developer controls on the main screen into their own list (there's
only one at the moment).
For now the coverage-annotated procedure representation link on a (static)
procedure's page is not a developer option. Should this be a developer
option?
Added a link to the dynamic coverage annotated procedure representation
report from the dump proc dynamic report.
Added a link to the clique dump report from the clique report, the dynamic
coverage annotated procedure representation report can be accessed
transitively through this link.
Added a link the variable use analysis report and proc static report to the
procedure report and static coverage annotated procedure representation
report.
deep_profiler/html_format.m:
Support the new display_developer item.
Refactor the item_to_html code for lists.
deep_profiler/profile.m:
Include a new field in the deep data-structure for storing coverage data
that is indexed by a proc_static_ptr. When dynamic coverage information is
used this field is populated by adding per ProcDynamic data for each static
procedure.
deep_profiler/startup.m:
Fill in the per ProcStatic coverage data when the deep profiler starts up.
deep_profiler/measurements.m:
Create a new data type static_coverage_info which represents per ProcStatic
coverage information.
Include functions that are used when calculating per ProcStatic coverage
information from per ProcDynamic coverage information.
deep_profiler/mdprof_cgi.m:
Remove rarely used command line option rather making it conform to changes
in query.m.
deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
Conform to changes in query.m.
deep_profiler/mdprof_test.m:
deep_profiler/mdprof_fb.automatic_parallelism.m:
deep_profiler/recursion_patterns.m:
deep_profiler/var_use_analysis.m:
Conform to changes in create_report.
deep_profiler/array_util.m:
Add a new predicate, array_foldl3_from_1 to support propagation of coverage
information from proc dynamics to proc statics.
Estimated hours taken: 12
Branches: main
Add a query to the deep profiler for reporting on the getter and setter
predicates in a module. This can be used to decide whether a data structure
should be split in two, and if so, which fields should go into the
substructure.
At the same time, improve the displays we generate for some other queries
by making more table column headers capable of sorting the table.
deep_profiler/query.m:
Add the new query type.
deep_profiler/report.m:
Add the definition of the new report.
Include the identity of the callee, if known, in call site
descriptions, to allow sorting on this.
deep_profiler/create_report.m:
Add code to execute the new kind of query.
Include the new field in call site descriptions.
Remove "dump" from the name of the predicate that builds
procrep_coverage reports, since the result isn't a raw dump.
deep_profiler/display_report.m:
Add code to display the new kind of report.
Add a link to the new report to display we generate for the module
query.
Allow the table in the procedure report to be sorted by context
or by callee.
deep_profiler/display.m:
Add a new table column class for displaying field names.
deep_profiler/html_format.m:
Handle the new table column class.
deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
"Handle" the new query.
Estimated hours taken: 1
Branches: main
deep_profiler/html_format.m:
deep_profiler/old_html_format.m:
deep_profiler/query.m:
deep_profiler/old_query.m:
Move old, now deprecated code from query.m and html_format.m to two new
modules: old_query.m and old_html_format.m. In each case, the leftover
module, whose cord works via reports, is significantly smaller.
deep_profiler/measurement_units.m:
Move some functions here from html_format.m, since they are needed
with both the old and the new approaches, and the functions belong
here.
Estimated hours taken: 20
Branches: main
Move the remaining deep profiler commands, dump_clique, clique and root,
to the report mechanism.
deep_profiler/report.m:
Define the representation of the new reports.
Change some names to be more consistent.
deep_profiler/create_report.m:
Add code to create the new reports.
deep_profiler/measurement units.m:
Add a predicate to needed by the root command.
deep_profiler/display_report.m:
Add code for converting the new reports to displays.
Factor out some previously duplicated code for describing procedures
and call sites and for comparing them by name and by context.
Conform to the changes in display.m.
deep_profiler/display.m:
Expand the display representation to allow the specification of
attributed text, with the available attributes being bold, italic
and underlined. We now use bold in clique reports.
deep_profiler/html_format.m:
Handle the changes in display.m.
Generate HTML with more structured line breaks.
deep_profiler/query.m:
Switch the default handling of the three commands over to the new
mechanism.
Remove a long unused function.
deep_profiler/profile.m:
Parameterize the call_site_and_callee type, to allow report.m
to associate a procedure description, not a proc_static_ptr,
with a normal call site.
Estimated Hours Taken: 10
Branches: main
Modify the deep profiling tools, in particular mdprof_cgi, to make use of
program representation files, and begin implementing the procrep coverage
report.
The mdprof coverage report is incomplete, however it is convenient to post
this for review now. Currently it can display a pretty-printed procrep
structure without coverage annotations.
mdbcomp/program_representation.m:
Modified program representation data structures to allow goals to be
annotated with another type.
deep_profiler/query.m:
Create new deep profiling command, to display a coverage-annotated
procedure representation.
Support use of program representation information by new-style report
generating code.
Centralised command parsing to code within this module.
Created constants for strings shared between cmd_to_string and
string_to_maybe_cmd.
deep_profiler/report.m:
Add new report, report_procrep_coverage_dump.
Modified the proc_static dump report to include the number of coverage
points in the proc_static.
deep_profiler/create_report.m:
create_report now accepts an optional program representation structure,
making it possible for report generation code to use the program
representation structure.
Support the new procrep coverage report, which is incomplete.
Modify the proc static dump report, to display the number of coverage
points within a proc_static structure.
deep_profiler/display.m:
Introduce display_verbatim, a new display element that is able to display
verbatim text, such as source code.
deep_profiler/display_report.m:
Add support for displaying the new mdbcomp_coverage report.
Modify the proc static dump display to show the number of coverage points,
conforming to a change in report.m
deep_profiler/html_format.m:
Support the display_verbatim element.
Use query_to_string from query.m to create the query part of a URL.
Conform to changes in deep_profiler/query.m
deep_profiler/startup.m:
Modify read_and_startup to also read the program representation data if
available.
deep_profiler/mdprof_cgi.m:
Use string_to_maybe_query from query.m to parse a query string.
Renamed some variables.
Modified command-loop to pass program representation between commands.
deep_profiler/program_representation_utils.m:
A new module to hold utilities from working with program representation
data.
Pretty printing code from mdprof_procrep has been moved here and modified
to output a cord of strings rather than write to standard output.
deep_profiler/mdprof_feedback.m:
deep_profiler/mdprof_test.m:
Conform to changes in query.m
deep_profiler/mdprof_procrep.m:
Move proc_rep pretty-printing code to program_representation_utils.m
browser/declarative_tree.m:
Conform to changes in mdbcomp/program_representation.m
Estimated hours taken: 16
Branches: main
Move three deep profiler commands to the new framework: the one that reports
all of a procedure's callers, the one that lists all the modules, and the one
that lists all the procedures in a module.
deep_profiler/report.m:
Add report structures for the three newly handled commands.
Modify the perf_row_data type to allow the representation of rows
in which the self measures are meaningful, but the self_and_desc
measures aren't, since this is true for module summaries.
Remove a redundant field from an existing report structure.
deep_profiler/query.m:
Change the cmd type slightly to (a) make command names more distinct,
(b) make it less error prone by replacing ints with purpose-specific
wrapper types, and (c) to specify whether contour exclusion should be
applied in the proc_callers command. Change (c) is needed because
we contour exclusion alters the report we want to generate for the
proc_callers command, but we don't want to pass the preferences to the
code that computes reports.
deep_profiler/create_report.m:
Add code for computing the new report structures.
Conform to the change to perf_row_data.
deep_profiler/display_report.m:
Add code for displaying the new report structures.
Conform to the change to perf_row_data.
deep_profiler/display.m:
Avoid the need for a number-of-columns field in most table cells
by having separate function symbols for single- and multi-column cells.
Add a mechanism that allows us to avoid artifically nested lists
(horizontal list inside a vertical list).
Add the column classes needed by the newly implemented commands.
deep_profiler/html_format.m:
Conform to the changes in display.m and query.m.
deep_profiler/profile.m:
We used to read in the contour exclusion file just before computing
and displaying a HTML page whose contents required it. We cannot do
this with the report framework (since the predicate that computes
report structures does not take I/O states as arguments), and it is
better to read the contour exclusion file just once anyway. This diff
therefore adds a field to the deep structure for holding the result
of reading in the contour exclusion file (if any).
deep_profiler/startup.m:
Add code to fill in this new field.
Switch to using state variables.
deep_profiler/apply_exclusion.m:
New module. It contains some code that used to be in query.m, but
is now also needed by create_report.m, slightly modified. The
modifications are to add some code that used to be in the callers
of the moved predicates. This code used to be needed only once,
but is now needed twice (since each predicate now has two callers).
The reason why I didn't put all this into the existing exclude.m
is that that would have required profile.m and exclude.m to import
each other.
deep_profiler/exclude.m:
Change the return value to separate the case of a non-existent contour
exclusion file from a file that exists but whose reading yields an
error.
Give variables better names.
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
Conform to the changes in query.m.
deep_profiler/apply_exclusion.m:
New module. It contains some code that used to be in query.m, but
is now also needed by create_report.m, slightly modified. The
modifications are to add some code that used to be in the callers
of the moved predicates. This code used to be needed only once,
but is now needed twice (since each predicate now has two callers).
The reason why I didn't put all this into the existing exclude.m
is that that would have required profile.m and exclude.m to import
each other.
deep_profiler/exclude.m:
Give variables better names.
deep_profiler/measurements.m:
Turn a semidet predicate into a function.
Estimated hours taken: 16
Branches: main
Implement the proc command of the deep profiler using the report mechanism.
Some of the detailed changes also address Paul's post-commit review of my
previous diff.
deep_profiler/report.m:
Define the representation of the proc report.
Change some names to be more consistent.
deep_profiler/profile.m:
Add a type for use in report.m.
Document the fields of an existing type.
deep_profiler/create_report.m:
Add code to create proc reports.
Change some names to be more consistent.
Fix a bug: avoid divide by zero exceptions in some rare cases.
deep_profiler/measurement units.m:
Fix a bug: avoid divide by zero exceptions in some rare cases.
deep_profiler/display_report.m:
Add the code for converting proc reports to displays. This required
rewriting almost everthing in this module to remove the assumption,
which was previously embedded in many places, that the code is part
of the implementation of the top_procs command. The new code is
separated into two parts; the command-specific parts, and the parts
that should be usable for all commands. (The reusable part is much
bigger.)
deep_profiler/display.m:
Expand the display representation to allow the specification of
- plain text as distinguished from headings
- paragraph breaks
- pseudo-links, i.e. text fragments that are formatted like links
- table separator rows
- table cells that span more than one column
which are used in the new version of display_report.m.
Simplify the mechanism for setting up table header groups.
deep_profiler/html_format.m:
Handle the changes in display.m.
Fix some anomalies in the formatting of lists and tables.
Group related code together.
deep_profiler/query.m:
Provide a switch for selecting which of the two mechanisms,
the old direct generation of HTML or the new indirect generation
through the report and display structures, should generate the HTML
page for a command that both mechanisms can implement. The default
is the new mechanism, but it can be overridden by implementors
by creating a file called "/tmp/old_deep_profiler".
Switch the default handling of the proc command over to the new
mechanism.
Rename some types and function symbols to make them more consistent
and expressive.
Generate more informative error messages for domain error exceptions.
deep_profiler/mdprof_cgi.m:
Add a mechanism for decoding the links in the generated pages.
The mechanism takes the form of three new options: --decode,
--decode-cmd, and --decode-prefs. When one or more of these are given,
mdprof_cgi will not do its usual stuff, instead of just loops waiting
for lines whose contents it will then try to decode as queries,
as commands and/or as preferences.
deep_profiler/Mercury.options:
Try to postpone thrashing in the deep compiler when compiled in
debug grades, by compiling their contents with shallow tracing.
deep_profiler/array_util.m:
Make shallow tracing effective by moving the deep recursions
into non-exported predicates.
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
deep_profiler/startup.m:
Convert the debugging code to use trace goals.
deep_profiler/cliques.m:
deep_profiler/read_profile.m:
Convert the debugging code to use trace goals.
Use more expressive names for lots of variables.
In read_profile.m, avoid an unnecessary repackaging of data.
deep_profiler/util.m:
Fix some grammar errors in a comment, and comment some code to use
state variables.
deep_profiler/interface.m:
Fix some grammar errors in a comment.
deep_profiler/mdprof_feedback.m:
Change some variable names to be consistent with the other modules.
library/float.m:
library/int.m:
Make the messages in the domain errors we throw more expressive.
library/io.m:
Minor style changes.
Estimated hours taken: 5
Branches: main
Implement the colouring of column groups.
deep_profiler/display.m:
Modify the types representing tables to allow some column groups
to specify that the column classes they represent should affect the
style in which that column is rendered. Refactor the table_header_group
type to avoid representing this information, and the column class,
in a redundant manner.
Avoid abbrevations in some type names and function symbols.
deep_profiler/display_report.m:
Conform to the change in the representation of tables.
Use more consistent variable names.
deep_profiler/html_format.m:
When a table column group's header asks for it, set up the background
colour of the columns in that group so that alternating column groups
have different backgrounds.
Instead of representing the CSS as a single constant string, we
now represent it as a map that we update from a default when we
construct the body of the page.
Implement Paul's review suggestions after my last change.
library/cord.m:
NEWS:
Add a utility predicate for use by the new code.
Estimated hours taken: 0.1
Branches: main
deep_profiler/display.m:
Add an identifying prefix to the function symbols of the table_data
type to prevent confusion with the similar function symbols of the
standard string.poly_type type.
deep_profiler/display_report.m:
deep_profiler/html_format.m:
Conform to this change.
Estimated hours taken: 0.1
Branches: main
deep_profiler/display_report.m:
Remove a now redundant copy of the title for top_procs pages.
deep_profiler/html_format.m:
Add more newlines to the output, in order to make it more readable.
Estimated hours taken: 3
Branches: main
Use reports to handle the call_site_static and call_site_dynamic queries.
deep_profiler/report.m:
Add the two new report types.
Give a better name to a type.
deep_profiler/create_report.m:
Add the code for the two new report types.
Make the predicate for creating a perf_row_data more general,
and avoid defining the perf_row_data field-by-field.
deep_profiler/display.m:
Rename a table_class that is now used not just by the top_procs
command.
Represent columns as cords, to avoid the need for keeping track
of whether the list of columns is reversed.
deep_profiler/display_report.m:
Add the code to handle the two new report types.
Refactor some existing code to allow it to called by the new code.
Conform to the other changes in report.m.
deep_profiler/html_format.m:
Add newlines to the output, in order to make it more readable
and to make using diff between two versions of the output feasible.
Print the HTML title as a heading.
Add a XXX about a disrespected control.
deep_profiler/query.m:
Use the new method to handle the two query types.
Estimated hours taken: 4
Branches: main
Use reports to handle the proc_static and proc_dynamic queries.
deep_profiler/report.m:
Add the two new report types.
Change the report type to give each query its own answer, without
needing to use the report_message for reporting errors. Also, group
each kind of report into a single data structure that can be
manipulated independently of the other kinds of answers (like I did
some time ago for items in the compiler.)
deep_profiler/create_report.m:
Add the code for the two new report types.
Conform to the other changes in report.m.
Inline some unnecessary intermediate predicates.
deep_profiler/display.m:
deep_profiler/html_format.m:
Rename one table_class that is now used not just by the menu command.
deep_profiler/display_report.m:
Add the code to handle the two new report types.
Refactor some existing code to allow it to called by the new code.
Conform to the other changes in report.m.
Fix several predicate names that would have become misleading as soon
as we added new kinds of reports. The fix is to give them the prefix
"top_procs_", since they all generate parts of top_procs pages.
deep_profiler/query.m:
Use the new method to handle the two query types.
Estimated hours taken: 6
Branches: main
Convert Paul's new code to use cords of strings to represent HTML.
deep_profiler/html_format.m:
Convert to using cords. Restructure the code in a couple of places
to always put start and end tags around HTML fragments together.
Fix a missing "=" in a tag.
deep_profiler/interface.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/read_profile.m:
Provide better diagnostics.
deep_profiler/create_report.m:
deep_profiler/display.m:
deep_profiler/display_report.m:
deep_profiler/mdprof_feedback.m:
deep_profiler/measurement_units.m:
deep_profiler/query.m:
deep_profiler/report.m:
mdbcomp/feedback.m:
Misc cleanups. They can be considered my post-commit review of Paul's
diff.
In mdprof_feedback.m, delete a strange test that prevented the program
from being used from the command line.
deep_profiler/dump.m:
deep_profiler/mdprof_dump.m:
deep_profiler/timeout.m:
deep_profiler/util.m:
Misc cleanups of old code.
Estimated Hours Taken: 60
Branches: main
Introduced intermediate data structures to mdprof_cgi. This will make it
easier to extract deep profiling information for any new tools. It also
enables other viewers for deep profiling data to more easily be developed.
New code making use of these data structures follows a pipeline pattern
as it is converted between the following data structures in this order:
Deep -> Report -> Display -> HTML
This work is in progress and only a handful of deep profiler commands have
been converted to use the new data structures. The old code has been kept for
reference and should be removed in the future.
deep_profiler/report.m:
Created new module that defines a data structure for a deep profiler report.
The new report data structure can be used to describe the content of a
particular report.
deep_profiler/display.m:
Created new module that defines a data structure for displaying deep
profiler information.
The new display data structure can be used to describe the structure and
content shown when a user views a deep profiler report.
deep_profiler/measurement_units.m:
Created new module defining data types to represent percentages, amounts
of computer memory and time.
deep_profiler/query.m:
Move memory_units type to data_types.m.
Handling of the following deep profiler commands has been re-written to
use the new data structures:
deep_cmd_quit,
deep_cmd_timeout,
deep_cmd_restart,
deep_cmd_menu,
deep_cmd_top_procs
deep_profiler/create_report.m:
Created new module for creating reports from the deep data structure.
deep_profiler/display_report.m:
Created new module for converting a report structure to a display
structure.
deep_profiler/html_format.m:
Introduce new code to convert a display data structure into a string of
HTML formatted text.
Moved number formatting code to measurement_units.m.
Estimated Hours Taken: 1
Branches: main
Tidying up some of the deep profiler tools code. Moved data structures,
predicates and functions that are not specific to the mdprof_cgi program
from interface.m to other modules.
deep_profilier/query.m:
Moved data structures from interface.m to query.m including the cmd and
preferences data structures.
Renamed functions to replace url_compoent with string.
deep_profilier/interface.m:
Moved code from this module that doesn't relate to the mdprof_cgi
program's client-server nature to query.m and html_format.m
Conformed to predicate-renaming changes in query.m
deep_profilier/html_format.m:
Moved machine_datafile_cmd_pref_to_url function to this module.
Conform to changes in interface.m and query.m.
deep_profiler/top_procs.m:
Conform to changes in interface.m and query.m.
Estimated hours taken: 0.1
Branches: main
deep_profiler/html_format.m:
Make the output a bit easier to read by adding commas at every
power of a thousand in call sequence number counts.
Branches: main
Some interface improvements for mdprof_cgi.
deep_profiler/html_format.m:
deep_profiler/query.m:
Insert "<WBR>" tags after some characters to suggest where the browser
may break long module, procedure and file names over multiple lines.
This improves the chances that tables will not become too wide to fit
in the browser window.
Add square brackets around the links at the bottom of generated pages,
e.g. "[Sort by name]". Give such links the CSS class "button" and add
margins to increase visual separation between the links.
Write the "Toggle fields:" etc. labels in bold to make them stand out,
and add line breaks so that the first button after the label is easier
to find (on the next line, at the the left margin).
Spell out "self+descendants." rather than "self+desc."
Branches: main
deep_profiler/conf.m:
deep_profiler/html_format.m:
deep_profiler/interface.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_feedback.m:
deep_profiler/mdprof_test.m:
deep_profiler/profile.m:
deep_profiler/startup.m:
Respect the CGI environment variables SERVER_NAME, SERVER_PORT and
SCRIPT_NAME. This allows the mdprof_cgi to be used with any web
server, on an arbitrary port, at any URL.
Estimated hours taken: 3
Branches: main
Clean up in unused module imports in the Mercury system detected
by --warn-unused-imports.
analysis/*.m:
browser/*.m:
deep_profiler/*.m:
compiler/*.m:
library/*.m:
mdbcomp/*.m:
profiler/*.m:
slice/*.m:
Remove unused module imports.
Fix some minor departures from our coding standards.
analysis/Mercury.options:
browser/Mercury.options:
deep_profiler/Mercury.options:
compiler/Mercury.options:
library/Mercury.options:
mdbcomp/Mercury.options:
profiler/Mercury.options:
slice/Mercury.options:
Set --no-warn-unused-imports for those modules that are used as
packages or otherwise break --warn-unused-imports, e.g. because they
contain predicates with both foreign and Mercury clauses and some of
the imports only depend on the latter.
Estimated hours taken: 16
Branches: main
Include call sequence numbers in the pages generated by the deep profiler
(if the user's preferences ask for this).
NEWS:
Announce the new capability.
deep_profiler/measurements.m:
Standardize on one spelling of call sequence numbers (callseqs).
Add some utility predicates for use in dump.m.
Fix a bug in the calculation of the number of calls: redos enter
procedure invocations, not leave them.
deep_profiler/profile.m:
Fix a bug: the num_callseqs field was in the wrong place.
deep_profiler/html_format.m:
When generating a line of the clique description, include call sequence
number information if requested.
Do likewise when generating other HTML fragments that have to match
the contents of those lines (e.g. the table headers).
Generate the links that allow the users to sort rows by call
sequence numbers.
Generate the links that allow the users to toggle the switches
controlling the display of call sequence number information.
Do not show the toggles relevant to the display of times if times are
not being displayed.
deep_profiler/interface.m:
Extend the preferences to allow requests for call sequence number
information.
Include the display of call sequence numbers in the default set of
preferences. However, include the display of time information in the
default only of the profiling run lasted long enough for this
information to have some hope of being useful.
Rename some function symbols to avoid ambiguities.
deep_profiler/query.m:
Extend the menu to include links for the most expensive
cliques/procedures as measured by call sequence numbers.
Include the links for the most expensive cliques/procedures as
measured by clock ticks in the menu only if the profiling run
lasted long enough for this to be useful.
Print out the total number of call sequence numbers with the other
statistics.
Use call sequence numbers instead of time to decide where the "action"
begins, since this works even for short profiling runs.
deep_profiler/top_procs.m:
Provide the capability of sorting on call sequence numbers.
deep_profiler/dump.m:
Provide the capability to dump out several more fields of the top level
structure (profile.deep), including the cliques, the reverse links and
the propagated measurement information.
deep_profiler/startup.m:
Dump out the cliques, the reverse links and the propagated measurement
information when computed.
deep_profiler/mdprof_cgi.m:
Add an option for setting the hostname in the generated links to
"localhost". This is useful on laptops temporarily disconnected
from the Domain Name System (e.g. my laptop).
Set this option automatically if the name of the file in the initial
query has a ".localhost" suffix added to it.
Add some tracing hooks.
deep_profiler/mdprof_test.m:
Add an option to specify what info to dump during startup.
deep_profiler/mdprof_dump.m:
Switch to using the compiler's method of specifying what to dump,
since this is more maintainable.
deep_profiler/exclude.m:
Rename some function symbols to avoid ambiguities.
deep_profiler/timeout.m:
Add conditionally compiled code to help debug lock management.
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
deep_profiler/cliques.m:
deep_profiler/conf.m:
deep_profiler/read_profile.m:
Minor cleanups.
Estimated hours taken: 0.1
Branches: main
deep_profiler/html_format.m:
Make use of 80 column width, and replace a couple of uses of DCGs with
state variables.
Estimated hours taken: 18
Branches: main
Move the univ, maybe, pair and unit types from std_util into their own
modules. std_util still contains the general purpose higher-order programming
constructs.
library/std_util.m:
Move univ, maybe, pair and unit (plus any other related types
and procedures) into their own modules.
library/maybe.m:
New module. This contains the maybe and maybe_error types and
the associated procedures.
library/pair.m:
New module. This contains the pair type and associated procedures.
library/unit.m:
New module. This contains the types unit/0 and unit/1.
library/univ.m:
New module. This contains the univ type and associated procedures.
library/library.m:
Add the new modules.
library/private_builtin.m:
Update the declaration of the type_ctor_info struct for univ.
runtime/mercury.h:
Update the declaration for the type_ctor_info struct for univ.
runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
Update the definition of MR_Univ.
runtime/mercury_init.h:
Fix a comment: ML_type_name is now exported from type_desc.m.
compiler/mlds_to_il.m:
Update the the name of the module that defines univs (which are
handled specially by the il code generator.)
library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
Conform to the above changes. Import the new modules where they
are needed; don't import std_util where it isn't needed.
Fix formatting in lots of modules. Delete duplicate module
imports.
tests/*:
Update the test suite to confrom to the above changes.
Estimated hours taken: 0.5
Branches: main
profiler/*.m:
deep_profiler/*.m:
compiler/*.m:
Replace __ with . as the module qualifier everywhere in all the modules
of the profiler and deep profiler and in some modules of the compiler.
Estimated hours taken: 1.5
Branches: main
Convert the rest of the deep profiler to four-space indentation.
There are no changes to any algorithms (other than introducing state
variables in a few spots).
Remove an old bug workaround.
deep_profiler/*.m:
Convert to four-space indentation where that has not already
been done.
Fix some bad line breaks.
Use state variables in a few places.
Reposition comments according to our current coding standard.
deep_profiler/Mercury.options:
Remove some old bug workarounds.
Estimated hours taken: 2
Branches: main, release
Improvements to the deep profiling tool.
Provide the facility to hide modules/procedures to which there have been no
calls. This reduces the amount of clutter when exploring the program module
by module and when listing the procedures in a module (the clutter is
primarily a result of unused standard library modules). By default, we
currently do not hide any modules/procedures.
Add a toggle to sort lists of procedures by the number of redos they perform.
We have had control at the head of tables to do this for a while now.
Delete the function int_list_from_to/2 since that functionality is now
available in the standard library.
deep_profiler/html_format.m:
Provide toggles that allow the user to show/hide inactive modules and
procedures.
Add a toggle to sort lists of procedures by the number of redos.
Rename a numbered sequence of variables so that it is easier to insert
new ones in the middle of the sequence.
deep_profiler/interface.m:
Add support for hiding/showing inactive modules.
Clean up some of the existing code.
deep_profiler/measurements.m:
Add a predicate, is_inactive/1, that test if an own_prof_info
for a given entity is inactive.
deep_profiler/query.m:
When generating the module and procedure summaries, respect the new
preference settings for hiding/showing inactive modules/procedures.
deep_profiler/top_procs.m:
Delete int_list_from_to/2 and replace calls to it with
'..' from the standard library.
Estimated hours taken: 0.5
Branches: main, release
deep_profiler/html_format.m:
deep_profiler/interface.m:
deep_profiler/top_procs.m:
Add a control that allows procedures to be ordered by the
number of redos they execute.
Estimated hours taken: 3.5
Branches: main, release
Fix some problems in the deep profiling tool.
deep_profiler/html_format.m:
The control to view times was mislabeled as 'Ticks and times'.
Update the number of columns used for displaying the port counts.
Since (some) support for exceptions was added there are now five.
This fixes a problem where the width of separator rows was incorrect.
Avoid the division by zero that occurs when calculating the time-per-call
and there have been zero calls.
deep_profiler/interface.m:
Change the query separator character from '%' to '&'. The former
is used for encoding special characters in URLs and our usage of it
causes problems for some web browsers. In particular, this is
necessary to get the deep profiling tool to work with Safari, which
in turn is necessary for getting the deep profiler to work
"out-of-the-box" on OS X.
Estimated hours taken: 1
Branches: main
Cleanup the deep profiler.
There are no changes to any algorithms.
deep_profiler/*.m:
Switch to state variable notation throughout. Rearrange
the order of some procedure arguments to facilitate this.
Remove some unnecessary module imports.
Reformat comments according to our current coding standard.
Update comments that refer to modules that no longer exist.
Estimated hours taken: 3
Branches: main, release
Workaround a problem where the deep profiling tool wasn't
escaping HTML special characters in procedure and file names.
deep_profiler/html_format.m:
deep_profiler/query.m:
When generating HTML make sure to escape special
characters, like '<', correctly.
Estimated hours taken: 1
Branches: main, release
deep_profiler/*.m:
Minor cleanups.
deep_profiler/notes/deep_profiling.html:
Bring the documentation of the deep profiler up to date.
Estimated hours taken: 1
Branches: main
profiler/*.m:
deep_profiler/*.m:
Import only one module per line. Misc other updates to bring these
modules closer to being up to date with our current style guidelines.
Estimated hours taken: 120
Branches: main
The following change is only 98% complete, not 100%. I am committing it in
this state because (1) we pass many more test cases in deep profiling grade
with it than without it, and (2) the double maintanance involved in fixing
CVS conflicts is preventing me from doing the last 2%.
Get the deep profiler to work for code that sets up to catch exceptions,
which for the last year or more has included the compiler, and to get it
almost working for code that actually catching exceptions.
The basic problem is that code that throws exceptions will in general cause
several calls to "return" without executing the exit or fail port codes that
the deep profiling transformation inserted into their bodies, and this leaves
the data structure being built by the deep profiling inconsistent. The solution
uses the same approach as we have adopted for the debugger: have the code that
handles the throwing of exceptions simulate a return from each call between
the throw and the catch, updating the deep profiling data structures as needed.
This requires us to be able to walk the stack at runtime not just in debugging
grades but also in deep profiling grades. Since the debugger already has the
mechanisms required for this, we reuse them. The procedure layouts used by the
debugger were designed to have three segments: the procedure stack walk
information, the procedure id, and the execution tracing information. We now
modify this design to make the third segment contain two pointers: to the
execution tracing information (for use by the debugger), and to the procedure's
proc_static structure (for use by deep profiling). Each pointer will be null
unless the pointed-to structure is required by compile-time options.
This common use by the debugger and by deep profiling of the stack-walk
structure and the procedure id structure (which deep profiling used to
generate independently and possibly redundantly) required some rearrangement
of the compiler's version of these data structures.
To make this rearrangement simpler, this diff removes a capability that
we theoretically supported but never used: turning on stack traces without
turning on execution tracing and vice versa. After this diff, stack tracing
is enabled if and only if either execution tracing or deep profiling is
enabled.
The diff also includes improvements in the debugging infrastructure for
debugging deep profiling, which were necessary for the implementation of the
rest of the changes.
compiler/deep_profiling.m:
The code in exception.m needs to know the locations of the variables
that we would pass to the exit or fail port code, so it can simulate
leaving the procedure invocation through the exception port. Without
this information, throwing an exception leaves the deep profiling
data structures of the procedure invocations between throw and catch
in an inconsistent state.
Deep_profiling.m creates these variables, but it doesn't know where
they will be at runtime, so it records their identities; the code
generator will allocate them stack slots and record the numbers of
these stack slots for placement in the now expanded proc layout
structures. Deep profiling used to generate static data structures
separately from the HLDS, but since the code generator now needs
access to them, we store their information in proc_infos in the HLDS.
Instead of passing the addresses of proc_static structures to the deep
profiling port procedures, pass the address of proc_layout structures,
since the information about the identities of procedures are now stored
not in the proc_static structure, but in the proc_layout structure
that points to the proc_static structure.
compiler/hlds_pred.m:
compiler/layout.m:
Move the definitions of the static data structures generated by deep
profiling from layout.m to hlds_pred.m, to allow deep_profiling.m
to store them in proc_infos.
compiler/hlds_pred.m:
compiler/rtti.m:
Move the definition of rtti_proc_label from rtti.m to hlds_pred.m,
since some of the new data structures in hlds_pred.m need it. Despite
its name, the rtti_proc_label type doesn't contain any info that
doesn't belong in the HLDS.
Add some information to the rtti_proc_label type that is now needed
by deep profiling, e.g. record determinisms instead of just code
models. Record explicitly the outcome of some tests that used to be
duplicated in more than one place in the compiler, e.g. for whether
the procedure (as opposed to the predicate) is imported. Change some
of the field names to be more precise about the field's meaning.
compiler/code_gen.m:
Transmit the contents of the deep profiling data structures stored in
the proc_info by deep_profiling.m to continuation_info.m, together
with the layout structures created for execution tracing and the
identities of the variables needed for handling exceptions,
when code generation for a procedure is complete.
After the goal that generates these variables, save them to stack
for use by the exception handler.
compiler/hlds_goal.m:
Add a feature to mark the goal that generates the deep profiling
variables needed by the exception handler.
compiler/hlds_llds.m:
Add a utility predicate for new code in code_gen.m
compiler/continuation_info.m:
Hold the deep profiling information computed by code_gen.m for use by
stack_layout.m.
compiler/layout.m:
compiler/layout_out.m:
Update the definitions of the data structures describing procedure
layouts, and the code writing them out, to reflect the use of some
parts of procedure layouts by deep profiling as well as debugging.
Change the layout structures generated by deep profiling to use
rtti_proc_labels, which are backend independent, instead of
proc_labels, which are specific to the LLDS backend.
Conform to the changes in runtime/mercury_stack_layout.h.
compiler/stack_layout.m:
Generate the updated version of proc_layout structures.
compiler/mercury_compile.m:
compiler/global_data.m:
Conform to the fact that deep profiling no longer generates layout
structures separate from proc_infos.
compiler/llds_out.m:
Register proc_layout structures instead of proc_static structures
for use by runtime/mercury_deep_profiling.c.
compiler/options.m:
compiler/handle_options.m:
Rename the require_tracing option as exec_trace, since this more
directly reflects its meaning.
Instead of having --debug set both require_tracing and stack_trace,
make it set (be the user-visible name of) just exec_trace;
the value of stack_trace is implied.
Turn off the specialization of deep profiling for self-tail-recursive
procedures for now. Due to the changes made by this diff in the data
structures involved in debugging, it cannot be debugged until this
change has been installed. Handling the full language is more important
than a specialization that reduces only stack space overheads, not
runtime overheads.
compiler/compile_target_code.m:
Conform to the changes in options.m and runtime/mercury_grade.h.
compiler/hlds_data.m:
Replace the deep_profiling_proc_static cons_id, and its associated tag,
to deep_profiling_proc_layout, since we now generate addresses of proc
layout structures, not of proc_static structures.
compiler/code_util.m:
Simplify some code based on the new info in rtti_proc_labels.
compiler/bytecode_gen.m:
compiler/dependency_graph.m:
compiler/higher_order.m:
compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
compiler/ml_code_util.m:
compiler/ml_unify_gen.m:
compiler/opt_debug.m:
compiler/proc_label.m:
compiler/prog_rep.m:
compiler/rl_exprn.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/saved_vars.m:
compiler/switch_util.m:
compiler/unify_gen.m:
Minor changes to conform to the change from deep_profiling_proc_static
to deep_profiling_proc_layout, to the change in the structure of
rtti_proc_labels, to the changes in types of layout.m, and/or to the
new goal feature.
deep_profiler/measurements.m:
Reserve space for exception counts.
deep_profiler/html_format.m:
Add a column for exception counts.
deep_profiler/profile.m:
deep_profiler/read_profile.m:
Rename the data structures referring to compiler generated unify,
compare and index predicates to avoid misleading names: they are
not the only compiler generated predicates.
deep_profiler/read_profile.m:
runtime/mercury_deep_profiling.c:
Update the string that identifies deep profiling data files.
This is necessary because the format has changed: it now includes
information about exception port counts.
library/exception.m:
In deep profiling grades, execute the exception port code for every
procedure invocation between a throw and a catch, using the procedure
layout structures now generated by the compiler for every procedure.
Rename the function involved to reflect its new, more general purpose.
Update the definitions of the hand-written proc_static and proc_layout
structures for the procedures implemented via hand-written C code.
Indent C preprocessor directives and foreign_procs according to our
coding standards.
library/profiling_builtin.m:
Change the parameters of the call port code procedures from proc_static
to proc_layout. Reach the proc_static structure from the proc_layout
structure when needed. Include the proc_layout structure in any
messages from assertion failures.
Add some conditionally compiled debugging code.
Give some variables better names.
runtime/mercury_type_info.h:
runtime/mercury_builtin_types.c:
Move the macros required to create the proc_static structures
of unify and compare predicates from mercury_type_info.h
to mercury_builtin_types.c, since the latter is the only file
that needs them.
Use the same macros for creating the proc_static structures
of hand-written unify, compare and compare_reprentation predicates
as for user defined predicates. This required changing their naming
scheme.
runtime/mercury_unify_compare_body.h:
Conform to the new naming scheme.
runtime/mercury_ho_call.c:
Provide the mechanism for mercury_unify_compare_body.h to conform
to the new naming scheme.
Remove the definitions of the proc_static structures for
hand-written unify, compare and compare_reprentation predicates,
since these now have to be defined together with the corresponding
proc_layout structures in mercury_builtin_types.c.
runtime/mercury_builtin_types.[ch]:
Update the definitions of the hand-written proc_static and proc_layout
structures for the procedures implemented via hand-written C code,
and add the required declarations first.
Handle deep profiling of compare_representation as well as unify
and compare predicates on builtin types.
Handle deep profiling of compare_representation on user-defined types,
since this is done entirely in the runtime, not by compiler generated
predicates.
runtime/mercury_builtin_types_proc_layouts.h:
New header file containing the declarations of the proc layout
structures of the unify, compare and index predicates of builtin types.
Logically, these declarations belong in mercury_builtin_types.h,
but putting them there causes problems for the linker; the details
are explained in the file itself.
runtime/Mmakefile:
Add the new header file.
runtime/mercury_minimal_model.[ch]:
Update the definitions of the hand-written proc_static and proc_layout
structures for the procedures implemented via hand-written C code,
and add the required declarations first.
runtime/mercury_grade.h:
Replace the MR_REQUIRE_TRACING grade option with MR_EXEC_TRACING.
Besides being better named, the MR_EXEC_TRACING option implies
MR_STACK_TRACE.
Besides the overall binary compatibility version number, add subsidiary
version numbers for binary compatibility in deep profiling and
debugging grades. These will make it easier to bootstrap changes
(such as this) that affect binary compatibility only in such grades.
runtime/mercury_trace_base.c:
trace/mercury_trace.c:
Conform to the new names of the configuration parameters.
runtime/mercury_hand_compare_body.h:
runtime/mercury_hand_unify_body.h:
runtime/mercury_hand_unify_compare_body.h:
runtime/mercury_ho_call.c:
tools/make_port_code:
Pass proc_layout structures instead of proc_static structures
to deep profiling port routines.
runtime/mercury_conf_param.h:
Make MR_DEEP_PROFILING as well as MR_EXEC_TRACING imply MR_STACK_TRACE,
since deep profiling now needs stack tracing. (MR_STACK_TRACE needs
to be set in this file, because tests in this file depend on knowing
its value, and this file is among the first files included (in this
case indirectly) in mercury_imp.h.)
Document the macros controlling the debugging of deep profiling.
Enable printing of label names when the relevant deep profiling
debugging macro is set.
runtime/mercury_debug.c:
runtime/mercury_deep_rec_depth_actions.h:
runtime/mercury_deep_rec_depth_body.h:
runtime/mercury_exception_catch_body.h:
Get to proc_statics via proc_layouts.
runtime/mercury_deep_call_port_body.c:
runtime/mercury_deep_leave_port_body.c:
Get to proc_statics via proc_layouts.
Allow the debugger to disable deep profiling in Mercury code that is
part of the debugger, not of the user program being executed.
Add some more assertions.
runtime/mercury_engine.[ch]:
Add a new debugging flag that controls at runtime whether we generate
a human readable Deep.debug equivalent to the binary Deep.data files.
(We already had a mechanism for controlling this at compile time,
but this isn't flexible enough.)
runtime/mercury_wrapper.c:
Allow this new debugging flag to be set from MERCURY_OPTIONS.
runtime/mercury_deep_profiling.[ch]:
Respect this new debugging flag.
Update the hand-written proc_static structures representing the runtime
system.
Print out addresses of proc_layout as well as proc_static structures
when assertions fail.
Add a field to the measurement structure for exception port counts,
and write out this field with the other port counts.
Remove procedure id information from proc_static structures,
deep profiling now uses the procedure id in the proc_layout structure.
Add to proc_static structures fields that specify where, if anywhere,
the variables needed by exception.m to executed the exception port code
are in the procedure's stack frame.
Define a global flag that allows the debugger to disable deep
profiling in Mercury code that is part of the debugger, not of the
user program being executed.
Increase type safety by providing two versions of the function
for registering proc_layouts, one for the proc_layout structures
of user-defined predicates and one for unify, compare and index
predicates.
Fix a bug that occurs only if MR_DEEP_PROFILING_EXPLICIT_CALL_COUNTS is
defined (which it usually isn't): the initial call count was wrong.
runtime/mercury_deep_profiling_hand.h:
Fix a bug: the handwritten code saving deep profiling variables was
saving them in slots that didn't belong to the relevant stack frame.
Update to conform to the modified definitions of proc_static structures
and the fact that we now reach them via proc_layout structures.
runtime/mercury_exception_catch_body.h:
runtime/mercury_stacks.h:
Fix the other side of the bug in mercury_deep_profiling_hand.h
by reserving the right number of stack slots in the stack frames
of the various modes of exception__catch. Make it harder to make
the same bug in the future by getting the needed info from the
place in mercury_stacks.h that defines the structure of the relevant
stack frame.
runtime/mercury_proc_id.h:
Rename the procedure id structure fields referring to compiler
generated unify, compare and index predicates: they are not the only
compiler-generated predicates.
runtime/mercury_stack_layout.h:
Change procedure layout structures to allow them to be used for deep
profiling as well as for debugging, as described in the prologue above.
We don't need the capability to support label layout structures with
links to misnamed proc layout structures, and supporting it is
inconvenient, so delete the capability.
runtime/mercury_debug.c:
runtime/mercury_deep_profiling_hand.h:
runtime/mercury_layout_util.c:
runtime/mercury_ml_expand_body.h:
runtime/mercury_stack_trace.c:
runtime/mercury_types.h:
trace/mercury_trace_external.c:
Conform to the new names of the procedure id structure fields.
runtime/mercury_std.h:
Add some more arities for MR_PASTE for use in some of the modified
modules in the runtime.
trace/mercury_trace_internal.c:
Disable deep profiling actions in Mercury code that is part of the
debugger, not of the program being debugged.
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Make changes parallel to the ones in runtime/mercury_grade.h: delete
--stack-trace as an independent option, and make --debug set its
own option, not --require-tracing.
scripts/canonical_grade.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/c2init.in:
scripts/mgnuc.in:
scripts/ml.in:
Conform to the changes in grade options for debugging and for deep
profiling.
tools/bootcheck:
If Mmake.stage.{browser,deep,library,runtime,trace}.params exist,
copy them to become the file Mmake.$dir.params in stage2/$dir
(where dir is derived from the name of the original file in the obvious
way). This allows more flexibility in the creation of the stage2;
for example, it allows some directories (e.g. runtime or library)
to be compiled with more debugging than other directories (e.g.
compiler). This may be required because compiling all directories
with lots of debugging may cause the linker to thrash.
Add an option, --disable-debug-libs, that clobbers the libraries
that should be linked in only in debugging grades.
To conserve disk space, remove Deep.data files created by the bootcheck
by default. Add an option, --keep-deep-data, to preserve these files.
Use a consistent mechanism (test -f) for testing the existence of
all files whose existence is tested.
When recording modification times, record the modification times
of some more files.
tests/hard_coded/Mmakefile:
In deep profiling grades, disable the test cases that we don't now
pass in such grades, and document the reasons for their failure.
Fix the misclassification of the write_binary test case.
Estimated hours taken: 2
Branches: main
Apply Zoltan's deep profiler changes to the main branch. Zoltan committed
these changes to the release branch, but forgot to commit them to the main
branch.
Mmakefile:
NEWS:
configure.in:
bindist/Mmakefile:
bindist/bindist.Makefile.in:
doc/user_guide.texi:
library/exception.m:
library/io.m:
runtime/mercury_conf.h.in:
runtime/mercury_conf_param.h:
runtime/mercury_misc.c:
runtime/mercury_misc.h:
scripts/Mmakefile:
deep_profiler/.nocopyright:
deep_profiler/Mercury.options:
deep_profiler/Mmakefile:
deep_profiler/callgraph.m:
deep_profiler/cliques.m:
deep_profiler/conf.m:
deep_profiler/html_format.m:
deep_profiler/interface.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/query.m:
deep_profiler/startup.m:
deep_profiler/timeout.m:
deep_profiler/mdprof_server.m:
deep_profiler/server.m:
Merge in changes from the release branch.
Enclosed below is Zoltan's original log message.
----------
Estimated hours taken: 0.3 (on release branch)
Branches: release
Make the deep profiler work again.
The existing process structure of the deep profiler made it very hard to debug,
mainly because the Mercury debugger is confused by forks and stymied by execs.
This change completely replaces the process structure. The old structure had
two separate programs, mdprof_cgi and mdprof_server, the first always acting
as client and the second always acting as server. The new structure has only
one program, mdprof_cgi, which acts as a server if there is no existing server
for the relevant profiling data file, and as a client otherwise.
Although mdprof_cgi normally forks when it becomes a server to let the parent
exit and let the web server know that the web page it has generated is
complete, the fork can be disabled for debugging via an option. This allows
the communication between client and server to be debugged by running two
instances of mdprof_cgi in different windows, one or both under mdb.
deep_profiler/DESIGN:
New file describing the new process structure, its race conditions,
and their solutions.
deep_profiler/.nocopyright:
Add DESIGN.
deep_profiler/mdprof_cgi.m:
A complete rewrite of this module to enable it act as both client and
server.
deep_profiler/mdprof_test.m:
A new module to hold the testing functionality of mdprof_server.m.
deep_profiler/mdprof_server.m:
deep_profiler/server.m:
Delete these now unnecessary modules.
Mmakefile:
Replace references to mdprof_server with references to mdprof_test.
deep_profiler/Mmakefile:
Replace references to mdprof_server with references to mdprof_test.
Move the include of Mmake.deep.params, to allow it to override
top level parameter settings.
deep_profiler/Mercury.options:
Work around a compiler bug by turning off the offending optimization.
deep_profiler/timeout.m:
A rewrite of major parts of this module to support the new design
of mdprof_cgi.m, and to make unexpected signals easier to debug.
deep_profiler/interface.m:
Implement the mechanisms needed by the new process structure.
Change the characters we use to separate components of the URL.
The old ones were special to the shell, and screwed up command lines.
(As double insurance, we ignore the command line anyway when invoked
by the web server.)
Change some names to be more expressive.
deep_profiler/conf.m:
Add a new function, getpid, for use by interface.m.
Rewrite some code to use streams explicitly, not implicitly.
deep_profiler/callgraph.m:
deep_profiler/cliques.m:
Add (now commented out) code to help debug these modules, for use
in cases where mdb doesn't help, because the program works perfectly
with debugging enabled :-(
deep_profiler/query.m:
Move the predicate try_exec here from the deleted file server.m.
deep_profiler/html_format.m:
Trivial change to conform to name change in interface.m.
deep_profiler/startup.m:
Generate debugging output to a caller specified stream, not to
stdout and stderr.
Disable the generation of statistics temporarily, since the diff
to make statistics reporting routines write to a specified stream
instead of stdout and stderr won't be committed on the release branch.
Currently, they always write to stdout, which in the new design
goes to the web page, not to the startup file.
configure.in:
Detect the presence of opendir, readdir and closedir, and the header
file they need, dirent.h. Enable the deep profiler only if all exist,
since the deep profiler now needs them.
runtime/mercury_conf.h.in:
Support the changes to configure.in.
runtime/mercury_misc.[ch]:
Add a mechanism for registering cleanup functions to be executed when
we terminate the program due to an uncaught exception.
library/exception.m:
Invoke the registered cleanup functions just before terminating
the program due to an uncaught exception.
Estimated hours taken: 80
Branches: main
Major enhancements of the deep profiler. The most important ones are:
- The addition of several new classes of preferences, including: the use of
colour, boxing, sorting, summarizing of higher order call sites, and time
formats.
- Making preferences persistent across different queries, so that once a
preference is set, it "sticks" until the user changes it. Previously,
preferences stuck during query sequences of the same command type.
- Several new command types:
- listing all the modules of the program
- listing all the procedures in a module
- listing all the callers of a procedure,
grouped by calling call site, procedure, module, or clique,
and filtering out certain classes of ancestors
- jumping into the call graph close to the action
- restarting the server (useful when the data file changes)
- New optional columns showing time per call, allocations per call and words
allocated per call.
- Can now display memory consumption in bytes as well as words.
- More robustness in the face of external events, e.g. machine shutdowns.
- Fix a bug reported by Tom in the summaries of procedures that make higher
order calls.
The new functionality required adding some fields to ProcStatic structures;
as a result, compilers and runtime systems that have this change are
incompatible with compilers and runtime systems before this change in deep
profiling grades. (They of course remain compatible in other grades.)
compiler/deep_profiling.m:
compiler/layout.m:
compiler/layout_out.m:
Add two new fields to ProcStatic structures, one giving the line number
of procedure's context and one stating whether the procedure is
exported from its module.
compiler/layout.m:
Be consistent about filename vs file_name in field names.
compiler/*.m:
Minor changes to handle the new fields.
deep_profiler/interface.m:
Define new command types, modify some of the parameters of existing
ones, and delete obsolete ones. Define the types and predicates used
by the new system of preferences, Update the predicates for recognizing
and generating queries accordingly.
Make the order of declarations and definitions more consistent.
deep_profiler/split.m:
Complete rewrite of the only predicate of this module. The old split
predicate deleted any empty substrings resulting from the breakup of
the original string. The new one preserves them, because they are
needed by the new encoding scheme used in interface.m.
deep_profiler/query.m:
New module, containing code dealing with the computational issues of
queries. Some of its code is old (from server.m), much of it is new.
deep_profiler/html_format.m:
New module, containing code dealing with HTML formatting. Some of its
code is old (from server.m), much of it is new.
deep_profiler/top_procs.m:
New module, containing code dealing with issues involving sorting
by various criteria. Some of its code is old (from server.m),
much of it is new.
deep_profiler/exclude.m:
New module to handle contour exclusion. This means that when listing
the callers of a procedure, we display the nearest parent that is *not*
excluded by virtue of being in a given module. The set of modules so
excluded forms a contour drawn through the program.
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_server.m:
deep_profiler/server.m:
Minor changes to adapt to the new system of preferences.
deep_profiler/array_util.m:
Add a mode to foldl2.
deep_profiler/io_combinator.m:
Add predicates for reading in sequences of ten things.
deep_profiler/measurements.m:
Add a function needed by new code.
deep_profiler/timeout.m:
Make the profiler robust in the face of signals.
deep_profiler/canonical.m:
Some more work towards working canonicalization; not there yet.
Move some procedures to profile.m, since other modules also need them
now.
deep_profiler/profile.m:
Add the new fields to ProcStatic structures.
Record the word size.
Record more information about procedures whose activation counters are
ever zeroed, in order to allow query.m to avoid giving misleading
information in cases where a procedure calls itself through a higher
order call site.
Record information about the modules of the program.
Add a bunch of lookup predicates, some moved from canonical.m.
deep_profiler/call_graph.m:
Minor changes to conform to changes in profile.m.
deep_profiler/startup.m:
Fill in the new parts of the profile data structure.
deep_profiler/read_profile.m:
Read the new fields in ProcStatic structures.
Read in the id of the root node as a fixed part of the header,
not as a node.
Read in the word size.
Make it easier to find all the debugging output sites.
Record, for each call site which can call more than one procedure,
whether this causes the caller's ProcStatic structure's activation
count to be zeroed.
runtime/mercury_deep_profiling.h:
Add the new fields to ProcStatic structures.
runtime/mercury_deep_profiling.c:
Write out the new fields to ProcStatic structures.
Write out the id of the root node as a fixed part of the header,
not as a node.
Write out the word size.
Remove incorrect L suffixes on constants.
Record that the artificial procedure "parent of main" is called once,
not zero times, to avoid division by zero when computing per-call
statistics.
runtime/mercury_deep_profiling_hand.h:
Add the new fields to the macros for creating ProcStatic structures.
runtime/mercury_ho_call.c:
library/array.m:
library/builtin.m:
library/exception.m:
library/std_util.m:
Add the new fields to the invocations of those macros.