mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 05:13:48 +00:00
083d376e6598628362ee91c2da170febd83590f4
21 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
41d133b8ad |
Update the "no export" criteria and message.
compiler/check_module_interface.m:
Generate a "this module does not export anything" warning for modules
that contain only single include_module declaration, since such modules
could be deleted with no effect.
Change the warning message to list every kind of declaration/definition
that does not depend on the presence of other kinds of declarations or
definitions.
deep_profiler/Mercury.options:
Shut up this warning for mdprof_fb, since right now, it contains
only a single include_module, even it is designed to later contain more.
tests/invalid/empty_interface.err_exp:
tests/invalid/typeclass_missing_det_3.err_exp:
tests/invalid_nodepend/bigtest.err_exp:
tests/invalid_nodepend/duplicate_modes.err_exp:
tests/invalid_nodepend/errors2.err_exp:
tests/invalid_nodepend/no_exports.err_exp:
tests/invalid_nodepend/prog_io_erroneous.err_exp:
tests/invalid_nodepend/typeclass_test_11.err_exp:
tests/invalid_nodepend/vars_in_wrong_places.err_exp:
Expect the updated wording of the warning message.
|
||
|
|
943220205d |
Avoid using unknown formats.
deep_profiler/measurement_units.m:
When writing out floats with given numbers of decimal places
after the dot, use fixed format strings that the compiler can check.
deep_profiler/Mercury.options:
Stop specifying --no-warn-unknown-format-calls for measurement_units.m.
deep_profiler/display.m:
deep_profiler/display_report.m:
Conform to the change in measurement_units.m.
deep_profiler/html_format.m:
Style fix.
|
||
|
|
58d29651c1 |
Warn about unknown format strings in the Mercury system.
*/*_FLAGS.in:
Specify that by default, the compiler should generate warnings
for unknown format strings and bad known format strings.
*/Mercury.options:
Override this default setting for a few modules that have legitimate
reasons for calling e.g. string.format with unknown format strings.
compiler/fact_table.m:
deep_profiler/html_format.m:
Minor changes to avoid calling string.format with unknown format strings.
|
||
|
|
0d7e0e98cc |
Make the interesting recursion depth for singly-recursive code 2. This has the
affect that when trying to parallelise a loop that we assume the recursive call
will execute the recursive case once followed by the base case. If this
parallelisation is optimistic, then it is optimistic to parallelise the whole
loop.
deep_profiler/mdprof_fb.automatic_parallelism.m:
As above.
Track the containing goal map for a procedure's implicit parallelism
analysis.
deep_profiler/var_use_analysis.m:
Fix the checks for module boundaries, they where placed in the wrong places.
Handle recursive var use analysis by induction.
Move the checks for unbounded recursion in this code to places that make
more sense for the new analysis by induction.
Duplicate the variable use analysis to create a specific one for computing
variable use in the recursive and base cases.
Documented this module's trace flags.
deep_profiler/measurement_utils.m:
Fix the calculation of disjuncts of probabilities.
mdbcomp/mdbcomp.goal_path.m:
Add another version of create_goal_id_array that takes a default value for
each array slot.
mdbcomp/feedback.m:
Increment feedback_version to reflect Zoltan's push goals changes.
mdbcomp/feedback.automatic_parallelism.m:
Add a note asking people to increment feedback_version if they change any
structures here.
deep_profiler/Mercury.options:
Documented var_use_analysis' trace flags.
|
||
|
|
7e7d77e23f |
Make coverage profiling data 'deep'.
The deep profiler associates measurements with their context in the call graph
modulo recursion. This has been true for all measurements except for coverage
profiling data. This patch allows coverage data to be associated with
ProcDynamic structures so that it is keyed by this context not just the static
procedure. This new behaviour is the default the old option of static coverage
profiling is still available for testing, as is no coverage profiling. Note
that, as before, coverage profiling is supported by default however coverage
points are not inserted by default.
This change will be used to measure the depth of recursion, and therefore the
average cost of recursion as well as the likely times when variables are
produced in calls for the automatic parallelisation analysis.
runtime/mercury_conf_param.h:
Create three new preprocessor macros:
MR_DEEP_PROFILING_COVERAGE - defined when coverage profiling is
enabled.
MR_DEEP_PROFILING_COVERAGE_STATIC - defined when static coverage
profiling is being used.
MR_DEEP_PROFILING_COVERAGE_DYNAMIC - defined when dynamic coverage
profiling is being used.
runtime/mercury_deep_profiling.h:
Update data structures to support dynamic coverage profiling.
Use conditional compilation to allow us to test the deep profiler in three
different modes, without coverage profiling, with static coverage profiling
and with dynamic coverage profiling.
Rename MR_PROFILING_MALLOC, since it takes a type rather than a size in
bytes it should be called MR_PROFILING_NEW to conform with existing malloc
and new functions.
runtime/mercury_deep_profiling.c:
Avoid a C compiler warning.
MR_write_out_coverage_point has been removed, it's replaced with:
MR_write_out_coverage_points_static and
MR_write_out_coverage_points_dynamic.
These write out more than one coverage point and write out either static or
dynamic coverage points.
Write a 64bit flags value (a bitfield) to the header of the Deep.data file.
This replaces the canonical byte (with a bit). and the byte that describes
the word size. This value also includes two bits describing the whether no
coverage data, static coverage data or dynamic coverage data is present in
the file. A bit is reserved ti indicate if the data is compressed (which
is not yet supported).
MR_write_fixed_size_int now writes out 8 byte integers, this is only used
for some counts present at the beginning of the data file along with the
new flags value. It now takes a MR_uint_least64_t integer as it's
parameter. The assertion to test for negative numbers has been removed
since this type is unsigned.
Increment the Deep.data file format version number.
compiler/layout_out.m:
Conditionally compile the NULL pointer that represents the coverage points
list in proc statics. This is conditional on the
MR_DEEP_PROFILING_COVERAGE_STATIC macro being defined.
compiler/coverage_profiling.m:
Add support for generating dynamic coverage points.
compiler/options.m:
compiler/handle_options.m:
Implement the new developer options for controlling coverage profiling.
library/profiling_builtin.m:
Specialize increment_coverage_point_count for both static and dynamic
coverage profiling. This creates
increment_{static,dynamic}_coverage_point_count.
deep_profiler/profile.m:
Add an extra field to profile_stats, this tracks whether the file reader
should try to read none, static or dynamic coverage data.
Add an extra field to proc_dynamic, An array of coverage counts wrapped by
a maybe type. It's indexed the same as the array of coverage infos in
proc_static. This array is present if dynamic coverage profiling is being
done (the default).
Modify the coverage_points field in proc static, now there are two fields,
an array of coverage_point_info values which store compile-time data. And
an optional array of coverage points (present if static coverage profiling
was performed).
Updated the formatting of the proc static structure.
Moved the coverage_point type to coverage.m.
Created a new type, coverage_data_type which enumerates the possibilities
for coverage profiling: none, static and dynamic.
deep_profiler/coverage.m:
Move the coverage point type here from profile.m, as the profile data
structure no longer refers to it directly.
Create a predicate coverage_point_arrays_to_list/3 which merges coverage
point information and the counts themselves into coverage points. This can
be used to construct a list of coverage points regardless of whether static
or dynamic coverage points are being used.
deep_profiler/read_profile.m:
Conform to changes in runtime/mercury_deep_profiling.c.
Refactored reading of the file header, a new named predicate is now used
rather than a lambda expression.
Incremented the Deep.data version number.
deep_profiler/report.m:
Updated the proc dynamic dump report structure to include a list of
coverage points.
deep_profiler/create_report.m:
deep_profiler/display_report.m:
Conform to changes in profile.m.
The proc dynamic dump now shows coverage information that was contained in
that proc dynamic.
deep_profiler/canonical.m:
deep_profiler/dump.m:
Conform to changes in profile.m.
deep_profiler/io_combinator.m:
Add a 13-arg version of maybe_error_sequence.
deep_profiler/Mercury.options:
Documented another trace flag.
|
||
|
|
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.
|
||
|
|
531c2d94ea |
Automatic Parallelisation Improvements.
Factor in all the costs of parallelistion into the parallel overlap estimation
algorithm. Previously only some costs where being taken into consideration.
Independent parallelsations are now generally preferred as they have fewer
overheads for similar parallelsations.
Generalised the branch and bound search algorithm into a new Mercury module.
mdbcomp/feedback.m:
Grouped candidate parallel conjunction parameters into a single type.
Added extra parameters:
future_signal_cost
future_wait_cost
context_wakeup_delay.
The first two replace locking cost, they are the costs of the signal and
wait calls for futures respectively. The third represents the length of
time for a context to begin executing after it has been placed on the run
queue. It is used to estimate the cost of blocking.
Refactored the parallel_exec_metrics type to make representing overheads easier.
Modify parallel_exec_metrics so that it can represent the cost of calling
signal in the left conjunct of any conjunct pair.
Modify parallel_exec_metrics so that it stores the parallel execution time
of the initial (leftmost) conjunct. This is necessary as the parallel
execution time includes the cost of the 'fork' call of the next conjunct.
Modify parallel_exec_metrics to record the cost of blocking for the
leftmost conjunct if it completes before the parallel conjunction completes
as a whole.
Increment the feedback file format version number.
compiler/implicit_parallelism.m:
Conform to changes in mdbcomp/feedback.m.
deep_profiler/branch_and_bound.m:
A generic branch and bound solver loop and utilities.
The modified branch and bound code includes a profiling facility.
deep_profiler/Mercury.options:
The new branch_and_bound module supports the debug_branch_and_bound trace
flag.
deep_profiler/mdprof_fb.automatic_parallelism.m:
Generalise and move branch and bound code to branch_and_bound.m
Removed the candidate_parallel_conjunctions_opts type, we now use the
candidate_par_conjunctions_params type in its place.
Modify the code for parallelising conjunctions so that it works with lists
of goals rather than cords of goals.
Factor out the code tha looks for the next costly call, this is now handled
by a preprocessing pass so that it has linear time rather than increasing
the complexity of the search code.
Documented some predicates in more detail.
deep_profiler/mdprof_feedback.m:
Conform to changes in deep_profiler/mdprof_fb.automatic_parallelism.m and
mdbcomp/feedback.m
Add command line support for the new candidate parallel conjunctions
feedback parameters.
|
||
|
|
455f87ba38 |
Automatic parallelisation improvements.
The automatic parallelisation analysis now searches for the best way to
parallelise a conjunction when it's deciding if parallelisation is worth-while.
This mostly affects unifications and other cheap goals between two calls being
parallelised; it decides which parallel conjunct each of these goals should be
placed in. The search used is a branch and bound search.
deep_profiler/mdprof_fb.automatic_parallelism.m:
As above,
find_costly_call now returns find_costly_call_result rather than using the
maybe type. Instantiation sub-typing is used to guarantee that the goal
returned is indeed a costly call.
Fix a bug in calculate_dependant_parallel_cost.
When printing the candidate parallel conjunction report include the goals
before and after a parallel conjunction.
Document the debug_parallel_conjunction_speedup trace flag.
Create a new type parallelise_dep_conjs rather than using a boolean to
represent this option.
Add a new trace flag, debug_branch_and_bound enables trace goals that can
be used to debug the branch and bound search for the best parallelisation.
deep_profiler/mdprof_feedback.m:
When printing the candidate parallel conjunction report remove some
vertical whitespace after the header of the report.
deep_profiler/Mercury.options:
Add a new trace flag, debug_branch_and_bound enables trace goals that can
be used to debug the branch and bound search for the best parallelisation.
This is commented out.
mdbcomp/feedback.m:
Include the goals before and after a parallel conjunction in the
candidate_par_conjunction type.
Modify the parallel_exec_metrics code so that it can handle the cost of the
goals before and after a parallel conjunction.
Increment the feedback file format version.
When reading a feedback file strip the program name of leading and trailing
whitespace.
When printing a message for the incorrect_program_name error enclose the
program names in quotes.
Conform to changes in mdprof_fb.automatic_parallelism.m
|
||
|
|
b7f0270f36 |
Implement the new algorithm for calculating how dependant parallel conjuncts'
executions overlap. This algorithm has also been generalised to handle cases
where there are more than two conjuncts in a parallel conjunction. A number of
other improvements have also been made.
deep_profiler/mdprof_fb.automatic_parallelism.m:
Wrote dependant parallel conjunction overlap analysis algorithm (as above).
This algorithm introduced a new structure, parallel_execution_overlap.
This structure describes how dependant parallel executions overlap.
Use both sparking cost and sparking delay as costs of parallelisation.
Sparking cost is the cost from the perspective of the sparker, whereas
delay is the delay between creating the spark and actually beginning the
execution of the spark.
Handle pretty-printing of the candidate parallel conjunction structure.
Include variable identifiers as well as canonical names in the
pardgoal_type structure.
The inst_map_info structure has been modified to contain the sets of
consumed and produced variables separately, rather than simply containing a
set of all consumed and produced variables.
Improve the readability of messages printed by trace goals.
The search code no longer attempts to look up procedure bodies for code
whose module is "Mercury runtime".
Conjunctions that did not have a speedup due to parallelisation are now
printed out by a new trace goal.
deep_profiler/mdprof_feedback.m:
Include support for pretty printing the feedback information after
creating it. This is handled by the new --report command line option.
Include a new --implicit-parallelism-sparking-delay command line option.
This may be used to specify how long it takes an engine to steal a spark.
mdbcomp/feedback.m:
Export the sparking delay as part of the feedback information.
Create a new structure parallel_exec_metrics which contains many metrics
about parallel execution performance. This is exported for each candidate
parallel conjunction rather than only exporting the Speedup.
Create predicates for creating and querying the parallel_exec_metrics
structure.
Create a new predicate, get_all_feedback_data/2, this is used to retrieve
all the data for building the report in the mdprof_feedback tool.
Increment the feedback file format version number.
deep_profiler/message.m:
Improve the readability of the messages printed due to verbosity settings.
Export some predicates that can be used for managing indentation while
pretty-printing structures.
compiler/implicit_parallelism.m:
Conform to changes in feedback_data_candidate_parallel_conjunctions.
Add a pi_sparking_delay field to parallelism information.
deep_profiler/program_representation_utils.m:
Fix a bug in calc_inst_map_delta/3.
Correct a comment for inst_map_ground_vars/5.
deep_profiler/cliques.m:
Fixed a minor indentation issue.
deep_profiler/Mercury.options:
Document the new trace goal that enables printing of candidate parallel
conjunctions that do not result in a speedup.
|
||
|
|
e70295415d |
Various changes for automatic parallelism, the two major changes are:
Estimated hours taken: 20.
Branches: main
Various changes for automatic parallelism, the two major changes are:
Refactored some of the search for parallel conjunctions to use types that
describe the cost of a call site and the cost of a clique-procedure. These
new types make it harder for programmers to mistakingly compare values of
either type accidentally.
Where possible, use the body of a clique to determine the cost of recursive
calls at the top level of recursion. This improves the accuracy of this
calculation significantly.
deep_profiler/mdprof_fb.automatic_parallelism.m:
As above.
deep_profiler/measurements.m:
New cost data types as above.
deep_profiler/coverage.m:
When coverage information completeness tests fail print out the procedure
where the coverage information is incomplete.
deep_profiler/message.m:
Introduce a new warning used in the automatic parallelism analysis.
deep_profiler/profile.m:
Introduce a semidet version of deep_get_progrep_det.
mdbcomp/program_representation.m:
Introduce a predicate to return the goal_rep from inside a case_rep
structure. This can be used as higher order code to turn a case list into
a goal list for example.
deep_profiler/Mercury.options:
Keep a commented out MCFLAGS definition that can be used to enable
debugging output for the automatic parallelism analysis.
|
||
|
|
b1257cbf48 |
Search for parallelism opportunities in a clique-wise manner.
Estimated hours taken: 25
Branches: main
Search for parallelism opportunities in a clique-wise manner. Starting at the
root clique traverse expensive calls to find cliques with procedures that
should be parallelised. This has several advantages, namely it gives a simple
method for calculating an approximation of the cost of a recursive call site.
In the future it will make it easier to perform specialise parallel versions
of procedures.
deep_profiler/mdprof_feedback.m:
As above.
Create a logging facility that provides some information about the
analysis to the user, I'm using this to determine the order of features I
should implement based on the usefulness of such a feature in analysed
programs. This has necessitated changes to the command line interface.
deep_profiler/profile.m:
Introduce deep_get_progrep_det/2 to retrieve the program representation
structure from a deep structure or throw an exception.
deep_profiler/report.m:
Add more information to a comment.
mdbcomp/feedback.m:
Add more information about a structure field's semantics in the field name
and comment.
Incremented the feedback file version number.
deep_profiler/Mercury.options
Remove some old --no-warn-unused-imports flags.
|
||
|
|
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. |
||
|
|
b4c3bb1387 |
Clean up in unused module imports in the Mercury system detected
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. |
||
|
|
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. |
||
|
|
7404ab1b1b |
Put some bug workarounds back in place until the fix
deep_profiler/Mercury.options: Put some bug workarounds back in place until the fix bootstraps on all of our machines. |
||
|
|
b9ca44672b |
Fix the bugs were exposed by my pre-dummy-type-diff cleanup of polymorphism.m.
Estimated hours taken: 24
Branches: main
Fix the bugs were exposed by my pre-dummy-type-diff cleanup of polymorphism.m.
This diff deleted a "semidet_fail" in the predicate that tested whether a
foreign_proc used a variable, making the test a real test, not a dummy.
The main bugs were in unused_args.m, polymorphism.m and ml_unify_gen.m.
compiler/unused_args.m:
Fix the mismatch between the analysis and fixup passes' treatment of
foreign_procs. The analysis pass says that variables representing
unnamed foreign_proc arguments are unused, and therefore the code
generating them can be optimized away, but the fixup pass used to leave
those arguments unchanged. This is usually fine, but there was a
problem if a variable had two or more such conjoined consumers but no
other consumers. It then had its generator optimized away, but the
variable was left in the nonlocal set of each consumer, which meant
that the code generator aborted when trying to save the value of the
variable after the first consumer.
The fix is to rename unnamed foreign proc args, ensuring that they are
local to the foreign_proc they appear in. The code generators can
already handle such arguments.
compiler/typecheck.m:
Detect foreign_procs that are supposed to bind type_info variables,
but don't, and generate error messages for them. This is now necessary,
since if we accept such predicates, unused_args.m will now rename apart
the unused type_info argument, and the code generator will abort
due to the type_info missing its generator.
compiler/typecheck_errors.m:
Add a predicate for reporting the error.
compiler/goal_util.m:
Add a utility predicate and export some previously internal predicates
for use by unused_args.m.
Delete redundant module prefixes on predicate names to avoid having to
split long lines.
compiler/polymorphism.m:
Ensure that all arguments of import foreign_procs are considered used,
since our contract with foreign language code prevents us from
optimizing them away.
Redefine a predicate using the new utility predicate in goal_util.m.
compiler/pragma_c_gen.m:
Ensure that all arguments of import foreign_procs are considered used,
since our contract with foreign language code prevents us from
optimizing them away. This is a belt-and-suspenders fix: the change to
polymorphism.m should be sufficient to ensure this objective by itself.
compiler/ml_unify_gen.m:
The mark_static_terms pass was assuming that if X is a static term,
then after the assignment unification Y = X Y is also a static term.
However, when processing such assignments, the code generator here
neglected to copy over the part of the X's state that says what static
term it is to become part of Y's state. This diff fixes that neglect.
compiler/ml_code_util.m:
We used to identify MLDS variables holding static terms by a sequence
number, and then create a name from the number by tacking on the name
of the HLDS variable referring to it at each reference. This worked
because each static term was referred to by only one HLDS variable;
but after the diff to ml_unify_gen, this is no longer the case.
We therefore now construct the MLDS variable's name when the static
term is created, and use that name as the translation of all the HLDS
variables referring to that static term.
compiler/add_pragma.m:
Minor cleanup.
library/rtti_implementation.m:
library/store.m:
In some predicates that don't define type_infos for existentially typed
arguments, mention the type_info that *should* be defined there in
comments to avoid the error now generated by typecheck.m.
browser/Mercury.options:
deep_profiler/Mercury.options:
Undo the workaround for the fixed bug.
tests/existential_type_classes.m:
In predicates that don't define type_infos for existentially typed
arguments, mention the type_info that *should* be defined there in
comments to avoid the error now generated by typecheck.m.
tests/existential_type_classes.exp:
Conform to the changed line numbers in existential_type_classes.m.
tests/invalid/exist_foreign_error.{m,exp}:
New test case for the error now detected by typecheck.m.
tests/invalid/Mmakefile:
Enable the new test case.
|
||
|
|
dd95fa0538 |
Compile the deep profiler at -O0 in order to avoid assertion
deep_profiler/Mercury.options: Compile the deep profiler at -O0 in order to avoid assertion failures in the code generator when compiling with -O5 --intermodule-optimization --opt-space. This is a temporary measure which is necessary for the nightly builds on saturn, jupiter and swordfish to work. |
||
|
|
e6dbe96270 |
Avoid another assertion failure in the deep_profiler that occurs when
deep_profiler/Mercury.options: Avoid another assertion failure in the deep_profiler that occurs when compiling with -O5 --intermodule-optimization --opt-space. |
||
|
|
9c03c6425e |
Avoid an assertion failure in the deep_profiler that occurs when
deep_profiler/Mercury.options: Avoid an assertion failure in the deep_profiler that occurs when compiling with -O5 --intermodule-optimization --opt-space. |
||
|
|
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. |
||
|
|
9406f99f9d |
Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
Estimated hours taken: 5 Branches: main Allow tools/bootcheck to be run using `mmake --use-mmc-make'. The tests don't work yet. compiler/make.m: compiler/make.module_target.m: Handle targets such as `<module>.cs' and `<module>.ints', which are used when building stage 3. Mmake.common.in: */Mmakefile: */Mercury.options: Add Mercury.options files to pass module-specific flags to `mmc --make'. Avoid triggering the .DEFAULT rule introduced with `--use-mmc-make' for optional files like Mmake.params. compiler/modules.m: Build the interface files when building a library in IL grades, for consistency with C grades. library/Mmakefile: Improve performance by removing the dependency on the interface files when building the library. The files are now always built by the libmer_std target. Pass the command to build libmer_std.init to `mmc --make'. tools/bootcheck: Add an option `--use-mmc-make'. Copy the Mercury.options files into the stage2 and stage3 directories. scripts/Mmake.rules: Don't include the rules for `.dep' files with `--use-mmc-make'. Include the rule for `--convert-to-mercury' even with `--use-mmc-make'. compiler/Mmakefile: tools/bootcheck: tools/binary_step: `mmc --make' doesn't handle `<module>_init.c' targets, so don't make the `cs' target depend on `top_level_init.c'. As far as I can tell, that dependency is only present so that the stage2 and stage3 compilers have the same set of C files. bootcheck and binary_step now only compare `.c' files which are present in the stage3 directory. |