library/io.call_system.m:
Move the code in the "system access predicates" section of io.m
to this new module.
library/io.environment.m:
Move the predicates dealing with environment variables in io.m
to this new module.
library/io.m:
Delete the code moved to the new modules.
Leave behind in io.m "forwarding predicates", predicates that do nothing
except call the moved predicates in the new modules, to provide backward
compatibility. But do mark the forwarding predicates as obsolete,
to tell people to update their (at their leisure, since the obsoleteness
warning can be turned off).
Also leave behind in io.m the definitions of the types used
by some parameters of some of the moved predicates.
library/MODULES_DOC:
List the new modules among the documented modules.
library/library.m:
List the new modules, including io.file.m (added in a previous change)
among the documented standard library modules.
NEWS:
Announce the changes.
browser/browse.m:
browser/interactive_query.m:
compiler/fact_table.m:
compiler/handle_options.m:
compiler/make.module_target.m:
compiler/mercury_compile_main.m:
compiler/module_cmds.m:
compiler/optimize.m:
compiler/options_file.m:
deep_profiler/conf.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
library/io.file.m:
mdbcomp/trace_counts.m:
ssdb/ssdb.m:
tests/general/environment.m:
tests/hard_coded/closeable_channel_test.m:
tests/hard_coded/setenv.m:
tests/hard_coded/system_sort.m:
Call the moved predicates directly in their new modules,
not indirectly through io.m.
library/io.file.m:
library/io.m:
Move two sections of io.m, the "file handling predicates" section
and the "handling temporary files" section to the new submodule io.file.m.
Leave behind in io.m "forwarding predicates", predicates that do nothing
except call the moved predicates in io.file.m, to provide backward
compatibility. But do mark the forwarding predicates as obsolete,
to tell people to update their (at their leisure, since the obsoleteness
warning can be turned off).
Also leave behind in io.m the definitions of the two types used
by some parameters of some of the moved predicates. Document the reason
why this is done.
library/MODULES_DOC:
List the new module among the documented modules.
NEWS:
Announce the changes.
browser/browse.m:
browser/interactive_query.m:
browser/listing.m:
compiler/analysis.file.m:
compiler/compile_target_code.m:
compiler/export.m:
compiler/fact_table.m:
compiler/file_util.m:
compiler/handle_options.m:
compiler/make.build.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/module_cmds.m:
compiler/parse_module.m:
compiler/passes_aux.m:
compiler/prog_event.m:
compiler/recompilation.check.m:
compiler/write_deps_file.m:
compiler/write_module_interface_files.m:
deep_profiler/conf.m:
deep_profiler/mdprof_cgi.m:
library/dir.m:
mdbcomp/program_representation.m:
ssdb/ssdb.m:
Call the file operation predicates directly in io.file.m, not indirectly
through io.m.
In two modules, add a #include of fcntl.h in C code. These modules contain
C code that needs this #include, but until now, they got it via a copy
in an automatically generated C header file of a foreign_decl pragma
in io.m that contained that #include. This diff moves that foreign_decl
to io.file.m, removing that crutch.
tests/debugger/browser_test.m:
tests/hard_coded/bit_buffer_test.m:
tests/hard_coded/bitmap_test.m:
tests/hard_coded/construct_bug.m:
tests/hard_coded/dir_fold.m:
tests/hard_coded/dir_test.m:
tests/hard_coded/read_binary_int16.m:
tests/hard_coded/read_binary_int32.m:
tests/hard_coded/read_binary_int64.m:
tests/hard_coded/read_binary_uint16.m:
tests/hard_coded/read_binary_uint32.m:
tests/hard_coded/read_binary_uint64.m:
tests/hard_coded/read_bitmap_size.m:
tests/hard_coded/remove_file.m:
tests/hard_coded/write_binary.m:
tests/hard_coded/write_binary_int8.m:
tests/hard_coded/write_binary_multibyte_int.m:
tests/hard_coded/write_binary_uint8.m:
Call the file operation predicates directly in io.file.m, not indirectly
through io.m.
deep_profiler/analysis_utils.m:
deep_profiler/autopar_find_best_par.m:
deep_profiler/autopar_reports.m:
deep_profiler/autopar_search_callgraph.m:
deep_profiler/autopar_search_goals.m:
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
deep_profiler/cliques.m:
deep_profiler/coverage.m:
deep_profiler/dump.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
deep_profiler/profile.m:
deep_profiler/read_profile.m:
deep_profiler/recursion_patterns.m:
deep_profiler/startup.m:
deep_profiler/var_use_analysis.m:
Replace implicit streams with explicit streams.
In some places, simplify some code, often using constructs such as
string.format that either did not exist or were too expensive to use
when the original code was written.
Consistenly use the spelling StdErr over Stderr.
In mdbprof_dump.m, put filename and reason-for-failing-to-open-that-file
in the right order in an error message.
deep_profiler/DEEP_FLAGS.in:
Turn on --warn-implicit-stream-calls for the entire deep_profiler
directory.
mdbcomp/program_representation.m:
mdbcomp/trace_counts.m:
Replace implicit streams with explicit streams. These are the two mdbcomp
modules that (a) used to use implicit streams, and (2) are used by the
deep profiler.
mdbcomp/Mercury.options:
Turn on --warn-implicit-stream-calls for these two modules.
slice/mcov.m:
slice/mtc_union.m:
Conform to the changes in mdbcomp.
... using an approach proposed by Peter, with an extra twist from Julien.
Instead of having two modules, getopt.m and getopt_io.m, with the former
defining predicates that do not take an I/O state pair, and the latter
defining predicates that do take an I/O state pair, put both kinds of
predicates into a single module. The versions with an I/O state pair
have an "_io" suffix added to their names for disambiguation.
Both versions are a veneer on top of a common infrastructure,
which relies on a simple type class to implement the operation
"give the contents of the file with this name". The predicate versions
with I/O state pairs have a normal implementation of this typeclass,
while the predicate versions that do not have I/O state pairs
have an implementation that always returns an error indication.
The above change just about doubles the number of exported predicates.
We already had two versions of most exported predicates that differed
in whether we returned errors in the form of a string, or in the form
of a structured representation, with names of the latter having
an "_se" suffix. Since we agreed that the structured representation
is the form we want to encourage, this diff deletes the string versions,
and deletes the "_se" suffix from the predicate names that used to have them.
(It still remains at the end of the name of a type.) This "undoubling"
should offset the effect of the doubling in the previous paragraph.
Eventually, we want to have just one module, getopt.m, containing
the updated code described above, but for now, we put the same code
into both getopt_io.m and getopt.m to prevent too big a shock to
people with existing code that uses getopt_io.m.
library/getopt.m:
library/getopt_io.m:
Make the changes described above.
library/Mmakefile:
Instead of building both getopt_io.m and getopt.m from getopt_template,
build getopt.m from getopt_io.m.
tools/bootcheck:
Delete references to getopt_template.
compiler/typecheck_errors.m:
When a type error involves one of the getopt/getopt_io predicates
whose interfaces are changed by this diff, tell the user about
how these changes could have caused the error, and thus what the
probable fix is.
compiler/handle_options.m:
browser/parse.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_dump.m:
deep_profiler/mdprof_procrep.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
tests/hard_coded/space.m:
Use the updated getopt interface.
compiler/compile_target_code.m:
compiler/compute_grade.m:
compiler/deforest.m:
compiler/det_report.m:
compiler/format_call.m:
compiler/globals.m:
compiler/goal_expr_to_goal.m:
compiler/make.build.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile_main.m:
compiler/ml_top_gen.m:
compiler/module_cmds.m:
compiler/op_mode.m:
compiler/optimization_options.m:
compiler/options.m:
compiler/write_module_interface_files.m:
tools/make_optimization_options_middle:
tools/make_optimization_options_start:
Replace references to getopt_io.m with references to getopt.m.
tests/invalid/getopt_io_old.{m,err_exp}:
tests/invalid/getopt_old.{m,err_exp}:
tests/invalid/getopt_old_se.{m, err_exp}:
New test cases for the extra help
tests/invalid/Mmakefile:
Enable the new test cases.
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.
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.
runtime/mercury_goto.h:
Cast the "const MR_LabelLayout *" argument of calls
MR_insert_internal_label, since without this cast, we get C compiler
warnings in the bootcheck output when the caller passes a
"const MR_LabelLayoutNoVarInfo *" for this argument.
tests/hard_coded/Mmakefile:
Redirect the output of the weak_ptr test to a file instead of including it
in the output of bootcheck itself. The output is maybe be needed in a rare
cases, but is not needed most of the time.
tests/hard_coded/weak_ptr.m:
Fix white space.
tests/feedback/Mmakefile:
Specify verbosity level 0 when invoking mdprof_create_feedback.
deep_profiling/mdprof_create_feedback.m:
Record the verbosity level when we postprocess the options. We used to
record it *after* creating the feedback file, and before printing the
messages gathered during this process. This *mostly* worked, but some
messages are printed using trace goals *during* the creation of the
feedback file, and these ignored the specified verbosity level.
deep_profiling/query.m:
Remove the IO arguments from exec and try_exec, since they do not use them.
deep_profiling/var_use_analysis.m:
Eliminate some ambiguities by renaming two predicates.
Simplify some overly complex code.
deep_profiling/autopar_costs.m:
deep_profiling/create_report.m:
deep_profiling/mdprof_cgi.m:
deep_profiling/mdprof_test.m:
Conform to the above changes.
mdbcomp/feedback.m:
Fix a typo.
In the Mercury compiler itself, and in a number of tools we print a version
string on one line,
$ mmc --version
Mercury Compiler, version rotd-2013-10-01, configured for x86_64-unknown-linux-gnu
Copyright (C) 1993-2013 The University of Melbourne
When the version number is sufficiently long, such as for an ROTD release, this
will wrap on 80 column terminals. This change splits these strings into two
parts: the version and the architecture string. These can then either be
printed more succinctly on one line
$ mmc --version
Mercury Compiler, version rotd-2013-10-01, on x86_64-unknown-linux-gnu
Copyright (C) 1993-2013 The University of Melbourne
Or when written to a file such as the .c files that mmc generates, can be
written out onto two lines:
XXX
library/library.m:
Make the version predicate return two values, one for the version number
and the other for the architecture name. This makes it easier to format
the version information in the various places it is used.
compiler/handle_options.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_create_feedback.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/mdprof_test.m:
profiler/mercury_profile.m:
Format this as shown above for the Mercury compiler and other tools.
compiler/c_util.m:
compiler/elds_to_erlang.m:
compiler/export.m:
compiler/fact_table.m:
compiler/llds_out_file.m:
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/write_deps_file.m:
Format version information on two lines when it is used in the
compiler's various output files.
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: 6
Branches: main
Several improvements to make the deep profiler more convenient to use.
deep_profiler/mdprof_cgi.m:
If the data file does not end in .data, generate an explicit error
message. Without this, the deep profiler just hangs forever on such
filenames.
deep_profiler/query.m:
Add a couple more categories of user preferences. The first new
category controls whether, in reports for procedures and cliques,
the deep profiler will display call sites through which there were no
calls. The second new category controls whether the deep profiler
includes module qualifications in the names of procedures. Module
qualifying everything, as we did before, can clutter up the output,
so the new default is to module qualify only the names of procedures
that are in different modules from the module that defines the current
procedure.
deep_profiler/profile.m:
deep_profiler/report.m:
Remember module names and unqualified as well as qualified names
of procedures.
deep_profiler/create_report.m:
deep_profiler/read_profile.m:
Remember the newly needed information.
deep_profiler/display_report.m:
Implement the two new categories of preferences.
When generating the menu, make the "follow the action" links
more useful by implicitly preferring to (a) hide inactive call sites,
and (b) sort by overall time.
When sorting by time, if two times (clock ticks) are equal,
try to use call sequence numbers to resolve the order.
When generating the menu, print the total quanta as well as the total
runtime computed from it.
deep_profiler/dump.m:
deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
Conform to the changes above.
Estimated hours taken: 0.5
Branches: main
deep_profiler/mdprof_cgi.m:
Fix a problem. If the server had exited but the user does not know of,
a click of the restart button used to show an error message about an
unexpected restart: the newly started server did not expect to be told
to restart. Since the user asked the *old* server to restart and the
new server is effectively a restart of the old one, handle such
requests as normal startup.
deep_profiler/display_report.m:
It does not make sense to talk about modules sorted by time
self-and-desc, but it does make sense to talk about procedures
sorted that way, so do not disable such sorting.
Estimated hours taken: 1
Branches: main
Put the program representation inside the deep profiler's main data structure,
since this simplifies things. (We already handled the contents of the
exclusion threshold file this way.)
deep_profiler/profile.m:
Change the data structure's type definition as above.
deep_profiler/create_report.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_feedback.m:
deep_profiler/mdprof_test.m:
deep_profiler/query.m:
Conform to the change above.
deep_profiler/startup.m:
Conform to the change above.
Rename a predicate to avoid ambiguity.
Branches: main
Introduce a new report type in the deep profiler tools. The procedure
representation coverage report displays a representation of the procedure,
annotated with determinism and coverage information. This allows a programmer
to view the most frequently taken execution paths through a procedure,
This report is available when the program has been compiled for coverage
profiling, and when a Deep.procrep file is available.
deep_profiler/report.m:
The coverage profiling dump report is now a coverage_information annotated
procedure representation structure.
Add a goal_path field to the call_site_perf type.
deep_profiler/program_representation_utils.m:
Create procrep_annotate_with_coverage/5 predicate to annotate a procedure
representation structure with coverage information.
Use type classes to convert goal annotations to strings used with the
procedure representation structures.
deep_profiler/create_report.m:
Call procrep_annotate_with_coverage to build the coverage-annotated
procedure representation report.
deep_profiler/display_report.m:
Conform to changes in deep_profiler/report.m
Implement a goal_annotation typeclass for coverage_info for displaying the
coverage information.
Display a link to the procrep_coverage report from the Procedure report.
deep_profiler/mdprof_cgi.m:
Add the ability to generate a procrep_coverage report to the command line
interface for debugging.
deep_profiler/mdprof_test.m:
Add the ability to generate all the procrep coverage reports possible from
a Deep.data file.
Make compressing the result (using a separate gzip process) optional,
since it can slow down the test for a negligible gain.
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: 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: 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: 2
Branch: main
Improved mdprof_dump's command line parsing. It's behaviour is now more
obvious. Major changes include The "-D restrict" option is now "--restrict",
and is no-longer affected by other -D options. Silently ignored -D options
have now been documented as unimplemented.
deep_profiler/dump.m:
use a structured representation of command line parameters used to control
deep_dump/4 and deep_initial_dump/4.
deep_profiler/startup.m:
Conform to changes in dump.m, read_and_startup now takes a deep_options
type rather than a list of strings. A new version of read_and_startup has
been created that doesn't take any deep_options and assumes the defaults.
deep_profiler/mdprof_dump.m:
Modified command line options, The '-D' option is now only used to specify
what arrays to dump. A new option, '--restrict', controls whether to
print unreferenced call_site_statics and proc_statics.
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_feedback.m:
deep_profiler/mdprof_test.m:
Conform to changes in startup.m, now makes use of dump.m.
Estimated hours taken: 20
Branches: main
Add a new compiler option. --inform-ite-instead-of-switch. If this is enabled,
the compiler will generate informational messages about if-then-elses that
it thinks should be converted to switches for the sake of program reliability.
Act on the output generated by this option.
compiler/simplify.m:
Implement the new option.
Fix an old bug that could cause us to generate warnings about code
that was OK in one duplicated copy but not in another (where a switch
arm's code is duplicated due to the case being selected for more than
one cons_id).
compiler/options.m:
Add the new option.
Add a way to test for the bug fix in simplify.
doc/user_guide.texi:
Document the new option.
NEWS:
Mention the new option.
library/*.m:
mdbcomp/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
Convert if-then-elses to switches at most of the sites suggested by the
new option. At the remaining sites, switching to switches would have
nontrivial downsides. This typically happens with the switched-on type
has many functors, and we treat one or two specially (e.g. cons/2 in
the cons_id type).
Perform misc cleanups in the vicinity of the if-then-else to switch
conversions.
In a few cases, improve the error messages generated.
compiler/accumulator.m:
compiler/hlds_goal.m:
(Rename and) move insts for particular kinds of goal from
accumulator.m to hlds_goal.m, to allow them to be used in other
modules. Using these insts allowed us to eliminate some if-then-elses
entirely.
compiler/exprn_aux.m:
Instead of fixing some if-then-elses, delete the predicates containing
them, since they aren't used, and (as pointed out by the new option)
would need considerable other fixing if they were ever needed again.
compiler/lp_rational.m:
Add prefixes to the names of the function symbols on some types,
since without those prefixes, it was hard to figure out what type
the switch corresponding to an old if-then-else was switching on.
tests/invalid/reserve_tag.err_exp:
Expect a new, improved error message.
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: 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: 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: 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: 8
Branches: main
Significantly enhance the infrastructure for debugging problems with the deep
profiler by providing facilities for dumping out some of the main data
structures. These were needed for my recent fix of mercury_deep_profiling.c
in the runtime.
There are no algorithmic changes in the non-debugging parts of the code.
deep_profiler/dump.m:
New module for containing predicates that dump data structures.
The first draft was by Julien.
deep_profiler/mdprof_dump.m:
New program for dumping out the contents of Deep.data files.
The first draft was by Julien.
deep_profiler/startup.m:
Provide a mechanism for dumping out the main data structures at three
stages.
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
Pass the options to startup to control these dumps.
deep_profiler/measurements.m:
Provide a mechanism for getting all the counts of a measurement at
once.
deep_profiler/array_util.m:
Provide extra modes of some predicates for use in the other modules.
deep_profiler/read_profile.m:
Fix Julien's fix: handle init predicates as well as the other uci
predicates.
deep_profiler/profile.m:
Reorder the arguments of predicates as required to enable the use
of state variable notation in the callers.
deep_profiler/*.m:
Conform to the change in profile.m, and use state variable notation
where this is advantageous.
Convert some modules to four-space indentation where this eliminates
excessive indentation or bad line breaks.
deep_profiler/Mmakefile:
Handle the new mdprof_dump program.
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: 4
Branches: main
A bunch of small improvements to the library.
library/getopt.m:
Allow the determinism of the the option_defaults predicate
passed by users to getopt__process_options to be multi as well as
nondet. The natural determinism of such predicates is multi;
the nondet determinism dates from before the time the compiler
supported multi.
Add a version of process_options that allows it to be run more
than once (by allowing it to start with an option table returned
by a previous invocation) and returns the set of options set by
each invocation, so that the caller can tell which invocation
(if any) has set any given option.
Switch to 4-space indentation to reduce the number of bad line breaks.
library/svset.m:
This new module svset makes it easier to work with sets in
code that uses state variables. For every predicate in set.m that
updates sets, svset.m contains a predicate doing the same thing
with an argument order conducive to the use of state variables.
This module is now used in getopt.m.
library/library.m:
Mention the new module.
library/map.m:
library/tree234.m:
Add new mode to map__map_foldl that I found I needed in elk.
library/map.m:
library/svmap.m:
Apply type specialization to all the most frequently used predicates
for updating maps.
NEWS:
Mention the functionality in getopt.m, and the new module.
Group all the items related to getopt.m.
browser/parse.m:
compiler/options.m:
profiler/mercury_profile.m:
deep_profiler/mdprof_cgi.m:
deep_profiler/mdprof_test.m:
Conform to the new determinism in getopt.m.
Estimated hours taken: 0.5
Branches: main
deep_profiler/*.m:
Switch to using state variable notation where this is beneficial.
There are no changes in algorithms.
Estimated hours taken: 1
Branches: main
library/io.m:
Deprecate io__current_(binary_)?(input|output)_stream,
because these procedures were identical with the
procedures named io__(binary_)?(input|output)_stream.
browser/browse.m:
Use io__output_stream instead of io__current_output_stream.
deep_profiler/mdprof_cgi.m:
Use io__binary_(in|out)put_stream instead of
io__current_binary_(in|out)put_stream.
NEWS:
Mention the changes to library/io.m.
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: 8
Branches: main
Misc cleanups and documentation of various aspects of the deep profiler.
More will come later.
deep_profiler/startup.m:
Fix a bug in the algorithm that we used to compensate for zeroing.
The new algorithm is documented in the paper.
deep_profiler/profile.m:
deep_profiler/startup.m:
deep_profiler/query.m:
Switch the names we use for the data structures used in that algorithm
to match the names in the paper.
deep_profiler/query.m:
Fix an off-by-one bug.
deep_profiler/interface.m:
Document this module.
deep_profiler/interface.m:
deep_profiler/mdprof_cgi.m:
Move some code in interface.m that was used only in mdprof_cgi.m to
mdprof_cgi.m.
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.
Estimated hours taken: 500
Branches: main
Implement deep profiling; merge the changes on the deep2 branch back
onto the trunk.
The main documentation on the general architecture of the deep profiler
is the deep profiling paper.
doc/user_guide.texi:
Document how to use the deep profiler.
deep_profiler:
deep_profiler/Mmakefile:
A new directory holding the deep profiler and its mmakefile.
Mmakefile:
Add targets for the new directory.
Add support for removing inappropriate files from directories.
deep_profiler/interface.m:
The deep profiler consists of two programs: mdprof_cgi.m, which acts
as a CGI "script", and mdprof_server.m, which implements the server
process that the CGI script talks to. Interface.m defines the
interface between them.
script/mdprof.in:
A shell script template. ../configure uses it to generate mdprof,
which is a wrapper around mdprof_cgi that tells it how to find
mdprof_server.
deep_profiler/mdprof_cgi.m:
The CGI "script" program.
deep_profiler/mdprof_server.m:
The top level predicates of the server.
deep_profiler/profile.m:
The main data structures of the server and their operations.
deep_profiler/read_profile.m:
Code for reading in profiling data files.
deep_profiler/startup.m:
Code for post-processing the information in profiling data files,
propagating costs from procedures to their ancestors and performing
various kinds of summaries.
deep_profiler/server.m:
Code for responding to requests from the CGI script.
deep_profiler/cliques.m:
Code to find cliques in graphs.
deep_profiler/array_util.m:
deep_profiler/util.m:
Utility predicates.
deep_profiler/dense_bitset.m:
An implementation of (part of) the set ADT with dense bit vectors.
deep_profiler/measurements.m:
Operations on profiling measurements.
deep_profiler/timeout.m:
An implementation of a timeout facility.
deep_profiler/conf.m:
Functions that depend on autoconfigured settings.
configure.in:
Find out what command to use to find the name of the local host.
Install deep profiling versions of the standard library along with the
other profiling versions.
runtime/mercury_conf.h.in:
Add some macros for deep_profiler/conf.m to use.
library/profiling_builtin.m:
runtime/mercury_deep_call_port_body.h:
runtime/mercury_deep_leave_port_body.h:
runtime/mercury_deep_redo_port_body.h:
A new library module that implements deep profiling primitives.
Some of these primitives have many versions, whose common code is
factor is factored out in three new include files in the runtime.
compiler/deep_profiling.m:
New module to perform the program transformations described in the
paper.
compiler/notes/compiler_design.html:
Document the new compiler module.
compiler/mercury_compiler.m:
Invoke the new module in deep profiling grades. Allow global static
data to be generated by deep_profiling.m.
compiler/options.m:
Add options to turn on deep profiling and (for benchmarking purposes)
control its implementation.
Add an optiooption disable tailcall optimization in the LLDS backend,
to help benchmarking deep profiling.
compiler/jumpopt.m:
compiler/optimize.m:
Obey the option to disable tailcalls.
compiler/handle_options.m:
Handle the implications of deep profiling.
compiler/modules.m:
In deep profiling grades, automatically import profiling_builtin.m.
compiler/prog_util.m:
doc/Makefile:
library/library.m:
Handle the new builtin module.
compiler/export.m:
In deep profiling grades, wrap deep profiling code around exported
procedures to handle the "unscheduled call" aspects of callbacks to
Mercury from the foreign language.
compiler/higher_order.m:
profiler/demangle.m:
util/demangle.c:
When creating a name for a higher-order-specialized predicate, include
the mode number in the name.
compiler/add_trail_ops.m:
compiler/type_util.m:
Move c_pointer_type from add_trail_ops to type_util, so it can also be
used by deep_profiling.m.
compiler/hlds_goal.m:
Add a new goal feature that marks a tail call, for use by
deep_profiling.m.
compiler/hlds_pred.m:
Add a new field to proc_info structures for use by deep_profiling.m.
Add a mechanism for getting proc_ids for procedure clones.
Remove next_proc_id, an obsolete and unused predicate.
compiler/hlds_data.m:
Add a new cons_id to refer to the proc_static structure of a procedure.
compiler/bytecode_gen.m:
compiler/code_util.m:
compiler/dependency_graph.m:
compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
compiler/ml_unify_gen.m:
compiler/opt_debug.m:
compiler/prog_rep.m:
compiler/rl_exprn.m:
compiler/switch_util.m:
compiler/unify_gen.m:
Trivial changes to handle the new cons_id, goal feature and/or
proc_info argument.
compiler/rtti.m:
Add a utility predicate for extracting pred_id and proc_id from an
rtti_proc_label, for use by hlds_out.m
compiler/layout.m:
compiler/layout_out.m:
compiler/llds.m:
compiler/llds_common.m:
Add support for proc_static and call_site_static structures.
compiler/layout_out.m:
compiler/llds_out.m:
Add code for the output of proc_static structures.
compiler/code_util.m:
Make code_util__make_proc_label_from_rtti a function, and export it.
util/mkinit.c:
compiler/llds_out.m:
compiler/layout.m:
compiler/modules.m:
Add support for a fourth per-module C function, for writing out
proc_static structures (and the call_site_static structures they
contains).
Since proc_static structures can be referred to from LLDS code (and not
just from other static structures and compiler-generated C code),
reorganize the declarations of static structures slightly.
Change the schema for the name of the first per-module C function
slightly, to make it the addition of the fourth function easier.
The scheme now is:
mercury__<modulename>__init
mercury__<modulename>__init_type_tables
mercury__<modulename>__init_debugger
mercury__<modulename>__write_out_proc_statics
Improve formatting of the generated C code.
library/*.m:
runtime/mercury.c:
runtime/mercury_context.c:
runtime/mercury_engine.c:
runtime/mercury_ho_call.c:
runtime/mercury_tabling.c:
runtime/mercury_trace_base.c:
runtime/mercury_wrapper.c:
trace/mercrury_trace.[ch]:
trace/mercrury_trace_declarative.c:
trace/mercrury_trace_external.c:
trace/mercrury_trace_internal.c:
Conform to the new scheme for initialization functions for hand-written
modules.
compiler/mercury_compile.m:
library/benchmarking.m:
runtime/mercury_conf_param.h:
runtime/mercury.h:
runtime/mercury_engine.c:
runtime/mercury_goto.c:
runtime/mercury_grade.h:
runtime/mercury_ho_call.c:
runtime/mercury_label.[ch]:
runtime/mercury_prof.[ch]:
Add an MR_MPROF_ prefix in front of the C macros used to control the
old profiler.
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Make deep profiling completely separate from the old profiling system,
by making the deep profiling grade independent of MR_MPROF_PROFILE_TIME
and the compiler option --profile-time.
library/array.m:
library/builtin.m:
library/std_util.m:
runtime/mercury_hand_unify_body.h:
runtime/mercury_hand_compare_body.h:
In deep profiling grades, wrap the deep profiling call, exit, fail
and redo codes around the bodies of hand-written unification
and comparison procedures.
Make the reporting of array bounds violations switchable between
making them fatal errors, as we currently, and reporting them by
throwing an exception. Throwing an exception makes debugging code
using arrays easier, but since exceptions aren't (yet) propagated
across engine boundaries, we keep the old behaviour as the default;
the new behaviour is for implementors.
runtime/mercury_deep_profiling_hand.h:
New file that defines macros for use in Mercury predicates whose
definition is in hand-written C code.
library/exception.m:
runtime/mercury_exception_catch_body.h:
runtime/mercury_stacks.h:
In deep profiling grades, wrap the deep profiling call, exit, fail
and redo codes around the bodies of the various modes of builtin_catch.
Provide a function that C code can use to throw exceptions.
library/benchmarking.m:
library/exception.m:
library/gc.m:
library/std_util.m:
runtime/mercury_context.[ch]:
runtime/mercury_engine.[ch]:
runtime/mercury_debug.c:
runtime/mercury_deep_copy.c:
runtime/mercury_overflow.h:
runtime/mercury_regs.h:
runtime/mercury_stacks.h:
runtime/mercury_thread.c:
runtime/mercury_wrapper.c:
Add prefixes to the names of the fields in the engine and context
structures, to make code using them easier to understand and modify.
runtime/mercury_deep_profiling.[ch]:
New module containing support functions for deep profiling and
functions for writing out a deep profiling data file at the end of
execution.
runtime/mercury_debug.[ch]:
Add support for debugging deep profiling.
Add support for watching the value at a given address.
Make the buffered/unbuffered nature of debugging output controllable
via the -du option.
Print register contents only if -dr is specified.
runtime/mercury_goto.h:
runtime/mercury_std.h:
Use the macros in mercury_std.h instead of defining local variants.
runtime/mercury_goto.h:
runtime/mercury_stack_layout.h:
runtime/mercury_stack_trace.c:
runtime/mercury_tabling.c:
trace/mercury_trace.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_vars.c:
Standardize some of the macro names with those used in the debugger
paper.
runtime/mercury_heap.h:
Add support for memory profiling with the deep profiler.
runtime/mercury_prof.[ch]:
runtime/mercury_prof_time.[ch]:
Move the functionality that both the old profiler and the deep profiler
need into the new module mercury_prof_time. Leave mercury_prof
containing stuff that is only relevant to the old profiler.
runtime/mercury_prof.[ch]:
runtime/mercury_strerror.[ch]:
Move the definition of strerror from mercury_prof to its own file.
runtime/mercury_wrapper.[ch]:
Add support for deep profiling.
Add suppory for controlling whether debugging output is buffered or
not.
Add support for watching the value at a given address.
runtime/Mmakefile:
Mention all the added files.
scripts/mgnuc.in:
Add an option for turning on deep profiling.
Add options for controlling the details of deep profiling. These
are not documented because they are intended only for benchmarking
the deep profiler itself, for the paper; they are not for general use.
tools/bootcheck:
Compile the deep_profiler directory as well as the other directories
containing Mercury code.
Turn off the creation of deep profiling data files during bootcheck,
since all but one of these in each directory will be overwritten
anyway.
Add support for turning on --keep-objs by default in a workspace.
tools/speedtest:
Preserve any deep profiling data files created by the tests.
trace/mercury_trace.c:
Trap attempts to perform retries in deep profiling grades, since they
would lead to core dumps otherwise.
util/Mmakefile:
Avoid compile-time warnings when compiling getopt.
tests/*/Mmakefile:
tests/*/*/Mmakefile:
In deep profiling grades, switch off the tests that test features
that don't work with deep profiling, either by design or because
the combination hasn't been implemented yet.