Estimated hours taken: 0.5
Fix bugs that were stopping *.res and *.out files being cleaned up properly.
tests/Mmake.common:
tests/general/accumulator/Mmakefile:
tests/invalid/Mmakefile:
tests/misc_tests/Mmakefile:
tests/tabling/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
tests/warnings/Mmakefile:
Make cleaning tasks depend on (real)clean_local rather than
(real)clean. This is because tests/startup and tests/shutdown
use the *_local targets.
tests/general/Mmakefile:
Fix bugs in the recursive mmake calls.
Estimated hours taken: 0.1
tests/tabling/Mmakefile:
Fix the misclassification of two tests that need to be executed
with minimal model tabling enabled.
Estimated hours taken: 130
Rewrite significant parts of minimal model tabling so that it works
in a much wider variety of situations, including coups. Also, clean up
the tabling implementation to make it more maintainable, and introduce
a new grade component, .mm, that enables minimal model tabling.
(Minimal model tabling requires distributed fat, and we don't want to
incur such costs unless necessary.)
compiler/options.m:
Add a new option --use-minimal-model, which for now is documented
as "not for general use". This option is a grade option, and is
required if minimal model tabling is to work.
compiler/handle_options.m:
When --use-minimal-model is given, do not allow nondet frame hijacks,
since minimal model tabling cannot cope with hijacks.
Make --use-minimal-model a grade component.
compiler/code_info.m:
When --use-minimal-model is given, insert calls to MR_commit_{mark,cut}
around goals being committed across. This is now necessary, so that we
can detect and handle sitations where a goal being committed across
starts but does not complete a tabled goal.
compiler/table_gen.m:
Rename many of the tabling helper predicates, using a naming scheme
that separates predicates used for model_non procedures from those
used to implement simpler forms of tabling, while bringing out
the parallels between these two sets of predicates.
When calls to two tabling helper predicates always occur
one after the other, merge the two into one.
Generate and use more meaningful variable names; having all of the
several variables inserted by this transformation named TableVar
was quite confusing.
library/private_builtin.m:
Reorganize this file, to separate out the different sections.
The contents of the non-tabling sections were not modified, only
moved around.
Rename the predicates referred to by table_gen.m.
Move most of the type declarations and complex code out of here,
into runtime/mercury_tabling.c. This makes it easier to debug them,
since (a) creating a new executable is quicker, since you don't have
to wait for lots of mercury compiler invocations, and (b) gdb doesn't
get confused by #line directives. It also makes it easier to write
them, since you don't have to !&(*U&( remember to double all your
double quotes and to backslash all your backslashes.
runtime/mercury_grade.h:
Include a grade component reflecting whether MR_USE_MINIMAL_MODEL
is defined.
runtime/mercury_conf_param.h:
Document MR_USE_MINIMAL_MODEL.
runtime/mercury_stacks.[ch]:
The changes to tabling require the addition of two new stacks,
the generator stack and the cut stack. This module defines the
structures of the frames of these stacks and provides the
operations on these stacks.
The header file also contains some additional macros that return
the addresses of fixed nondet stack slots, not their contents,
for use by tabling code.
runtime/mercury_context.[ch]:
runtime/mercury_memory.[ch]:
runtime/mercury_wrapper.[ch]:
Declare and set up the two new stacks, both in saved contexts and in
the active context, if MR_USE_MINIMAL_MODEL is defined.
runtime/mercury_regorder.h:
Add four new global virtual machine registers to hold pointers
to the memory areas of the two new stacks and the current offsets
within them. These are defined whether MR_USE_MINIMAL_MODEL is defined
or not, since the cost is minimal and the potential bugs we avoid
would be hard to track down.
runtime/mercury_engine.h:
runtime/mercury_wrapper.c:
Add support for a new debugging flag, -dS, which prints the contents
of the nondet stack at several points during tabling.
runtime/mercury_tabling.[ch]:
The implementation of the new tabling system. Much of the new code here
is stuff moved from library/private_builtin.m, but in a significantly
rewritten form. There is also substantial new code, e.g. to handle
the extension of saved stack segments, and to manage dependencies
between subgoals in general.
Improve the documentation considerably.
Replace lists stored as Mercury data structures with lists stored
as linked structures in the usual C fashion. This allows us to use
debuggers such as ddd on these data structures, whose complexity
requires this.
Ensure that global names start with MR_.
runtime/mercury_init.h:
Explicitly include mercury_regs.h at the start. Without this,
we get an error, because now mercury_wrappers.h, which mercury_init.h
includes, also includes mercury_regs.h, but not before functions
have been declared.
runtime/Mmakefile:
Refer to the new file mercury_stacks.c (mercury_stacks.h already
existed, but the module consisted entirely of macros.)
Fix a sorting error.
scripts/{init,parse,final}_grade_options.sh-subr:
scripts/mgnuc.in:
Handle the new grade component.
tests/tabling/*
Add several new test cases that we now pass, most of which we couldn't
pass before. Also add some new test cases that we don't pass yet,
due to interactions between tabling and negated contexts.
trace/mercury_trace_internal.c:
If MR_USE_MINIMAL_MODEL is defined, add a new command to print
the generator stack. (The new command is deliberately not documented
in doc/mdb_doc yet, since (a) it is intended for developers only,
and (b) there is no way to test MR_USE_MINIMAL_MODEL in mdb_doc.)
Estimated hours taken: 0.25
tests/debugger/.cvsignore:
tests/tabling/.cvsignore:
tests/misc_tests/.cvsignore:
tests/warnings/.cvsignore:
Tell cvs to ignore the `CLEAN' files produced by the
tests/{startup,shutdown} scripts.
Estimated hours taken: 0.5
tests/tabling/coup.m:
A new test case contributed by Bart Demoen.
tests/tabling/Mmakefile:
Mention the new test case but do not enable it, since we don't yet
pass it.
Estimated hours taken: 6
Fix to get tests/tabling/tc_minimal to work.
runtime/mercury_tabling.h:
Replace the macro table_allocate with two macros table_allocate_bytes
and table_allocate_words, which are explicit about the unit of their
size argument.
Replace the macro table_reallocate with two macros
table_reallocate_bytes and table_reallocate_words,
which are explicit about the unit of their size argument.
Replace the macro table_copy_mem with two macros table_copy_bytes
and table_copy_words, which are explicit about the unit of their
size argument.
Fix the MR_DEBUG_TABLE_* macros, which had the old and new table
pointers the wrong way around in the conditionally enabled diagnostic
messages.
runtime/mercury_table_*.c:
Replace references to the obsolete macros with their appropriate
replacements.
runtime/mercury_stack trace.c:
When dumping the nondet stack, print the size of each stack frame.
This makes it easier to find bugs involving confusion of bytes and
words :-)
library/private_builtin.m:
Fix some bugs involving confusion of bytes and words using the new
macros from mercury_tabling.h.
Make debugging easier, by using variables (whose values can be printed
quite easily in gdb) instead of macros involving several casts (which
cannot be printed easily in gdb), and by adding conditionally included
code that prints diagnostics at saves and restores of stack segments.
Delete some dead code.
Clean up the formatting in some places.
tests/tabling/Mmakefile:
Enable the tc_minimal benchmark, since we now pass it.
Estimated hours taken: 6
Fix some bugs in tabling, to enable the boyer test case to work.
runtime/mercury_tabling.h:
Add a new set of macros that optionally print debugging info at
tabling actions. Debugging recquires compilation with -DMR_TABLE_DEBUG
and -dT in MERCURY_OPTIONS.
runtime/mercury_table_any.c:
Use the debugging macros. Fix two bugs, one found with their help.
One is that a tagged pointer to the table giving information about
remote secondary tags did not have its tag stripped before use.
The other is that the extraction of local secondary tags from words
was done by subtracting the tag, and not by shifting out the tag,
leaving the secondary tag value too high by a factor of 4 or 8.
runtime/mercury_table_any.[ch]:
runtime/mercury_table_enum.[ch]:
Change the order of some function arguments to be consistent with
the orders in the macros that call these functions.
runtime/mercury_table_enum.c:
Add an optional sanity check that detects the second bug above.
runtime/mercury_engine.[ch]:
Add a new debug flag, MR_tabledebug. Rename the flags so they always
start with MR_.
runtime/mercury_wrapper.c:
Allow -dT in MERCURY_OPTIONS to set MR_tabledebug.
runtime/*.[ch]:
Trivial changes for the new names of the debug flags.
runtime/Mmakefile:
Reimpose alphabetical order on the list of C files.
library/private_builtin.m:
Use the new debugging macros in the C code that does tabling.
Expose the equivalence between ml_table, ml_subgoal_table_node etc
and c_pointer. The reason is
% These equivalences should be local to private_builtin. However,
% at the moment table_gen.m assumes that it can use a single variable
% sometimes as an ml_table and other times as an ml_subgoal_table_node
% (e.g. by giving the output of table_lookup_insert_int as input to
% table_have_all_ans). The proper fix would be for table_gen.m to
% use additional variables and insert unsafe casts. However, this
% would require significant work for no real gain, so for now
% we fix the problem by exposing the equivalences to code generated
% by table_gen.m.
library/mercury_builtin.m:
Delete the contents of this obsolete file, leaving only a pointer
to builtin.m and private_builtin.m.
tests/tabling/Mmakefile:
Enable the boyer benchmark, since we now pass it.
Estimated hours taken: 1
tests/Mmakefile:
Add the new tabling directory to the list of directories.
tests/tabling/Mmakefile:
tests/tabling/runtests:
The intrastructure of the new tests directory.
tests/tabling/fib.{m,exp}:
A test of the memoing of a det procedure.
tests/tabling/tc_loop.{m,exp}:
A test of loop checking for a nondet procedure.
tests/tabling/tc_minimal.{m,exp}:
A test of minimal model tabling for a nondet procedure.
(Doesn't work yet).
tests/tabling/boyer.{m,exp}:
A benchmark program, translated to Mercury by Bart Demoen
from an original in Prolog.
(Doesn't work yet).