Commit Graph

11 Commits

Author SHA1 Message Date
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
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.
2015-02-14 20:14:03 +11:00
Zoltan Somogyi
25b8b1abc3 Fix several performance bugs that showed up when the compiler was invoked on
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.
2006-03-29 00:57:46 +00:00
Zoltan Somogyi
cdf0383b52 Fix a bunch of problems with tabling that I identified in Uppsala.
Estimated hours taken: 32
Branches: main

Fix a bunch of problems with tabling that I identified in Uppsala. These fall
into two categories.

First, the tabling transformations we were using were dividing work up
too finely. This had three bad effects. First, it caused too much time to be
spent on transmitting data to and from library predicates. Second, it made the
transformations hard to document and hard to explain in a paper. Third, it
caused us to misidentify just what the various forms of tabling have in common,
and what forms of tabling work for what determinisms. To fix this problem,
this diff reorients table_builtin.m and table_gen.m from being divided
primarily by determinism to being divided by evaluation method.

Second, we weren't being careful in separating out the parts of the tabling
data structures that are needed only for debugging the tabling system itself.
The fix for this is to introduce a new grade flag, MR_MINIMAL_MODEL_DEBUG,
intended for use by implementors only, to govern whether the tabling data
structures include debug-only components. (If this flag weren't a grade flag,
the sizes of data structures created in files with different values of this
flag could be inconsistent, which is something you don't want when debugging
the complex code of the tabling infrastructure.)

compiler/table_gen.m:
	Reorganize the simple (loopcheck and memo) tabling transformations
	completely. Instead of separate transformations for model_det and
	model_semi predicates, have separate transformations for loopcheck
	and memo predicates, since this makes it easier to see (and to ensure)
	that the transformation follows the required scheme. Instead of
	generating nested if-then-elses, generate switches when possible.

	For model_semi loopcheck and memo predicates, generate Mercury code
	that obeys our scope rules by not binding output variables in the
	condition of the one remaining if-then-else.

	Finetune the minimal model tabling transformation by combining some
	operations where this improves clarity and performance.

	Order the transformation predicates logically, and move the
	documentation of each form of tabling next to the code implementing
	that form of tabling.

	Attach call_table_gen markers to the setup goals that now all
	loopcheck, memo and minimal model tabled predicates have,
	to avoid having to special case the last lookup goal, and to avoid
	having to have separate code for lookups in call tables versus answer
	tables.

	Generate unique and more meaningful variable names. Change some
	predicate names to be more meaningful, both here and in the
	transformed code.

	Factor out some common code, e.g. for generating lookup goals,
	for generating instmap_deltas and for attaching hide_debug_event
	markers to goals.

	Report errors in cases where the arguments of a tabled predicate
	aren't completely input or output.

compiler/hlds_pred.m:
	Be more strict about the determinisms of tabled predicates; permit
	only the determinisms we really support in all cases, and do not
	permit the ones that may happen to work in some cases.

	Conform to the change of the name of a builtin.

compiler/det_report.m:
	Improve the error message for cases when the determinism is
	incompatible with the selected tabling mechanism.

compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/options.m:
	Handle the new grade component.

library/private_builtin.m:
	Provide a semipure analog of the imp predicate, a call to which makes
	predicates semipure rather than impure, for use in table_builtin.m.

library/table_builtin.m:
runtime/mercury_tabling_preds.h:
	Change the tabling primitives in the ways required by the changes to
	the tabling transformations.

	Group the primitives by the tabling methods they support, and change
	their names to reflect this.

	Change the implementation of each of the affected predicates to be
	nothing more than the invocation of a macro defined in the new header
	file runtime/mercury_tabling_preds.h. The objective of this change
	is to make it possible for table_gen.m to replace sequences of calls
	to predicates in table_builtin.m with a single extended foreign_proc
	goal whose body just invokes the corresponding macros in sequence.
	That change should improve performance by allowing the variables
	that flow from one tabling primitive to another to stay in x86
	registers, instead of being copied to and from Mercury abstract
	machines registers, which on the x86 aren't real machine registers.
	Benchmarking in Uppsala verified that this is a major cost.

	Mark the foreign types used for tabling as can_pass_as_mercury_type;
	this was the intended use of that assertion. Make them private to the
	module, since the rest of the compiler can now handle this.

	Delete the implementations of the predicates for duplicate checking
	and for returning answers for completed subgoals. Profiling with gprof
	has shown their performance to be critical to the performance of
	minimal model tabling overall, and even with our recent changes,
	the compiler still can't create optimal C code for them. They are
	now implemented with handwritten code in mercury_minimal_model.c.

