mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 01:13:30 +00:00
master
20 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
2424d820f0 |
Update copyright notices in deep_profiler.
deep_profiler/*.m:
As above.
|
||
|
|
3c07fc2121 |
Use explicit streams in deep_profiler/*.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.
|
||
|
|
ae4b736fdd |
Implement warnings for suspicious recursion.
compiler/simplify_goal_call.m:
If the --warn-suspicious-recursion option is set, and if the warning
isn't disabled, generate warnings for two different kinds of suspicious
recursion. They are both related to, but separate from, the warning
we have long generated for infinite recursion, which occurs when
the input args of a recursive call are the same as the corresponding
args in the clause head.
Both kinds suspicious recursion look at the input args of a recursive call
that are NOT the same as the corresponding args in the clause head.
Both require these args to have non-unique modes. (If they have unique
modes, then the depth of the recursion may be controlled by state outside
the view of the Mercury compiler, which means that a warning would be
likely to be misleading.)
The first kind is when all these args use state variable notation.
Most of the time, we use state var notation to denote the data structures
updated by the recursive code; having variables using such notation
*controlling* the recursion is much less common, and much more likely
to be unintended. The motivation for the new option was this infinitely
looping code, which resulted from neglecting to s/[X | Xs]/Xs/ after
cutting-and-pasting the clause head to the recursive call.
p([X | Xs], !S) :-
...,
p([X | Xs], !S).
The other kind of suspicious recursive call we warn about involve
input arguments where the base names of the input arguments (the part
before any numeric suffixes) seem be switched between the clause head
and the recursive call, as here:
q(As0, Bs0, ...) :-
...,
q(Bs1, As, ...).
compiler/mercury_compile_main.m:
Disable style warnings when invoked with --make-optimization-interface
or its transitive variant. Without this, warnings about suspicious
recursion would get reported in such invocations.
Move a test from a callee to a caller to allow the callee to be
less indented.
compiler/options.m:
Export functionality to mercury_compile_main.m to make the above possible.
library/string.m:
Add a predicate to convert a string to *reverse* char list directly.
Note a discrepancy between the documentation and the implementation
of the old predicate the new one is based on (which converts a string
to a forward char list).
NEWS:
Note the new predicate in string.m.
compiler/cse_detection.m:
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/deforest.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/distance_granularity.m:
compiler/frameopt.m:
compiler/inst_util.m:
compiler/lp_rational.m:
compiler/matching.m:
compiler/modes.m:
compiler/old_type_constraints.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.region_arguments.m:
compiler/recompilation.usage.m:
compiler/stratify.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.indirect.m:
compiler/typeclasses.m:
compiler/use_local_vars.m:
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
library/bit_buffer.read.m:
library/bit_buffer.write.m:
library/calendar.m:
library/diet.m:
library/lexer.m:
library/parser.m:
library/parsing_utils.m:
library/ranges.m:
library/set_ctree234.m:
library/set_tree234.m:
library/string.parse_util.m:
library/tree234.m:
library/varset.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
profiler/demangle.m:
Avoid warnings for suspicious recursion. In most cases, do this by
wrapping disable_warning scopes around the affected recursive calls;
in a few cases, do this by changing the code.
tests/warnings/suspicious_recursion.{m,exp}:
A test case for the new warnings.
tests/warnings/Mercury.options:
tests/warnings/Mmakefile:
Enable the new test case.
|
||
|
|
9095985aa8 |
Fix more warnings from --warn-inconsistent-pred-order-clauses.
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.
|
||
|
|
62ec97d443 |
Report imports shadowed by other imports.
If a module has two or more import_module or use_module declarations
for the same module, (typically, but not always, one being in its interface
and one in its implementation), generate an informational message about
each redundant declaration if --warn-unused-imports is enabled.
compiler/hlds_module.m:
We used to record the set of imported/used modules, and the set of
modules imported/used in the interface of the current module. However,
these sets
- did not record the distinction between imports and uses;
- did not allow distinction between single and multiple imports/uses;
- did not record the locations of the imports/uses.
The first distinction was needed only by module_qual.m, which *did*
pay attention to it; the other two were not needed at all.
To generate messages for imports/uses shadowing other imports/uses,
we need all three, so change the data structure storing such information
for *direct* imports to one that records all three of the above kinds
of information. (For imports made by read-in interface and optimization
files, the old set of modules approach is fine, and this diff leaves
the set of thus *indirectly* imported module names alone.)
compiler/unused_imports.m:
Use the extra information now available to generate a
severity_informational message about any import or use that is made
redundant by an earlier, more general import or use.
Fix two bugs in the code that generated warnings for just plain unused
modules.
(1) It did not consider that a use of the builtin type char justified
an import of char.m, but without that import, the type is not visible.
(2) It scanned cons_ids in goals in procedure bodies, but did not scan
cons_ids that have been put into the const_struct_db. (I did not update
the code here when I added the const_struct_db.)
Also, add a (hopefully temporary) workaround for a bug in
make_hlds_passes.m, which is noted below.
However, there are at least three problems that prevent us from enabling
--warn-unused-imports by default.
(1) In some places, the import of a module is used only by clauses for
a predicate that also has foreign procs. When compiled in a grade that
selects one of those foreign_procs as the implementation of the predicate,
the clauses are discarded *without* being added to the HLDS at all.
This leads unused_imports.m to generate an uncalled-for warning in such
cases. To fix this, we would need to preserve the Mercury clauses for
*all* predicates, even those with foreign procs, and do all the semantic
checks on them before throwing them away. (I tried to do this once, and
failed, but the task should be easier after the item list change.)
(2) We have two pieces of code to generate import warnings. The one in
unused_imports.m operates on the HLDS after type and mode checking,
while module_qual.m operates on the parse tree before the creation of
the HLDS. The former is more powerful, since it knows e.g. what types and
modes are used in the bodies of predicates, and hence can generate warnings
about an import being unused *anywhere* in a module, as opposed to just
unused in its interface.
If --warn-unused-imports is enabled, we will get two separate set of
reports about an interface import being unused in the interface,
*unless* we get a type or mode error, in which case unused_imports.m
won't be invoked. But in case we do get such errors, we don't want to
throw away the warnings from module_qual.m. We could store them and
throw them away only after we know we won't need them, or just get
the two modules to generate identical error_specs for each warning,
so that the sort_and_remove_dups of the error specs will do the
throwing away for us for free, if we get that far.
(3) The valid/bug100.m test case was added as a regression test for a bug
that was fixed in module_qual.m. However the bug is still present in
unused_imports.m.
compiler/make_hlds_passes.m:
Give hlds_module.m the extra information it now needs for each item_avail.
Add an XXX for a bug that cannot be fixed right now: the setting of
the status of abstract instances to abstract_imported. (The "abstract"
part is correct; the "imported" part may not be.)
compiler/intermod.m:
compiler/try_expand.m:
compiler/xml_documentation.m:
Conform to the change in hlds_module.m.
compiler/module_qual.m:
Update the documentation of the relationship of this module
with unused_imports.m.
compiler/hlds_data.m:
Document a problem with the status of instance definitions.
compiler/hlds_out_module.m:
Update the code that prints out the module_info to conform to the change
to hlds_module.m.
Print status information about instances, which was needed to diagnose
one of the bugs in unused_imports.m. Format the output for instances
nicer.
compiler/prog_item.m:
Add a convenience predicate.
compiler/prog_data.m:
Remove a type synonym that makes things harder to understand, not easier.
compiler/modules.m:
Delete an XXX that asks for the feature this diff implements.
Add another XXX about how that feature could be improved.
compiler/Mercury.options.m:
Add some more modules to the list of modules on which the compiler
should be invoked with --no-warn-unused-imports.
compiler/*.m:
library/*.m:
mdbcomp/*.m:
browser/*.m:
deep_profiler/*.m:
mfilterjavac/*.m:
Delete unneeded imports. Many of these shadow other imports, and some
are just plain unneeded, as shown by --warn-unused-imports. In a few
modules, there were a *lot* of unneeded imports, but most had just
one or two.
In a few cases, removing an import from a module, because it *itself*
does not need it, required adding that same import to those of its
submodules which *do* need it.
In a few cases, conform to other changes above.
tests/invalid/Mercury.options:
Test the generation of messages about import shadowing on the existing
import_in_parent.m test case (although it was also tested very thoroughly
when giving me the information needed for the deletion of all the
unneeded imports above).
tests/*/*.{m,*exp}:
Delete unneeded imports, and update any expected error messages
to expect the now-smaller line numbers.
|
||
|
|
270170416d |
Bring the style of deep_profiler/* up-to-date.
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.
|
||
|
|
b9eca3ce6b |
Change the order of predicate arguments in the array module to make them
Branches: main Change the order of predicate arguments in the array module to make them more conducive to the use of state variable notation. library/array.m: As above. Group clauses for functions with those of the corresponding predicate. library/svarray.m: library/hash_table.m: library/io.m: library/random.m: compiler/lambda.m: deep_profiler/array_util.m: deep_profiler/callgraph.m: deep_profiler/canonical.m: deep_profiler/cliques.m: deep_profiler/dense_bitset.m: deep_profiler/measurements.m: deep_profiler/profile.m: deep_profiler/read_profile.m: deep_profiler/startup.m: tests/general/array_test.m: tests/general/mode_inf.m: tests/hard_coded/array_test2.m: tests/hard_coded/lp.m: tests/hard_coded/reuse_array.m: Conform to the above change and remove dependencies on the svarray module. tests/general/set_test.m: Replace calls to set_bbbtree.size/2 with calls to set_bbbtree.count/2. NEWS: Announce the above change. |
||
|
|
8a28e40c9b |
Add the predicates sorry, unexpected and expect to library/error.m.
Estimated hours taken: 2 Branches: main Add the predicates sorry, unexpected and expect to library/error.m. compiler/compiler_util.m: library/error.m: Move the predicates sorry, unexpected and expect from compiler_util to error. Put the predicates in error.m into the same order as their declarations. compiler/*.m: Change imports as needed. compiler/lp.m: compiler/lp_rational.m: Change imports as needed, and some minor cleanups. deep_profiler/*.m: Switch to using the new library predicates, instead of calling error directly. Some other minor cleanups. NEWS: Mention the new predicates in the standard library. |
||
|
|
f16e8118bd |
Implement a linear alternative to the exponential algorithm that determines how
best to parallelise a conjunction.
Made other performance improvements.
mdbcomp/feedback.m:
Add a field to the candidate_parallel_conjunction_params structure giving
the preference of algorithm.
Simplify the parallel exec metrics type here. It is now used only to
summarise information that has already been calculated. The original code
has been moved into deep_profiler/measurements.m
Add a field to the candidate_par_conjunction structure giving the index
within the conjunction of the first goal in the partition. This is used
for pretty-printing parallelisation reports.
Incremented the feedback format version number.
deep_profiler/measurements.m:
Move the original parallel exec metrics type and code here from
mdbcomp/feedback.m
deep_profiler/create_report.m:
Avoid a performance issue by memoizing create_proc_var_use_dump_report
which is called by the analysis for the same procedure (at different
dynamic call sites) many times. In simple cases this more than doubled the
execution time, in more complicated cases it should perform even better.
Conform to changes in coverage.m
deep_profiler/mdprof_fb.automatic_parallelism.m:
Implement the linear algorithm for parallelising a conjunction.
Since we don't to parallelism specialisation don't try to parallelise the
same procedure more than once. This should avoid some performance problems
but I haven't tested it.
If it is impossible to generate an independent parallelisation generate a
dependent one and then report it as something we cannot parallelise. This
can help programmers write more independent code.
Use directed graphs rather than lookup maps to track dependencies. This
simplifies some code as the digraph standard library module already has
code to compute reverse graphs and transitive closures of the graphs.
Since there are now two parallelisation algorithms; code common to both of
them has been factored out.
The objective function used by the branch and bound search has been
modified to take into account the overheads of parallel execution. It is:
minimise(ParTime + ParOverheads X 2.0)
This way we allow the overheads to increase by 1csc provided that it
reduces ParTime by more than 2csc. (csc = call sequence counts)
When pretty-printing parallelisation reports print each goal in the
parallelised conjunction with it's new goal path. This makes debugging
easier for large procedures.
Fix a bug where the goal path of scope goals was calculated incorrectly,
this lead to a thrown exception in the coverage analysis code when it used
the goalpath to lookup the call site of a call.
deep_profiler/mdprof_feedback.m:
Support a new command line option for choosing which algorithm to use.
Additionally the linear algorithm will be used if the problem is above a
certain size and the exponential algorithm was chosen. This can be
configured including the fallback threshold.
Print the user's choice of algorithm as part of the candidate parallel
conjunctions report.
deep_profiler/message.m:
Add an extra log message type for exceptions thrown during auto
parallelisation.
deep_profiler/program_representation_utils.m:
The goal_rep pretty printer now prints the goal path for each goal.
deep_profiler/coverage.m:
procrep_annotate_with_coverage now catches and returns exceptions in a
maybe_error result.
deep_profiler/cliques.m:
Copy predicates from the standard library into cliques.m to prevent the
lack of tail recursion from blowing the stack in some cases. (cliques.m is
compiled with --trace minimum).
deep_profiler/callgraph.m:
Copy list.foldl from the standard library into callgraph.m and transform it
so that it is less likely to smash the stack in non tail-recursive grades.
deep_profiler/read_profile.m:
Transform read_nodes so that it is less likely to smash the stack in non
tail-recursive grades.
deep_profiler/Mercury.options:
Removed old options that where used to work around a bug. The bug still
exists but the work-around moved into the compiler long ago.
|
||
|
|
599e1c2fdb |
Implement the proc command of the deep profiler using the report mechanism.
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. |
||
|
|
c262737998 |
Include call sequence numbers in the pages generated by the deep profiler
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. |
||
|
|
119ad537ae |
Rename some function symbols to avoid ambiguities.
Estimated hours taken: 0.1 Branches: main deep_profiler/*.m: Rename some function symbols to avoid ambiguities. |
||
|
|
a9a2825ace |
Replace __ with . as the module qualifier everywhere in all the modules
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. |
||
|
|
2c686ea193 |
Convert the rest of the deep profiler to four-space indentation.
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. |
||
|
|
4083fe5bf2 |
Cleanup the deep profiler.
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. |
||
|
|
69d84ff1bb |
Import only one module per line. Misc other updates to bring these
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. |
||
|
|
3c82dc3867 |
Switch to using state variable notation where this is beneficial.
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. |
||
|
|
e86057942c |
Apply Zoltan's deep profiler changes to the main branch.
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. |
||
|
|
a9fed43d57 |
Major enhancements of the deep profiler. The most important ones are:
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. |
||
|
|
14c51160c9 |
Add file I forgot to CVS add earlier.
Estimated hours taken: 0.1 Branches: main deep_profiler/callgraph.m: Add file I forgot to CVS add earlier. |