browser/declarative_analyser.m:
browser/declarative_debugger.m:
browser/declarative_oracle.m:
browser/declarative_tree.m:
browser/declarative_user.m:
browser/interactive_query.m:
browser/listing.m:
browser/parse.m:
browser/util.m:
Rename some predicates to avoid ambiguity.
Factor out common code.
If some versions of a field of a structure have names in a predicate
(by being stored in a named variable), then give all *other* versions
of that field in that structure names in that predicate as well.
If a field of a structure is used more than once in a predicate,
then again, store it in a named variable.
Reorder predicate arguments to put state variables last.
Use io.format instead of sequences of calls to io.write_string.
In declarative_user.m, note a probable bug (in a position where
it is probably rarely stumbled upon).
In listing.m, use a consistent naming scheme to differentiate
between Mercury streams and their C counterparts.
Replace if-then-else chains with switches where possible.
browser/name_mangle.m:
Note bit rot.
browser/browse.m:
Conform to the changes above.
library/io.m:
Improve predicate and variable names.
browser/mdb.m:
browser/mer_browser.m:
browser/percent_encoding.m:
browser/term_rep.m:
browser/tree234_cc.m:
library/library.m:
Improve comments.
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_oracle.m:
browser/declarative_user.m:
browser/diff.m:
browser/help.m:
browser/interactive_query.m:
browser/parse.m:
browser/util.m:
Replace implicit streams with explicit streams.
Shorten lines longer than 79 chars.
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.
In some places, change predicate names that were not meaningful
without module qualification by *including* the module qualification
in the name (e.g. init -> browser_info_init).
In some places, add XXXs.
In browser_info.m, make the output stream *part* of the debugger type,
because without this, having the debugger type belong to the stream
typeclass does NOT make sense. (The typeclass instance for debugger
used to always write to the current output stream, which this diff
is replacing with the use of explicitly specified streams.)
In browse.m, consistently put stream arguments before other arguments.
In browse.m, when exporting Mercury predicates to C, export them
under names with the standard ML_BROWSE_ prefix, NOT under the name
of a *different* predicate with that prefix.
In diff.m, eliminate an unnecessary difference between what we print
when the difference between two terms is at the root, vs what we print
when the difference between two terms is lower down.
In interactive_query.m, when trying to write a program out to a file,
do NOT write the program to the current output stream if we cannot open
the file, since that would accomplish nothing useful.
Also in interactive_query.m, cleanup .dylib instead of .so on MacOS.
In util.m, delete some unused predicates.
In collect_lib.m, document why some code is not worth updating.
In declarative_oracle.m, rename predicates with previously-ambiguous
names.
browser/MDBFLAGS.in:
Specify --warn-implicit-stream-calls for all Mercury modules
in the browser directory from now.
trace/mercury_trace_browse.c:
trace/mercury_trace_cmd_browsing.c:
ssdb/ssdb.m:
Conform to the changes in browser/*.m.
tests/debugger/queens.{exp,exp2}:
Expect the extra output from browser/diff.m.
browser/util.m:
compiler/equiv_type_hlds.m:
compiler/inst_test.m:
library/construct.m:
library/io.m:
Ensure output variables are initialised in all code paths.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
Packages are modules whose only job is to serve as a container for submodules.
Modules like top_level.m, hlds.m, parse_tree.m and ll_backend.m are packages
in this (informal) sense.
Besides the include_module declarations for their submodules, most of the
packages in the compiler used to import some modules, mostly other packages
whose component modules their submodules may need. For example, ll_backend.m
used to import parse_tree.m. This meant that modules in the ll_backend package
did not have to import parse_tree.m before importing modules in the parse_tree
package.
However, this had a price. When we add a new module to the parse_tree package,
parse_tree.int would change, and this would require the recompilation of ALL
the modules in the ll_backend package, even the ones that did NOT import ANY
of the modules in the parse_tree package.
This happened even at one remove. Pretty much all modules in every one
of the backend have to import one or more modules in the hlds package,
and they therefore have import hlds.m. Since hlds.m imported transform_hlds.m,
any addition of a new middle pass to the transform_hlds package required
the recompilation of all backend modules, even in the usual case of the two
having nothing to do with each other.
This diff removes all import_module declarations from the packages,
and replaces them with import_module declarations in the modules that need
them. This includes only a SUBSET of their child modules and of the non-child
modules that import them.
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.
Branches: 11.07, main
Improve and update documentation of the MSVC port.
Add batch files for invoking mdb and mprof; avoid problem with mercury.bat.
README.MS-VisualC:
Rewrite this file, it was very much out-of-date.
The major changes are:
+ we now describe how to set up a Cygwin or MSYS shell
with MSVC available.
+ the source distribution now works with MSVC.
+ a list of the limitations of the MSVC port has been added.
+ a description of how to set up the compiler so that it
works from the Windows command prompt has been added.
scripts/mercury/mercury.bat.in:
Delete support for the MERCURY_COMPILER and MERCURY_CONFIG_DIR
enviorment variables; the handling of them in this batch file
doesn't appear to be portable across different versions of
Windows and it's more important that this file work in the
normal case. (Keeping it simple is the way to ensure this.)
scripts/mdb.bat.in:
scripts/mprof.bat.in:
Templates for invoking mdb and mprof on Windows.
(I'm not sure how to reproduce all the functionality of the mdb
script in a batch file, so the command line options provided by
the mdb script aren't currently replicated here.)
configure.in:
scripts/Mmakefile:
Add the new batch files.
scripts/Mercury.config.in:
Use the Windows-style installation prefix on Cygwin systems.
browser/util.m:
Use the conventional name for the I/O state.
Use don't-care variables for the I/O state in foreign procs.
This avoids suprious warnings from MSVC.
Branches: main, 11.07
Fix the decldebug grades with MSVC.
(XXX Most of the system can now be built in none.gc.decldebug with MSVC
except for the deep profiler; the Windows header files #define interface
and this stuffs up compilation of deep_profiler/interface.m.)
compiler/layout_out.
Avoid declarations for layout structures that contain incomplete
types. MSVC treats them as erroneous definitions rather than
declarations. Use the existing mechanism we have in the LLDS
backend for doing this, the MR_STATIC_LINKAGE macro.
Replace my earlier fix or alloc_sites arrays with the
above as well.
library/thread.semaphore.m:
browser/declarative_debugger.m:
browser/util.m:
Use don't care variables for the I/O state in more
foreign procs in order to avoid warnings from MSVC.
Branches: main, 10.04
ssdebug enhancements.
ssdb/ssdb.m:
Make `print' (no arguments) print the goal, like mdb, instead of
printing all variables.
Make `print *' print all variables. Add `P' as an alias.
Use browser to print terms.
Add `format' and `format_param' commands to set browser parameters.
Support browsing the goal term with `browse' (no argument).
Add `return', `level' and `current' commands.
Support an optional line limit for the `stack' command.
Support compressing duplicate stack frames in stack traces.
Support an integer argument to `step' command.
Treat a bare integer as a `step N' command.
Support `quit -y' option.
browser/browse.m:
browser/util.m:
trace/mercury_trace_vars.c:
Move definition of type `unbound' to a public module.
README.ssdebug:
Note down two more limitations.
Branches: main, 10.04
browser/util.m:
Implement fallback versions of `call_trace_getline' and
`trace_get_command' for non-C grades.
ssdb/ssdb.m:
Support `browse N' command, where N is a variable number.
Estimated hours taken: 0.1
Branches: main
Fix the nightly builds. The namespace cleanliness check in the
browser directory was failing.
browser/util.m:
Add a missing `ML_' prefix.
Estimated hours taken: 120
Branches: main
There are some modification for the nondet transformation. When a retry of a
nondet procedure A is asked during the execution of the program, a choicepoint
is left behind and the execution start the retry on procedure B. When the retry
on B is finished, the compiler come back at the choicepoint and finish the call
of the procedure A. This give a wrong number of event.
The proposed solution is: when a retry is asked in a nondet procedure named A
at an exit port, the debugger do not execute any operation until it reach the
fail of the procedure A. It is only at this moment that the execution of B
begin.
If user use a predicate like solutions.unsorted_solutions, he will obtain more
than one time the same solution. The use of solutions is right because it
remove the duplicates
Determinism failure tranformed:
% detism_failure:
%
% p(...) :-
% promise_<original_purity> (
% (
% CallVarDescs = [ ... ],
% impure call_port(ProcId, CallVarDescs),
% <original body>
% ;
% % preserve_backtrack_into
% impure fail_port(ProcId, CallVarDescs, DoRetry),
% (
% DoRetry = do_retry,
% p(...)
% ;
% DoRetry = do_not_retry,
% fail
% )
% )
% ).
Determinism erroneous transformed:
% p(...) :-
% promise_<original_purity> (
% (
% CallVarDescs = [ ... ],
% impure call_port(ProcId, CallVarDescs),
% <original body>,
% )
% ).
analysis/Mmakefile:
Delete the LINK_STDLIB_ONLY=yes line as we need to link with the
libmer_ssdb if source-to-source debugging is enabled.
browser/util.m:
At the browser prompt, use io.read_line_as_string instead of
functions in the trace library to read input if the trace library is
not linked in.
compiler/mercury_compile.m:
Move the ssdb transformation to after the higher order specialisation
pass to work around a compiler abort. The higher order specialisation
removes predicates which are used to "force the production of
user-requested type specializations, since they are not called from
anywhere and are no longer needed". Let `p' be such a procedure, and
the specialised version be `p1'. Then remove `p'. But due to the ssdb
transformation, `p1' will contain a call to `p', in order to support
retry.
I'm not sure where the ssdb transform should go. I assume as early as
possible.
compiler/ssdebug.m:
- Transform procedures with `failure' and `erroneous' determinisms.
- Funny modes are not managed
I think we can and should handle `unused' arguments as well, but
later.
profiler/Mmakefile:
Link with the mer_ssdb library.
ssdb/Mercury.options:
Link with the mer_browser library to support browsing of terms.
ssdb/ssdb.m:
- 4 new event for the nondet procedure are now use. They are :
ssdb_call_nondet, ssdb_exit_nondet, ssdb_fail_nondet,
and ssdb_redo_nondet. In the same way, an different event handler
has been created to managed each of them.
The ssdb_redo event was no more useful.
- The old structure debugger_state has been divided in different
mutable variables to allow more flexibility.
- The old breakpoint list are now a map with (module_name, pred_name)
as key and the breakpoint structure as value.
- The depth is now compute with the stack depth, it is easier to manage
and more flexible.
- Some new command have been added: delete/enable/disable breakpoint,
break info, finish N, retry N, browse X
deep_profiler/DEEP_FLAGS.in:
deep_profiler/.mgnuc_copts:
deep_profiler/Mmakefile:
tests/.mgnuc_copts.ws:
tests/WS_FLAGS.ws:
Search in the ssdb directory for files.
analysis/Mmakefile:
browser/util.m:
compiler/mercury_compile.m:
compiler/ssdebug.m:
library/private_builtin.m:
profiler/Mmakefile:
ssdb/Mercury.options:
ssdb/ssdb.m:
tests/.mgnuc_copts.ws:
tests/WS_FLAGS.ws:
Back out Olivier's last change; it broke the compiler.
Estimated hours taken: 1
Branches: main
Final release of version 1 of the ssdb.
analysis/Mmakefile:
browser/util.m:
compiler/mercury_compile.m:
compiler/ssdebug.m:
library/private_builtin.m:
profiler/Mmakefile:
ssdb/Mercury.options:
ssdb/SSDB_FLAGS.in:
ssdb/ssdb.m:
tests/.mgnuc_copts.ws:
tests/WS_FLAGS.ws:
Estimated hours taken: 12
Branches: main
Fix a bug that caused bootchecks with --optimize-constructor-last-call to fail.
The problem was not in lco.m, but in follow_code.m. In some cases,
(specifically, the LCMC version of insert_2 in sparse_bitset.m),
follow_code.m moved an impure goal (store_at_ref) into the arms of an
if-then-else without marking those arms, or the if-then-else, as impure.
The next pass, simplify, then deleted the entire if-then-else, since it
had no outputs. (The store_at_ref that originally appeared after the
if-then-else was the only consumer of its only output.)
The fix is to get follow_code.m to make branched control structures such as
if-then-elses, as well as their arms, semipure or impure if a goal being moved
into them is semipure or impure, or if they came from an semipure or impure
conjunction.
Improve the optimization of the LCMC version of sparse_bitset.insert_2, which
had a foreign_proc invocation of bits_per_int in it: replace such invocations
with a unification of the bits_per_int constant if not cross compiling.
Add a new option, --optimize-constructor-last-call-null. When set, LCMC will
assign NULLs to the fields not yet filled in, to avoid any junk happens to be
there from being followed by the garbage collector's mark phase.
This diff also makes several other changes that helped me to track down
the bug above.
compiler/follow_code.m:
Make the fix described above.
Delete all the provisions for --prev-code; it won't be implemented.
Don't export a predicate that is not now used anywhere else.
compiler/simplify.m:
Make the optimization described above.
compiler/lco.m:
Make sure that the LCMC specialized procedure is a predicate, not a
function: having a function with the mode LCMC_insert_2(in, in) = in
looks wrong.
To avoid name collisions when a function and a predicate with the same
name and arity have LCMC applied to them, include the predicate vs
function status of the original procedure included in the name of the
new procedure.
Update the sym_name of calls to LCMC variants, not just the pred_id,
because without that, the HLDS dump looks misleading.
compiler/pred_table.m:
Don't have optimizations like LCMC insert new predicates at the front
of the list of predicates. Maintain the list of predicates in the
module as a two part list, to allow efficient addition of new pred_ids
at the (logical) end without using O(N^2) algorithms. Having predicates
in chronological order makes it easier to look at HLDS dumps and
.c files.
compiler/hlds_module.m:
Make module_info_predids return a module_info that is physically
updated though logically unchanged.
compiler/options.m:
Add --optimize-constructor-last-call-null.
Make the options --dump-hlds-pred-id, --debug-opt-pred-id and
--debug-opt-pred-name into accumulating options, to allow the user
to specify more than one predicate to be dumped (e.g. insert_2 and
its LCMC variant).
Delete --prev-code.
doc/user_guide.texi:
Document the changes in options.m.
compiler/code_info.m:
Record the value of --optimize-constructor-last-call-null in the
code_info, to avoid lookup at every cell construction.
compiler/unify_gen.m:
compiler/var_locn.m:
When deciding whether a cell can be static or not, make sure that
we never make static a cell that has some fields initialized with
dummy zeros, to be filled in for real later.
compiler/hlds_out.m:
For goals that are semipure or impure, note this fact. This info was
lost when I changed the representation of impurity from markers to a
field.
mdbcomp/prim_data.m:
Rename some ambiguous function symbols.
compiler/intermod.m:
compiler/trans_opt.m:
Rename the main predicates (and some function symbols) of these modules
to avoid ambiguity and to make them more expressive.
compiler/llds.m:
Don't print line numbers for foreign_code fragments if the user has
specified --no-line-numbers.
compiler/make.dependencies.m:
compiler/mercury_to_mercury.m:
compiler/recompilation.usage.m:
Don't use io.write to write out information to files we may need to
parse again, because this is vulnerable to changes to the names of
function symbols (e.g. the one to mdbcomp/prim_data.m).
The compiler still contains some uses of io.write, but they are
for debugging. I added an item to the todo list of the one exception,
ilasm.m.
compiler/recompilation.m:
Rename a misleading function symbol name.
compiler/parse_tree.m:
Don't import recompilation.m here. It is not needed (all the components
of parse_tree that need recompilation.m already import it themselves),
and deleting the import avoids recompiling almost everything when
recompilation.m changes.
compiler/*.m:
Conform to the changes above.
compiler/*.m:
browser/*.m:
slice/*.m:
Conform to the change to mdbcomp.
library/sparse_bitset.m:
Use some better variable names.
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: 2
Branches: main
browser/*.m:
Replace __ with . as the module qualifier everywhere in all the modules
of the browser directory. Convert the currently tab-indented modules
to four-space indentation. Delete some unnecessary module
qualifications. Change some type names and function symbols to avoid
ambiguities. Replace a bunch of uses of DCGs with state variable
notation.
Estimated hours taken: 30
Branches: main
Use dicing information in the declarative debugger. Each label in the program
is assigned a suspicion based on a supplied dice. A new search mode then
performs divide and query using the total suspicion of a subtree as the
weighting of the subtree.
browser/declarative_analyser.m:
Parameterize the divide and query search mode by allowing it to work
with an arbitrary weighting heuristic.
Support two weighting heuristics: number of events and suspicion.
Since there is still only one weight field for each suspect,
if the weighting heuristic changes, then update all the weights of all
the suspects.
Return a different reason for asking a divide and query question,
depending on the weighting heuristic.
Some information (specifically how many suspect events remain and
the estimated number of questions remaining for divide and query)
returned by the info command depends on the current weighting heuristic
being the number of events. If the current weighting heuristic is not
the number of events then do not show this information.
browser/declarative_debugger.m:
Pass the trace node store to set_fallback_search_mode so that the
weights can be recalculated if the search strategy changes.
browser/declarative_edt.m:
In the mercury_edt typeclass, rename the edt_weight method to
edt_number_of_events and add a new method edt_subtree_suspicion.
The weight field of each suspect in the search space can either
be based on suspicion or number of events.
Add a field to the search_space type to determine which weighting
heuristic to use. Export predicates to get and set the current
weighting heuristic being used. If the weighting heuristic
changes the recalculate the weights of all the suspects.
When calculating the weight of a suspect use the current weighting
heuristic.
browser/declarative_execution.m:
Record a suspicion accumulator at each interface event which
can be used to calculate the suspicion of a subtree in the EDT.
Move the label_layout and proc_layout types as well as all utility
predicates for those types to a new module, mdbcomp.label_layout.
browser/declarative_oracle.m:
browser/declarative_user.m:
browser/debugger_interface.m:
Import mdbcomp.label_layout.
browser/declarative_tree.m:
Adjust for the extra field in interface nodes in the annotated trace.
Look at the weighting heuristic when calculating the weight of a
subtree.
browser/util.m:
mdbcomp/program_representation.m:
Move goal_path_string to mdbcomp.program_representation since
it is needed in mdbcomp.label_layout.
doc/user_guide.texi:
Document the new search mode.
mdbcomp/label_layout.m:
This module contains the types label_layout and proc_layout and
supporting predicates which were in mdb.declarative_execution.
These types are needed in the mdbcomp.slice_and_dice module.
mdbcomp/mdbcomp.m:
Include label_layout.
mdbcomp/slice_and_dice.m:
Add functions for calculating different suspicion formulas. The
intention is to experiment with different formulas in the future.
Export predicates for reading a dice from the C backend.
Export a predicate for retrieving the suspicion of a label
given a dice. This predicate uses the suspicion_ratio_binary
formula, since that seems most effective in my (as yet very limited)
experience. I will implement better ways to control and customise
the formula used in the future.
mdbcomp/trace_counts.m:
Add a function for constructing a path_port given a goal path and
a trace port.
If there is an unexpected exception when reading a trace counts
file then print the unexpected exception.
Add a predicate to convert trace count file types to a string and
vica versa.
runtime/mercury_stack_layout.h:
Fix a typo.
runtime/mercury_trace_base.c:
runtime/mercury_trace_base.h:
Export a function to look up the trace count slot for a label.
Use this function when recording trace counts.
This function will also be used in the declarative debugger backend to
look up suspicions for labels.
Add a function to initialise the array which records which ports
need a goal path to uniquely identifiy the label.
Initially I used this array elsewhere which is why I exported it.
I didn't actually end up needing to use it in the final version,
but I'm still exporting it, since it might be useful in the future.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/dice.exp:
tests/debugger/declarative/dice.inp:
tests/debugger/declarative/dice.m:
Test the new search mode.
tests/debugger/declarative/info.exp:
tests/debugger/declarative/change_search.exp:
The weigting heuristic is now printed with the info command.
Also some information, such as the number of suspect events,
is no longer printed if the weigthing heuristic is not the number
of events (since then that information is not available).
trace/mercury_trace_declarative.c:
Add a function to setup the trace counts array with a suspicion for
each label. For efficiency the suspicion is converted from a
float to an integer between 0 and 100.
If a flag is set, then increment an accumulator with the
suspicion of each label executed as the annotated trace is being
constructed. Store the value of the accumulator at interface events,
so that the frontend can efficiently calculate the suspicion of any
subtree.
Remove a redundant variable and comment: the goal path is no
longer passed to the frontend, because the frontend has access to
the label_layout from which it can get the goal path (the variable and
comment are artifacts of a previous change).
When checking if a search mode is valid also check if failing and
passing trace counts are required for the search mode.
Allow abbreviations for the search mode arguments.
trace/mercury_trace_declarative.h:
Export the predicate to set up the suspicions for each label.
trace/mercury_trace_internal.c:
Allow passing and failing test case(s) to be passed
as arguments to the dd command.
If passing and failing test case(s) are supplied then record
suspicions in the annotated trace even if the sdq search mode
is not specified. The user could switch to the sdq search mode later
on.
Initialise some values which were causing warnings from the C
compiler.
browser/debugger_interface.m:
browser/declarative_analyser.m:
browser/declarative_debugger.m:
browser/declarative_edt.m:
browser/declarative_execution.m:
browser/declarative_oracle.m:
browser/declarative_tree.m:
browser/declarative_user.m:
browser/util.m:
doc/user_guide.texi:
mdbcomp/mdbcomp.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/trace_counts.m:
runtime/mercury_stack_layout.h:
runtime/mercury_trace_base.c:
runtime/mercury_trace_base.h:
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/dice.exp:
tests/debugger/declarative/dice.inp:
tests/debugger/declarative/dice.m:
tests/debugger/declarative/info.exp:
trace/mercury_trace_declarative.c:
trace/mercury_trace_declarative.h:
trace/mercury_trace_internal.c:
Estimated hours taken: 8
Branches: main
Add two new capabilities to the debugger.
The first capability is the idea of "held variables", variables that the
debugger holds onto even when execution has left the event they came from.
You can hold onto a variable via the mdb command "hold varname heldvarname".
You can suffix the name of the existing variable with a term path, in which
case the new held variable will refer only to the specified part of the term.
Later mdb commands can refer to the held variable by prefixing its name with
a dollar sign. For example, after "hold HeadVar__1^2 x", "$x" will refer to
the term that was the second argument of HeadVar__1 at the program point
at which the "hold" command was executed.
The second capability is the ability to compute the diff of two terms and
express those diffs as the term paths of the function symbols at which the two
terms differ, instead of the line numbers you get by using save_to_file and the
usual Unix diff command. The mdb command is "diff var1 var2". We limit the
number of term paths of difference sites that we display at any one time;
the mdb diff command has options to control this.
NEWS:
Mention the new capabilities.
doc/user_guide.texi:
Document the new mdb commands "hold" and "diff", the new mdb command
"held_vars" which simply lists the names of all the held variables
(just as "vars" lists the names of all the nonheld variables currently
accessible), and the concept of held variables.
doc/mdb_categories:
Update this file for the new mdb commands and concepts.
browser/browse_diff.m:
This new module implements the diff operation on terms.
browser/mdb.m:
Add the new module to the list of submodules of the mdb package.
browser/*.m:
Minor cleanups, such as importing only one module per line; there
are no algorithmic changes.
trace/mercury_trace_hold_vars.[ch]:
This new module implements the database of held variables.
trace/Mmakefile:
Mention the new module.
trace/mercury_trace_internal.c:
Implement the three new mdb commands.
trace/mercury_trace_vars.[ch]:
Modify the functions that recognize variable specifications or
process them to work with held variables as well as variables from
the current environment. This required some reorganization of the
internals of this module.
Provide some a utility function, MR_trace_parse_lookup_var_path,
for converting a string representing the specification of a term
(a variable and possibly some path within it) to the type and value
of that term. Make the utility function this is based upon,
MR_lookup_unambiguous_var_spec, replace the previous but less capable
MR_convert_var_spec_to_type_value.
trace/mercury_trace_spy.c:
Conform to the change in mercury_trace_vars.c.
trace/mercury_trace_util.c:
Make a utility function more robust.
trace/mercury_trace_alias.c:
Minor cleanups.
tests/debugger/queens.{inp,exp*}:
Update this test case to test the debugger's new capabilities.
tests/debugger/completion.{inp,exp*}:
Update this test case to expect the new mdb commands, and avoid the
ambiguity between "help" and "held_vars".
Estimated hours taken: 4
Branches: main
Reduce the amount of clutter on mgnuc command lines by moving arguments that
are always the same for a given directory into a file that is always consulted
by mgnuc in the current directory.
scripts/mgnuc.in:
Always include as C compiler arguments the contents of a file named
.mgnuc_copts in the current directory, if it exists. (It is named
.mgnuc_copts instead of .mgnuc_opts because it may not contain
general mgnuc options, such as --no-mercury-stdlib-dir.)
Mmake.workspace:
Comment out the additions of search paths to CFLAGS.
*/Mmakefile:
Delete the additions of search paths to CFLAGS.
*/.mgnuc_copts:
New files containing the directory-specific search paths, and in some
cases the required macro definitions. These replace what was taken out
of Mmake.workspace and */Mmakefile. In some cases, the old search paths
included inappropriate directories; the .mgnuc_copt files don't.
tests/.mgnuc_copts.ws:
New files containing the directory-specific search paths; bootcheck
makes tests/.mgnuc_copts from it.
*/.nocopyright:
Don't require copyright notices in .mgnuc_copts files.
tools/bootcheck:
Copy the various .mgnuc_copts files from the stage1 to stages 2 and 3.
They aren't needed in stage3 right now, but that may change.
Create tests/.mgnuc_copts.
browser/util.m:
Delete an unused and inappropriate #include.
scripts/Mmake.rules:
Use a single invocation of mkdir -p to create all subdirectories
needed by Java. Update a piece of documentation.
scripts/Mmakefile:
Reorganize the process of invoking config.status to avoid invoking
it on inappropriate files, and to ensure the right permissions
on the files it is invoked on.
scripts/prepare_tmp_dir_grade_part:
Copy the .mgnuc_copts files when populating tmp_dir.
Estimated hours taken: 0.2
Branches: main
browser/*.m:
Fix the current mixture of __ and . to module qualify module names
by standardizing on the latter.
Estimated hours taken: 17
Branches: main
This adds a module mdbcomp__trace_counts that reads in the
.mercury_trace_counts files produced by the compiler's trace mechanism.
The format of said files was slightly changed.
As the new module is to be used by the compiler and the debugger, it is
placed in the mdbcomp module. This required bringing some types from the
compiler into a new module within mdbcomp.
browser/trace_counts.m:
New module for reading execution trace summaries.
browser/prim_data.m:
New module holding types and predicates moved in from the compiler.
Types:
pred_or_func, sym_name, module_name, proc_label,
special_pred_id, trace_port
Predicates:
string_to_sym_name, insert_module_qualifier
The mode field of proc_label is now an int instead of a proc_id
to avoid pulling proc_id into mdbcomp.
browser/mdbcomp.m:
Add trace_counts and prim_data to the mdbcomp module.
browser/declarative_execution.m:
Renamed mdb's definition of module_name to flat_module_name
to avoid conflicts with the definition in mdbcomp__prim_data.
runtime/mercury_trace_base.c:
In the format of .mercury_trace_counts, write module and predicate
names now use quoted atom syntax so that names with spaces and
non-printable characters can be machine-parsed.
browser/:
compiler/:
Many changes to account for movement of types, and the change to
proc_label.
Estimated hours taken: 0.2
Branches: main
browser/dl.m:
browser/help.m:
browser/parse.m:
browser/util.m:
Bring these modules up to date with our current coding guidelines:
using predmode declarations and state variable syntax where relevant.
Estimated hours taken: 0.1
Branches: main
Remove the use of the old C interface in the debugger.
browser/dl.m:
browser/interactive_query.m:
browser/util.m:
Use the new foreign language interface rather than
the old one.
Estimated hours taken: 1
Branches: main
browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_execution.m:
browser/dl.m:
browser/interactive_query.m:
browser/io_action.m:
browser/mdb.m:
browser/name_mangle.m:
browser/util.m:
Add Mercury versions of code which has been defined only as
foreign procs so as to allow this directory to compile for
the non-C backends.
The Mercury versions just call private_builtin__sorry.
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.
Branches: main
Estimated hours taken: 2
Fix a bug which broke tests/debugger/interactive_query in non-GC grades,
e.g. asm_fast on murlibobo (dec-alpha-osf*).
browser/util.m:
Fix a bug: call_trace_getline needs to be annotated with
`will_not_call_mercury' instead of `may_call_mercury'.
This is required because the code for it accesses MR_hp,
which is only valid if `will_not_call_mercury' is specified.
The fix also required changing the return type from bool to int,
so that it can return the right value without calling Mercury code.
Estimated hours taken: 2
Branches: main
browser/util.m:
Fix a bug: call_trace_getline now may call Mercury. Asserting
will_not_call_mercury was causing succip to be clobbered,
which lead to test case failures whose symtom was that the
declarative debugger did not report the bug it found.
Estimated hours taken: 0.1
Branches: main
browser/util.m:
Fix a bug in Zoltan's last change which broke hlc grades.
Use `:- pragma foreign_import_module(c, bool)' rather
than `#include "bool.h"'.
Estimated hours taken: 12
Branches: main
Until now, programmers could add `tabled_for_io' annotations to foreign_procs
that do I/O, which asks the compiler to make those foreign_procs idempotent,
i.e. ensures that they are performed at most once even in the presence of a
retry operation in the debugger. This change adds a compiler option,
--trace-table-io-require, which generates an error if a foreign_proc that does
I/O does not have this annotation. Specifying this option thus ensures
that all I/O done by the program is idempotent.
In the future, we may want to have this option turned on in all debugging
grades. Until we decide about, the new option is not yet documented.
compiler/options.m:
Add the new option --trace-table-io-require.
compiler/handle_options.m:
Make --trace-table-io-require imply --trace-table-io.
compiler/table_gen.m:
If --trace-table-io-require is enabled, require all I/O primitives
to have the tabled_for_io annotation.
compiler/mercury_compile.m:
Pass I/O states to table_gen.m, since it can now generate error
messages.
trace/mercury_trace_util.h:
trace/mercury_trace_vars.c:
When calling Mercury code from the trace directory, disable I/O
tabling, since any I/O actions executed by Mercury code in the browser
directory (or by library code called from there) should not be tabled,
not being part of the user program.
Due to the depth of nesting, make mercury_trace_vars.c use four-space
indentation.
browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_execution.m:
browser/dl.m:
browser/io_action.m:
browser/mdb.m:
browser/name_mangle.m:
browser/util.m:
compiler/gcc.m:
compiler/mercury_compile.m:
compiler/passes_aux.m:
compiler/process_util.m:
compiler/stack_layout.m:
library/io.m:
library/time.m:
tests/debugger/declarative/tabled_read_decl.m:
Add a whole lot of tabled_for_io annotations, to enable the compiler to
bootstrap with --trace-table-io-require enabled.
In many cases, this required turning old-style pragma c_code into
pragma foreign_proc. While doing that, I standardized the layouts
of pragma foreign_procs.
browser/util.m:
Turn an impure semidet predicate into a pure det predicate with I/O
states, to allow it to be tabled. Make it return a Mercury bool
to indicate success or failure.
library/bool.m:
Add functions that allow C code to get their hands on the constants
`yes' and `no', for communication with Mercury code.
library/table_builtin.m:
Add debugging code to the main primitive of I/O tabling. This is
controlled both by the macro for retry debugging and a boolean global.
library/mercury_trace_base.[ch]:
Add the boolean global variable to switch the new debugging code in
table_builtin.m on and off.
library/mercury_trace_internal.c:
When starting I/O tabling with retry debug enabled, turn on the switch.
tests/debugger/queens.exp3:
New expected output file that applies when the library is compiled with
--trace-table-io-require.
Estimated hours taken: 4
Branches: main
Add MR_ prefixes to the remaining non-prefixed symbols.
This change will require all workspaces to be updated
The compiler will start generating references to MR_TRUE,
MR_bool, etc., which are not defined in the old runtime
header files.
runtime/mercury_std.h:
Add MR_ prefixes to bool, TRUE, FALSE, max, min,
streq, strdiff, strtest, strntest, strneq, strndiff,
strntest, NO_RETURN.
Delete a commented out definition of `reg'.
runtime/mercury_tags.h:
Add an MR_ prefix to TAGBITS.
configure.in:
runtime/mercury_goto.h:
runtime/machdeps/i386_regs.h/mercury_goto.h:
Add an MR_ prefix to PIC.
runtime/mercury_conf_param.h:
Allow non-prefixed PIC and HIGHTAGS to be defined on
the command line.
runtime/mercury_bootstrap.h:
Add backwards compatibility definitions.
RESERVED_MACRO_NAMES:
Remove the renamed macros.
compiler/export.m:
compiler/ml_code_gen.m:
Use MR_bool rather than MR_Bool (MR_Bool is
meant to be for references to the Mercury type
bool__bool).
runtime/mercury_types.h:
Add a comment the MR_Bool is for references to
bool__bool.
*/*.c:
*/*.h:
*/*.m:
Add MR_ prefixes.
Estimated hours taken: 20
Branches: main
Give the debugger the ability to print goals.
NEWS:
Mention the new ability.
browser/browser_info.m:
Define a new type, browser_term, which represents either a plain term,
or a "synthetic term", which is a string (predicate or function name),
a list of argument values, and an indication of whether the synthetic
term is a predicate goal (i.e. of the form p(a1, ..., an)) or a
function goal (i.e. of the form f(a1, ..., an-1) = an).
Add utility predicates for processing browser_terms.
browser/browse.m:
Add predicates for printing and browsing synthetic terms, and export
them to C code.
browser/browse.m:
browser/size_pretty.m:
Generalize lots of predicates to handle browser_terms, not just plain
terms.
browser/util.m:
Add a new type, "unbound", for use by mercury_trace_vars.c.
library/pprint.m:
Add functions for converting synthetic terms to docs.
Fix a potential efficiency problem: an unnecessary deconstruct.
runtime/mercury_type_info.h:
Add macros for defining static type_infos in C code.
Add macros for computing the names of type_ctor_infos even in non-hlc
grades.
Give C code access to the representation of bools and of values of
the new type "unbound".
trace/mercury_trace_browse.[ch]:
Add functions for printing goals.
trace/mercury_trace_internal.c:
Add code to recognize and handle the commands "print goal" and
"browse goal".
doc/user_guide.texi:
Document the new commands.
trace/mercury_trace_vars.[ch]:
Add a function to compute the components of synthetic terms.
tests/debugger/browse_pretty.{inp,exp*}:
Add new commands to the input to test the printing and browsing of
predicate goals, and update the expected outputs accordingly.
tests/debugger/polymorphic_output.{inp,exp*}:
Add new commands to the input to test the printing and browsing of
function goals, and update the expected outputs accordingly.
Estimated hours taken: 3
Branch: main
Add line numbers in Morphine.
trace/mercury_trace_external.c
Modify MR_output_current_slots() so that it takes a MR_Event_Info *
rather than a MR_Label_Layout *. The reason is that I need it to
get the parent of the current event. I need the parent of the current
goal because I want the line number where the call is made,
not the one where the procedure is defined.
Add the line number as an output of ML_DI_output_current_slots_*.
browser/util.m
Define the line_number type.
browser/debugger_interface.m
Add the line number as argument of output_current_slots/13.
extras/morphine/source/current_slots.op
Add the line number as argument of current_attributes/12.
extras/morphine/source/display.op
Add the line number as argument of attribute_display/12 and
of the attribute_display parameter.
extras/morphine/source/event_attributes.op
Define the new event attribute alias.
extras/morphine/non-regression-tests/test_vars.exp:
extras/morphine/non-regression-tests/queens.exp:
Update the expected output of the non-regression test.
extras/morphine/non-regression-tests/queens.in:
Disable the testing of the browser as it is currently broken.
Estimated hours taken: 20
Various fixes to get the GCC back-end interface to bootstrap.
library/exception.m:
Define function versions of mercury__exception__builtin_catch_3_p_*.
This is needed (a) in case we take their address, and (b) for the
GCC back-end interface, where we can't use C macros, since we're
compiling to assembler.
browser/dl.m:
browser/util.m:
browser/interactive_query.m:
compiler/stack_layout.m:
Add #includes for header files needed by these modules.
browser/dl.m:
Delete an unnecessary nested extern declaration, to avoid
a warning from `gcc -Wshadow'.
compiler/mlds_to_gcc.m:
When calling mlds_to_c to process foreign_code, make all
definitions public, so that the can be used from the assembler
code that we generate in mlds_to_gcc.
Don't call mlds_to_c to generate `.c' and `.h' files if the
module contains only `pragma foreign_decls', not `pragma
foreign_code', `pragma foreign_proc', or `pragma export'.
This change is needed to avoid calling mlds_to_c when
intermodule optimization is enabled and `pragma c_header_code'
declarations have been read in from the `.opt' file and have
propagated through to the MLDS. Calling mlds_to_c when the
module itself doesn't contain C code breaks things, since
Mmake won't compile and link in the generated `.c' files, but
those files contain the definition of the `*__init_type_tables()'
functions that are referenced by `*_init.c'.
XXX This is not quite right, since if the module itself contains
`pragma foreign_decls', the `.h' file might be needed.
But the Mercury standard library needs intermodule optimization
enabled for `make install' to work.
A better fix would be to ignore foreign_decls that were defined
in other modules, but to call mlds_to_c for foreign_decls
that were defined in the module that we're compiling.
compiler/modules.m:
Change the code which decides when to link in extra object files
for foreign code to reflect the above change to when mlds_to_gcc.m
invokes mlds_to_c.m.
compiler/mlds_to_c.m:
When target=asm, i.e. we're compiling to asm, but mlds_to_c.m
has been invoked to generate C code for a `foreign_code',
`foreign_proc', or `pragma export' declaration, don't generate
#include directives for the imported modules, since we may not
have generated any header file for them.
XXX This is a bit of a hack; it might sometimes lead to
problems, since the header files might sometimes be needed.
But including them unconditionally is definitely wrong,
since they may not exist, and so this change is needed to get
the compiler to bootstrap.
compiler/Mmakefile:
Add a dependency of mercury_compile on $(GCC_BACK_END_LIBS),
so that we know to relink it if the GCC back-end has changed.
(That variable is set to empty if we're not linking in the GCC
back-end, so it won't cause problems when not using the GCC
back-end.)
library/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
Add an `ss' target, for use by tools/bootcheck.
tools/bootcheck:
Add `--target asm' option. If that is set, pass `--target asm'
to mmake, and build and compare the stage 3 `.s' files rather
than the `.c' files.
Also add `--make-opts' option, for passing options to `make'.
Put `-k' in `--make-opts', not `--mmake-opts', since `-k' is
an option to `make', not to `mmake'. This makes a difference
since although `make' options can be passed to `mmake', any
options after the first `make' option are assumed to be
options to `make', not to `mmake'.
Estimated hours taken: 2.5
Distinguish between predicates and functions in the declarative debugger.
browser/declarative_execution.m:
Add a pred_or_func field to trace_atom.
trace/mercury_trace_declarative.c:
Construct trace atoms with the extra field.
browser/declarative_user.m:
Print function call results using function syntax.
browser/debugger_interface.m:
browser/util.m:
Move the definition of type pred_or_func to util.m, so it can
be used by the declarative debugger as well as the external debugger.
runtime/mercury_stack_layout.h:
Update a reference to the location of type pred_or_func.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/func_call.{m,inp,exp}:
Test case for the new feature.
tests/debugger/declarative/*.exp:
tests/debugger/declarative/*.exp2:
Update expected output from tests.
Estimated hours taken: 0.1
Minor fixups to my last change.
browser/util.m:
- Avoid unnecessary casts.
- Use 'MR_free' rather than 'free'.
trace/mercury_trace_internal.c:
Better comments for MR_trace_get_command.
Estimated hours taken: 3
Allow multiple browser commands on one line, separated by semicolons.
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
Separate the code for splitting lines and checking for EOF into
a new function, MR_trace_get_command.
browser/parse.m:
Call util__trace_get_command to read each command.
browser/util.m:
Implement util__trace_get_command, which calls the function
in the trace directory via an indirect pointer.
runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
util/mkinit.c:
Set up the indirect pointer to the new function.
tests/debugger/browser_test.inp:
tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp2:
Test the new feature.
Estimated hours taken: 20
Change the MercuryFile structure so that it now contains pointers to
functions which operate on the MercuryFile. This allows us, for
example, to create a MercuryFile structure which operates on sockets and
use the predicates in io.m to operate on the socket stream.
runtime/mercury_library_types.h:
Define the new implementation of MercuryFile structure.
The MercuryFile structure now contains pointers to functions to do
all the basic I/O operations.
Define macros to access all the different parts of the MercuryFile
structure.
runtime/mercury_file.h:
runtime/mercury_file.c:
Implement a MercuryFile structure which operates on C FILE *'s.
library/io.m:
Call the basic I/O operations from the MercuryFile structure.
Explicitly check that we are using a file stream when required.
As we cannot supply a variable number of arguments to a macro,
define a new function ML_fprintf() to provide fprintf functionality.
Hide all direct access to the MercuryFile data structure behind
macros.
browser/util.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
Hide all direct access to the MercuryFile data structure behind
macros.
extras/logged_output/Mmakefile:
extras/logged_output/README:
extras/logged_output/logged_output.m:
extras/logged_output/main.m:
Add an example of defining a new MercuryFile structure. This new
structure defines an output stream which writes to stdout and logs
to a file at the same time.
runtime/Mmakefile:
Add the new files mercury_file.{c,h}.
runtime/mercury_imp.h:
Include `mercury_file.h'.
Estimated hours taken: 1
Make all the modules in the browser library sub-modules of
module `mdb', to avoid link errors when users use module names
such as `parse'.
browser/Mmakefile:
browser/browser_library.m:
browser/mdb.m:
Rename browser_library.m to mdb.m.
Change `:- import_module' declarations to
`:- include_module' declarations.
browser/Mmakefile:
Remove the special case rule for `mer_browser.init' --
it doesn't work when the file names are not the same
as the module name. Instead, the default rule for `mdb.init'
is used and the output is copied to `mer_browser.init'.
browser/.cvsignore:
Rename header files, etc.
browser/*.m:
Add a `mdb__' prefix to the names of modules in the browser library
in `:- module' and `:- import_module' declarations.
trace/*.c:
Rename the header files for the browser library in
`#include' statements.
tests/hard_coded/Mmakefile:
tests/hard_coded/parse.m:
tests/hard_coded/parse.exp:
Test case.
Estimated hours taken: 0.25
browser/util.m:
Fix a bug reported by Erwan Jahier:
the order of the enum here should match that
in runtime/mercury_trace_base.h.
runtime/mercury_trace_base.h:
Update the documentation to point to browser/util.m
rather than browser/debugger_interface.m.
Estimated hours taken: 160
Implement a new data structure for declarative debugging. The
major differences between this and the old implementation are:
- The data structure is implemented in Mercury. The definition
of the type, and procedures for constructing values of that
type, have been moved from trace/mercury_trace_declarative.{c,h}
to browser/declarative_execution.m (which is a new module).
- The front end no longer needs to call the back end via an
indirect pointer---the front end does not call the back end at
all.
- The data structure is not specifically for wrong answer
analysis, it is intended to be used for any sort of analysis.
- The data structure represents execution at a lower level---the
new front end defines a more abstract view in terms of this
data structure.
Implement a test harness for debugging the front end code. This allows
the front end to run as a stand-alone program, which can then be
debugged using `mdb'.
The code in the front end does not currently handle the new structure
very nicely. This is because that code is about to undergo some major
structural changes, so there is little point cleaning it up now.
Consequently:
- Some of the code in the front end is incorrect (eg. the
user interface does not print missing answer nodes
properly).
- The tests have not been reinstated.
These things will be fixed in subsequent changes.
Likewise the compiler still reserves two stack slots, even though
only one is required. After this change the algorithm should be able
to get away with using no stack slots, so modifications to the compiler
will be postponed until then.
browser/declarative_execution.m:
New module. Implement the execution_tree typeclass, which
represents the execution of a Mercury program. Implement
two instances of this typeclass, one for normal use and one for
testing purposes.
browser/declarative_test.m:
New module. A test harness that can be compiled as a
stand-alone program, enabling the front end to be debugged.
trace/mercury_trace_declarative.c:
trace/mercury_trace_declarative.h:
- Remove the definition of the old data structure.
- Add some macros which enable the new Mercury data structure
to be destructively updated by C code.
- Change the interface to this module so that it reflects more
general diagnosis, not just wrong answer analysis.
- Implement the new algorithm.
- Call an alternative front end if in test mode.
- Update comments.
trace/mercury_trace_internal.h:
Add a new mode for debugging the declarative debugger.
trace/mercury_trace_internal.c:
Change the command from `dd_wrong' to `dd', since it is not
specifically for wrong answer analysis. Add a new command
`dd_dd' which calls the alternative front end used for testing.
runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
util/mkinit.c:
Remove any reference to `MR_edt_root_node', since it is no
longer used.
browser/declarative_debugger.m:
- Add a case for missing answer nodes to `edt_node'.
- Change the `evaluation_tree' typeclass into `mercury_edt'
typeclass. This is to make it more distinct from the new
`execution_tree' typeclass, which is a lower level concept.
- New interface to the diagnoser: types `diagnoser_response'
and `diagnoser_state', and procedure `diagnosis'.
- Define an instance of `mercury_edt' from an instance of
`execution_tree'.
- Updates to the analyser to get it to compile---further changes
will be forthcoming.
browser/declarative_user.m:
- Updates to the user interface to get it to compile---further
changes will be forthcoming.
browser/browser_library.m:
Import the new module (declarative_execution.m).
browser/debugger_interface.m:
browser/util.m:
Move the definitions of trace_port_type and goal_path_string
to browser/util.m, since they are now used by more than just
the external debugger.
browser/Mmakefile:
Add the test harness as a `depend' target.
browser/browse_test.m:
Use the correct interface to the browser.
Estimated hours taken: 6
If calling from the internal debugger, use readline input for the
interactive term browser and interactive queries.
browser/browse.m:
Change some if-then-elses to switches, which will help
catch errors if a new functor is added to the debugger type.
browser/parse.m:
browser/util.m:
Return a string from util__trace_getline/4 rather than a
list of chars, which saves converting from a string to a list
of chars and then back again.
browser/util.m:
Add a version of util__trace_getline that also takes I/O
stream arguments. Pass these arguments to MR_trace_getline.
browser/declarative_oracle.m:
Call util__trace_getline/4 to do input via readline (if
available). Improve error handling.
browser/interactive_query.m:
Call util__trace_getline to get user input, instead of
standard library predicates.
runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
Add two I/O stream arguments to MR_trace_getline.