library/term.m:
	Add two utility predicates for use by table_gen.m.

library/Mmakefile:
	Since much of the implementation of table_builtin.m is now in
	runtime/mercury_tabling_preds.h, make its object files depend
	on that header file.

runtime/mercury_conf_params.h:
runtime/mercury_grade.h:
	Include MR_MINIMAL_MODEL_DEBUG when computing the grade.

runtime/mercury_minimal_model.[ch]:
	Add handwritten code to implement the predicates declared as external
	in table_builtin.m.

	Conform to the new names of the suspension and completion predicates.

	Conform to the presence of debugging fields in tabling data structures
	only if MR_MINIMAL_MODEL_DEBUG is defined.

	Collect a lot more statistics than before.

	Reorder some functions.

	Instead of saving the whole generator stack each time, which the new
	statistics showed to have O(n^2) behavior on some benchmarks, save only
	the segment we need to save.

runtime/mercury_tabling.h:
	Conform to the fact that loopcheck and memo predicates now have
	separate sets of status values, and import mercury_tabling_preds.h.

runtime/mercury_tabling.c:
runtime/mercury_hash_lookup_or_add_body.h:
	Move a huge macro out of mercury_tabling.c to the new file
	mercury_hash_lookup_or_add_body.h for ease of editing, and modify it to
	gather more statistics.

	Make the statistics report easier to read.

runtime/Mmakefile:
	Mention mercury_tabling_preds.h and mercury_hash_lookup_or_add_body.h.

runtime/mercury_wrapper.h:
	Provide a mechanism (--tabling-statistics in MERCURY_OPTIONS)
	that causes the runtime to print tabling statistics at the ends of
	executions, for use in benchmarking.

doc/user_guide.texi:
	Document --tabling-statistics. (Minimal model tabling is not yet
	stable enough to be documented, which is why .dmm isn't documented
	either.)

scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/mgnuc.in:
	Implement the new grade component.

trace/mercury_trace.c:
trace/mercury_trace_internal.c:
	Conform to changes in the runtime.

