Estimated hours taken: 160
Branches: main
This change adds new facilities for debugging minimal model tabling, and
has several bug fixes found with the aid of those facilities. Most of the
diff affects the behavior of the system only in minimal model grades and/or
when debugging flags are defined.
compiler/ite_gen.m:
In minimal model grades, surround the conditions of if-then-elses
with calls to three functions. These functions detect when a
condition fails due to one or more suspensions, and abort the
program. (After resumptions, the condition may actually have
solutions, but by then the computation has committed to the wrong
path.)
compiler/table_gen.m:
Change the program transformation for model_non predicates
to use a switch instead of nested if-then-elses, to avoid the
overhead of wrapping the condition. The version with switches
is also a bit easier to debug.
The transformation for model_det and model_semi predicates
stays as before, because for such predicates finding the status
(which we want to switch on) requires computation, not just a lookup.
Switch to state variable syntax in the affected predicates.
Make the error message for an internal error in loopcheck predicates
more precise.
Mark the code fragments that modify tabling data structures as impure
and code fragments that examine tabling data structures as semipure.
runtime/mercury_stacks.[ch]:
Implement the new stack of possibly negated contexts that we use
to detect false failures due to suspensions in negated contexts.
Fix a bug: don't refer to MR_cut_stack[-1].
Shorten the name of the generator stack.
runtime/mercury_context.[ch]:
runtime/mercury_memory.c:
runtime/mercury_wrapper.[ch]:
Allocate memory for the new stack of possibly negated contexts.
Use the shortened name of the generator stack.
runtime/mercury_regorder.h:
Allocate a pointer for the new stack of possibly negated contexts.
runtime/mercury_minimal_model.[ch]:
A new module holding the part of mercury_tabling.[ch]
that is specific to minimal model tabling. This version contains
tools to help debugging of minimal model tabling, as well as some
bug fixes found with the aid of those tools.
runtime/mercury_tabling.[ch]:
Remove the code moved to mercury_minimal_model.[ch], and add the
code moved here from trace/mercury_trace_internal.c.
Add prefixes to a bunch of structure fields to make it easier
to read code accessing those fields.
Add mechanisms to allocate and copy tabling structures with type
safety.
runtime/mercury_imp.h:
#include the new header file, if it is needed.
runtime/Mmakefile:
Mention the new module, and fix sortedness errors.
runtime/mercury_stack_trace.c:
Fix a bug that sometimes caused stack traces to abort in minimal model
grades: they were trying to get layout information from labels
that do not have them, such as do_fail.
If MR_TABLE_DEBUG is defined, print the locations of stack frames
when doing stack dumps.
runtime/mercury_trace_base.h:
Export to mercury_stack_trace.c the labels that we use to let the
debugger get control at redos and fails, since they don't have
layout information.
runtime/mercury_types.h:
Move typedefs here from mercury_tabling.h, and add typedefs for some
newly added types.
runtime/mercury_engine.[ch]:
Add a table mapping debugging flags to their offsets in the
MR_debugflag array, for use in the debugger.
runtime/mercury_misc.c:
Make the formatting of det stack pointers the same as nondet stack
pointers in debugging output.
runtime/mercury_debug.[ch]:
Add conditionally compiled debugging output when creating temp frames
on the nondet stack.
library/table_builtin.m:
Conform to the new names of some fields.
Add a predicate to return the status of a subgoal.
Add conditionally compiled debugging code.
library/Mmakefile:
Make table_builtin.m depend on runtime/mercury_minimal_model.h.
trace/mercury_trace.c:
Conform to the new names of some fields.
trace/mercury_trace_internal.c:
Add two new mdb commands, to print the cut stack and the new possibly
negated context stack.
Add two new mdb commands to print a subgoal and a consumer.
Move some of the code to print tabling-related
data structures to runtime/mercury_tabling.[ch].
Add a new mdb command to report the values of debugging flags and
to set and clear them. Previously, one had to turn on these debugging
flags with environment variables, which were problematic because they
turned on diagnostic printouts even in Mercury programs that *weren't*
being debugged, such as the Mercury compiler when being used to
generate the program to be debugged. Now the flags can be turned on
from a .mdbrc file, which eliminates much setting and unsetting of
environment variables.
doc/user_guide.tex:
Document the new mdb commands.
tests/debugger/mdb_command_test.inp:
Test the documentation of the new mdb commands.
tests/debugger/completion.exp:
Expect the new commands in the command completion test.
tests/debugger//nondet_stack.exp*:
Expect the new format of det stack pointers.
tests/debugger/all_solutions.exp3:
tests/debugger/exception_value.exp3:
tests/debugger/declarative/catch.exp3:
tests/debugger/declarative/ho5.exp3:
tests/debugger/declarative/throw.exp3:
New expected test cases for use in minimal model grades. They
differ from existing expected output files only in the precise
phrasing of error messages.
tests/debugger/declarative/Mmakefile:
Disable the untraced_subgoal test case in .mm grades, since we don't
pass it yet.
tests/tabling/Mmakefile:
Enable the mday test case, now that we pass it.
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: 0.1
Branches: main
tests/debugger/nondet_stack.exp3:
Update this version of expected output for the recent change to
polymporphism.m.
Estimated hours taken: 0.1
Branches: main
tests/debugger/nondet_stack.exp3:
Update the expected output after Zoltan's change to allow the
debugger to print higher order values and typeinfos.
Estimated hours taken: 0.2
Branches: main
tests/debugger/nondet_stack.exp3:
Add a new expected output file for this test case, for use by the
asm_fast.gc.tr grade. The expected output for this grade doesn't match
nondet_stack.exp because the stack slots needed to hold saved tickets
and trail pointers cause differences in stack frame sizes, and it
doesn't match nondet_stack.exp2 because nondet_stack.exp2 expects
labels used by the debugger to have been registered.