trace/mercury_trace_cmd_browsing.c:
The "level" command was documented to reset the current ancestor level
to the level of the current event (ancestor level 0) when invoked
without arguments, but when invoked that way, it reported an error
instead. Fix this.
tests/debugger/queens_rep.inp:
tests/debugger/queens_rep.exp:
Add a test for the fix in this existing test case.
Replace __ with . as the module qualifier symbol.
Replace references to io.state with just io.
Replace DCGs with state variables.
Replace (C->T;E) syntax for if-then-elses with (if C then T else E) syntax.
Replace if-then-elses with switches when possible and where this does not
affect what is being tested.
Replace separate pred and mode declarations with predmode declarations.
Put predicate and function declarations just before the definition
of the predicate or function.
Delete unneeded module qualifications on predicate and function declarations
and definitions.
Update .exp files (and if needed, .inp files) for the line number changes
that result from the above.
For tests that have more than one .exp file and where one of those files
is affected by the above, add a section to the source file header that says
which .exp file is for what grade, with XXXs for the (as yet) unknown parts.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
Estimated hours taken: 20
Branches: main
Fix several performance bugs that showed up when the compiler was invoked on
Douglas Auclair's training_cars example. Also fix some minor problems that
made it harder to find the information needed to localize those problems.
training_cars.m is hard to compile quickly because it is big in two dimensions:
it has lots of clauses, and each clause has big terms.
My laptop still tries to swap itself to death on the full version of
training_cars.m (it has only 512 Mb), but the compiler now works fine
on a version containing about 20% of its clauses, whereas previously
it couldn't compile it at all.
In most cases, the changes convert N^2 algorithms to NlogN algorithms.
They probably have higher constant factors and may yield small slowdowns
for small N, but this is probably not noticeable. Avoiding bad worst case
behavior is more important.
compiler/superhomogeneous.m:
Record the number of goals inserted in each goal being converted
to superhomogeneous form. If this exceeds a threshold, wrap a
from_ground_term scope around it.
Put the predicates into a more cohesive sequence.
compiler/field_access.m:
Work with the code in superhomogeneous to record the number of inserted
goals. Reorder the arguments of some performances to be consistent
with the predicates in superhomogeneous.m.
compiler/modes.m:
Use the from_ground_term scope to reverse the list of inserted
unifications if necessary. It is much more efficient to do this here
than to let it happen by sequences of delays and wakeups. That would
have quadratic complexity; this is linear.
This is what I originally introduced from_ground_term scopes for.
Then, the overhead was too high, because I added one scope per function
symbol. This version should be fine, since there is at most one scope
added per argument of an atom (clause head or call).
compiler/modes.m:
compiler/unique_modes.m:
When we are processing goals inside a from_ground_term scope, record
this fact.
compiler/mode_info.m:
Make it possible to record this fact.
compiler/modecheck_unify.m:
When we are inside a from_ground_term scope, don't try to update the
insts of vars on the right hand sides of construction unifications.
Since these variables came from expansion to superhomogeneous form,
those variables won't occur in any following code, so updating their
state is useless, and the algorithm we used to do so is linear in the
size of the inst. Since the size of an inst of a variable that results
from superhomogeneous expansion is itself on average proportional to
the size of the original term, this change turns a quadratic algorithm
into a linear one.
compiler/inst_match.m:
Use balanced trees instead of ordered lists to represents sets of
expansions, since these sets can be large.
Note an opportunity for further improvement.
compiler/inst_util.m:
Note another opportunity for further improvement.
compiler/instmap.m:
Rename several predicates to avoid ambiguities.
compiler/cse_detection.m:
We used to print statistics for the processing of each procedure
without saying which procedure it is for; fix this.
compiler/switch_detection.m:
Don't print progress messages for predicates with no procedures,
since they would be misleading.
compiler/higher_order.m:
Change an algorithm that was quadratic in the number of arms
for merging the information from the different arms of disjunctions
and switches to an NlogN algorithm.
Change the algorithm for merging the info from two branches
that quadratic in the number of variables per arm to an NlogN
algorithm.
Changed some type equivalences to notag types to aid robustness.
compiler/quantification.m:
Rename several predicates to avoid ambiguities.
The sets of variables in different arms of disjunctions and switches
tend to have relatively small intersections. Yet the algorithms we
used to compute the set of variables free in the disjunction or switch
included the variables from the already processed arms in the sets
being accumulated when processing later arms, leading to the quadratic
behavior. This diff changes the algorithm to process each arm
independently, and then use a more balanced algorithm to summarize
the result.
Specialize the predicates that compute sets of free vars in various
HLDS fragments to work either with ordinary_nonlocals or
code_gen_nonlocals without making the same decision repeatedly.
Move some code out of large predicates into predicates of their own.
compiler/Mercury.options:
Specify the compiler option that can exploit this specialization
to make the code run faster.
compiler/simplify.m:
Use a more efficient data structure for recording the parameters
of an invocation of simplification.
Change some predicate names and function symbol names to avoid
ambiguity.
compiler/common.m:
compiler/deforest.m:
compiler/deforest.m:
compiler/make_hlds_warn.m:
compiler/mercury_compile.m:
compiler/pd_util.m:
compiler/stack_opt.m:
compiler/term_constr_build.m:
Conform to the changes in simplify.m and/or instmap.m.
compiler/mercury_compile.m:
Fix a bug in progress messages for polymorphism.m.
compiler/equiv_type_hlds.m:
Most of the time, substitutions inside insts have no effect, because
very few insts include any reference to a types. Instead of the old
approach of building new insts and then throwing them away if they
are the same as the old ones, don't build new insts at all if the
old inst contains no types.
compiler/common.m:
Change some predicate names to make them clearer.
compiler/hlds_clauses.m:
Record the number of clauses so far, to allow a more informative
progress message to be printed.
compiler/add_clause.m:
Print this more informative progress message.
Conform to the changes in superhomogeneous.m.
compiler/code_gen.m:
Use the context of the predicate's first clause (which will be the
context of the first clause head) as the context of the predicate's
interface events. Unlike the context of the body goal, this won't
be affected by program transformations such as wrapping a
from_ground_term scope around some goals. It is better for users
anyway, since the old policy lead to contexts in the middle of
procedure bodies if the top level goal was a disjunction, switch or
if-then-else.
tests/debugger/*.exp:
Update the expected outputs to conform to the change to code_gen.m.
Estimated hours taken: 14
Branches: main
Change the compiler and tools so that `.' and not `:' is now used as the
module separator in all output.
Infix `.' now has associativity yfx and priority 10.
NEWS:
Report the change.
configure.in:
Amend the test for an up-to-date Mercury compiler to check whether
it recognises `.' as a module qualifier.
compiler/code_gen.m:
compiler/error_util.m:
compiler/hlds_out.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rl_exprn.m:
compiler/rl_gen.m:
compiler/source_file_map.m:
compiler/unused_args.m:
library/io.m:
library/rtti_implementation.m:
library/type_desc.m:
runtime/mercury_debug.c:
runtime/mercury_deconstruct.c:
runtime/mercury_stack_trace.c:
Change `:' to `.' as module separator for output.
compiler/mercury_to_mercury.m:
compiler/prog_io_typeclass.m:
As above.
Fixed a bug where `.' was not being recognised as a module separator.
doc/reference_manual.texi:
Report the change.
library/term_io.m:
Ensure that infix `.' is written without surrounding spaces.
tests/hard_coded/dot_separator.m:
tests/hard_coded/dot_separator.exp:
tests/hard_coded/Mmakefile:
Test case added.
Estimated hours taken: 1.5
Branches: main
Change the declarative debugger so it always prints syntactically
correct goals.
browser/declarative_user.m:
Print atoms using browse__print_synthetic. This means that goals
will always be syntactically correct, even if they are printed
in the multi-line form.
Make the predicates write_decl{_init,_final,}_atom take an argument
of type browse_caller_type. When printing a single goal use the
caller type "print", and when printing a sequence of goals use
"print_all".
browser/browse.m:
When writing out a synthetic term using io__write_univ, check for
arguments with type util__unbound. Print such values as a single
unquoted underscore (io__write_univ would print an underscore in
single quotes, which means something different).
browser/util.m:
Export functions is_predicate and is_function to convert values of
type pred_or_func to values of type bool.
tests/debugger/print_goal.exp:
tests/debugger/queens_rep.exp:
Update the output of these tests after the change to browse.m.
tests/debugger/declarative/app.exp:
tests/debugger/declarative/app.exp2:
tests/debugger/declarative/filter.exp:
tests/debugger/declarative/filter.exp2:
tests/debugger/declarative/input_term_dep.exp:
tests/debugger/declarative/input_term_dep.exp2:
tests/debugger/declarative/output_term_dep.exp:
tests/debugger/declarative/output_term_dep.exp2:
tests/debugger/declarative/queens.exp:
tests/debugger/declarative/tabled_read_decl.exp:
tests/debugger/declarative/tabled_read_decl.exp2:
Update the output of these test cases.
Estimated hours taken: 2
Branches: main
Fix a bug that caused an abort at certain events in the debugger.
runtime/mercury_stack_layout.h:
Change the name of the MR_exec_max_var_num field to
MR_exec_max_named_var_num, as this better reflects its contents.
trace/mercury_trace_vars.c:
If a var has a number beyond the value of MR_exec_max_named_var_num,
do not abort; instead, ignore the variable because it is unnamed
(and therefore of no interest to the user).
tests/debugger/queens_rep.{m,inp,exp}:
New text case to confirm the lack of abort.
tests/debugger/Mmakefile:
Enable the new test case.