tests/debugger/*.m:
	Avoid now invalid combinations of determinism and evaluation method.

tests/debugger/*.exp:
	Conform to new goal paths in procedures transformed by tabling.

tests/tabling/*.m:
	For tests which had predicate whose determinisms isn't compatible
	with the evaluation method, change the determinism if possible,
	and the evaluation method otherwise, if either is possible.

	Bring these tests up to date with our coding guidelines, since they
	may now appear in papers.

tests/tabling/Mmakefile:
	Disable the tests whose combination of determinism and evaluation
	method is no longer supported, and in which neither one can be changed.

tests/tabling/loopcheck_no_loop.{m,exp}:
	Make this test case tougher.

tests/tabling/test_tabling:
	Make this script more robust in the face of different kinds of
	test case failures.

tests/invalid/loopcheck.{m,err_exp}:
tests/invalid/Mmakefile:
	Test that we get the expected error message for an invalid combination
	of determinism and evaluation method. The new test invalid/loopcheck.m
	is the old test tabling/loopcheck.m.

tests/valid/Mmakefile:
	Use a more general pattern to test for minimal model grades,
	now that we also use .dmm as a grade component.
2004-05-31 04:13:39 +00:00
Ralph Becket
a8ffd3680c Change the compiler and tools so that .' and not :' is now used as the
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.
2003-01-17 05:57:20 +00:00
Zoltan Somogyi
5345fa4643 Fix (most of) the expected outputs of the debugger test cases after my recent
Estimated hours taken: 2
Branches: main

Fix (most of) the expected outputs of the debugger test cases after my recent
changes. In some cases, this involved modifying the input scripts to make tests
less dependent on event numbers.

tests/debugger/Mmakefile:
	Use MDB_STD instead of MDB for more test cases than before.

	Disable the output_term_dep test case, since it doesn't actually test
	anything that the other test cases don't test, and it prints so many
	events that its .exp files depend on event numbers far too much.

tests/debugger/*.exp*:
tests/debugger/*.inp:
	Update expected outputs, and in some cases, the inputs.
2002-09-13 03:37:45 +00:00
Peter Ross
1167698388 Changes now that we report that an Uncaught exception comes
Estimated hours taken: 3
Branches: main


debugger/exception_cmd.exp:
debugger/exception_cmd.exp2:
debugger/exception_vars.exp:
debugger/exception_vars.exp2:
debugger/loopcheck.exp:
debugger/loopcheck.exp2:
debugger/polymorphic_output.exp:
debugger/polymorphic_output.exp2:
debugger/polymorphic_output.exp3:
general/string_format_test_2.exp:
general/string_format_test_2.exp2:
general/string_format_test_2.exp3:
general/string_format_test_2.exp4:
general/string_format_test_3.exp:
general/string_format_test_3.exp2:
general/string_format_test_3.exp3:
general/string_format_test_3.exp4:
hard_coded/foreign_type.m:
hard_coded/no_fully_strict.exp:
hard_coded/no_fully_strict.exp2:
hard_coded/no_fully_strict.exp3:
hard_coded/no_fully_strict.exp4:
hard_coded/exceptions/test_uncaught_exception.exp:
hard_coded/exceptions/test_uncaught_exception.exp2:
hard_coded/exceptions/test_uncaught_exception.exp3:
hard_coded/exceptions/test_uncaught_exception.exp4:
tabling/loopcheck.exp:
tabling/loopcheck.exp2:
tabling/loopcheck.exp3:
tabling/loopcheck.exp4:
	Changes now that we report that an Uncaught exception comes
	from Mercury.
2002-07-25 16:20:56 +00:00
Simon Taylor
a3819d359c Fix the handling of purity in the optimization and tabling passes.
Estimated hours taken: 15
Branches: main

Fix the handling of purity in the optimization and tabling passes.
Without this change tests/tabling/unused_args.m fails with
inter-module optimization.

compiler/purity.m:
compiler/post_typecheck.m:
	Allow purity checking to be rerun on a single procedure
	without requiring an io__state. If the purity is worse
	(due to inlining a predicate with a `:- pragma promise_pure'
	declaration), add `promised_pure' or `promised_semipure'
	to the pred_info.

compiler/hlds_out.m:
compiler/hlds_pred.m:
compiler/intermod.m:
compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/purity.m:
doc/reference_manual.texi:
NEWS:
	Implement `:- pragma promise_semipure'. This is needed if
	an predicate marked `promised_pure' which calls impure
	predicates is inlined into  a semipure predicate.

compiler/inlining.m:
	Make sure the purity markers on the goal_infos are correct
	after inlining predicates which are promised pure.

	Export a predicate inlining__can_inline_proc which is used
	by deforestation to determine whether inlining a procedure
	will change the semantics or will break code generator invariants.

compiler/deforest.m:
	Use the same method as inlining.m to work out whether
	a procedure can be inlined. Don't inline predicates which
	are promised pure because the extra impurity which
	will be propagated through the goal will stop deforestation
	working on the goal.

compiler/simplify.m:
	Make sure the goal_info resulting from converting a singleton
	switch into a conjunction has the correct purity.

compiler/table_gen.m:
	Make sure the purity markers on the generated goal_infos are
	correct.

	Make sure that call_table_gen goal features cannot be removed
	by optimization passes.

	Don't put unnecessary `impure' markers on calls to error/1.

tests/debugger/loopcheck.exp:
tests/debugger/retry.exp:
	Adjust the expected output. The change to ensure that
	`call_table_gen' goal features can't be removed alters
	the goal paths slightly.

tests/invalid/impure_method_impl.m:
	Adjust the expected output now that predicates can
	be promised semipure.
2001-03-27 05:23:23 +00:00
Zoltan Somogyi
518e6e46db Strip away goal paths from exception events in the test cases that
Estimated hours taken: 0.5

tests/debugger/Mmakefile:
tests/debugger/declarative/Mmakefile:
	Strip away goal paths from exception events in the test cases that
	generate them, because different optimization levels cause different
	goals paths to be associated with exceptions.

tests/debugger/*.exp{,2}:
tests/debugger/declarative/*.exp{,2}:
	Strip away goal paths from exception events in the expected outputs
	of those test cases.
2000-11-01 04:26:32 +00:00
Zoltan Somogyi
fdccd65e30 The debugger's retry command at the moment works only from a final port for
Estimated hours taken: 60

The debugger's retry command at the moment works only from a final port for
the call to be retried, the reason being that the RTTI does not have the
information required to make sure that the state of the stacks is reset
correctly. If you invoke retry from a non-final port, the current
implementation skips forward to a final port and then does the retry;
this does not work if you get a core dump or a infinite loop during the forward
skip. This change adds the required info to the RTTI and thus enables
direct retries from the middle of calls.

The information added has two components. First, if a procedure that lives on
the nondet stack allocates any temporary nondet stack frames, then it must
record the old value of maxfr in a stack slot so that retry can restore it.
Second, if a procedure is tabled, then it must record the call table tip node
corresponding to the actual input arguments, so we can reset this node to
uninitialized (if we don't, then the retried call will find the active call
marker and report an infinite loop error).

The support for retries across minimal model calls is not finished yet.
Finding out what the right thing to do in such cases is a research project,
one that cannot even be started until minimal model tabling works reliably
in the *absence* of retries. However, such retries do grossly wrong things
at the moment; this change is a definite improvement. It attempts to perform
the retry from the fail port, since that is the only time when the minimal
model tabling data structures are quiescent. The "fail" command I added to
the debugger command set to let this be done is not complete yet and is
therefore undocumented; the problem is that a call to a model_non predicate
in a committed choice context will not get to the fail port. I added goal paths
to return layouts so that we will eventually be able to tell when execution
leaves a committed choice context surrounding an ancestor of a model_non
predicate call, but this functionality is not yet implemented.

compiler/stack_layout.m:
	Generate the three new fields: the evaluation method, (maybe) the id
	of the stack slot containing the saved value of maxfr, and (maybe)
	the id of the stack slot containing the call table tip.

compiler/continuation_info.m:
	Record the information about the new fields for later use by
	stack_layout.m.

	Add a new field to record the goal path of calls for their return
	layouts.

	Fix a screwed comment for the continuation_info data structure.

compiler/llds.m:
	Add a new field to call() instructions to hold the goal path of the
	call.

	Add a utility function for use by trace.m.

compiler/call_gen.m:
	Fill in this new field.

compiler/trace.m:
compiler/live_vars.m:
	Reserve the fixed stack slot for the saved maxfr if necessary,
	and if the call table tip node is needed, make sure that the variable
	holding its address is allocated a low-numbered stack slot (otherwise,
	its number may not fit into the MR_int_least8_t field in the
	proc_layout).

compiler/trace.m:
	If necessary, fill in the saved maxfr slot.

	If necessary, initialize the call table tip slot.

compiler/hlds_goal.m:
	Add a goal feature which marks its goal as defining the variable
	representing the call table tip node.

	Add a field to the goal path step representing quantification;
	the field says whether the quantification changes the determinism of
	the goal (i.e. whether it cuts away solutions).

compiler/hlds_pred.m:
compiler/hlds_out.m:
	Add two fields to proc_infos which (a) record which variable, if any,
	holds the call table tip node, and (b) record whether the procedure's
	layout structure needs to reserve a slot for the saved value of maxfr.

compiler/table_gen.m:
	Put this feature on the appropriate goal.

	Also, rename a predicate to make it reflect its purpose better.

compiler/code_gen.m:
	Generate code to put the call table tip variable in its stack slot
	immediately after it has been generated.

	Add a sanity check to ensure that if a procedure that lives on the det
	stack can create a temporary nondet frame, and debugging is enabled,
	then it did have a stack slot reserved for the saved maxfr.

compiler/code_util.m:
	Add a predicate to make a conservative prediction of whether a
	procedure may allocate a temporary nondet stack frame. We cannot
	just generate the code and see, because the code generator needs to
	know which variables live in which stack slots, and we cannot decide
	that until we know whether we need a stack slot for the saved value of
	maxfr.

	Make an unrelated predicate semidet procedure use a det helper, in
	order to make it more robust in the face of changes to the HLDS
	(e.g. it was missing code for handling bi_implications).

compiler/code_info.m:
	Record whether a procedure has in fact created a temporary nondet stack
	frame.

compiler/handle_options.m:
	Disable hijacks if debugging is enabled. The code we now use to
	restore the stacks for direct retries works only if the retry does not
	"backtrack" over a hijacked nondet stack frame whose hijack has not
	been undone. Note that code compiled without debugging may still hijack
	nondet stack frames. Execution may reemerge from the nondebugged region
	in one of two ways. If the nondebugged code returns, then it will have
	undone hijack, and the retry code will work. If the nondebugged code
	calls debugged code, there will be a region on the stacks containing
	no debugging information, and the retry command will refuse to perform
	retries that go into or beyond this region. Both cases preserve
	correctness.

compiler/*.m:
	Trivial changes to conform to changes in data structures.

runtime/mercury_stack_layout.h:
	Add three new fields to proc layouts: the numbers of the stack slots
	(if any) storing the saved maxfr and the call table tip, and a
	representation of the procedure's evaluation method.

runtime/mercury_stack_trace.[ch]:
	Now that return layouts contain goal paths, print them in stack dumps
	only if the include_trace_data flag is set (in mdb, this requires the
	-d flag of the "stack" command).

	Pass this flag around directly, instead of encoding its value in
	the NULL vs non-NULL values of sp and curfr.

runtime/mercury_regorder.h:
	Provide a mechanism to access the values of the first few rN registers
	from a save area, for use in debugging low-level C code in the runtime
	and the trace directories.

trace/mercury_trace.[ch]:
	Reimplement MR_trace_retry to allow retries from the middle.
	If the stack segment being retried over contains minimal model
	procedures, we must still arrange to skip to the end of the retried
	call. If this call is a minimal model generator, skipping to just any
	final port is not sufficient to guarantee correctness on retry; to
	ensure that subgoal is complete, we must skip to a fail port.

trace/mercury_trace.[ch]:
trace/mercury_trace_internal.c:
	Implement a debugger command, "fail", which skips to the fail port or
	the exception port of the specified ancestor. Since procedures that are
	not model_non are not guaranteed to get to such a port, this
	command reports an error if the specified call is not model_non.
	Actually, even calls to model_non procedures may not get to the fail
	port, as explained above; this is why the command is not yet
	documented.

trace/mercury_trace.c:
trace/mercury_trace_util.[ch]:
	Move some functions to print parts of the Mercury abstract machine
	state from mercury_trace to mercury_trace_util, so that they are
	available for use in debugging e.g. mercury_trace_declarative.

trace/mercury_trace_internal.c:
trace/mercury_trace_external.c:
trace/mercury_trace_declarative.c:
	Use the new implementation of retries. At the moment, only the
	internal debugger implements the full functionality. The declarative
	debugger issues retry commands only from situations where the missing
	functionality is not (yet) needed. The external debugger should
	continue to work correctly, but Erwan may wish to update it to
	exploit the availability of the fail command.

trace/mercury_trace*.[ch]:
	Fix MR_prefixes, and a signed/unsigned mismatch.

doc/user_guide.texi:
	Document the new "fail" command, but comment it out for now.

tests/debugger/retry.{m,inp,exp,exp2}:
	A new test case for exercising retry.

tests/debugger/Mmakefile:
	Enable the new test case.

tests/debugger/*.exp:
	Update the expected output, given the extra info now output e.g. for
	exception events and detailed stack traces.
2000-10-13 04:06:52 +00:00
Zoltan Somogyi
d72a5652c2 Explicitly turn on echoing, to make sure that the results are the same
Estimated hours taken: 0.1

tests/debugger/loopcheck.{inp,exp}:
	Explicitly turn on echoing, to make sure that the results are the same
	with and without readline.
2000-03-22 04:08:10 +00:00
Zoltan Somogyi
a822f78b3c Add meaningful contexts to the goals inserted into predicates by tabling,
Estimated hours taken: 4

Add meaningful contexts to the goals inserted into predicates by tabling,
for use by the debugger.

compiler/table_gen.m:
	Pass the context of the procedure body through the code, and create
	new goals with this context.

	To make this simpler, switch to consistently using combined predmode
	definitions. In a couple of places, switch to a more reasonable
	argument ordering.

tests/debugger/loopcheck.*
	Copy this test case here from the tabling directory, and execute it
	under mdb, as a regression test.

	The exp2 test case is not final yet.

tests/debugger/Mmakefile:
	Enable the regression test.
1999-12-21 01:23:44 +00:00