Files
mercury/tests/debugger/declarative/func_call.exp
Ian MacLarty 8ac929888b In the declarative debugger, dynamically calculate the depth implicit subtrees
Estimated hours taken: 15
Branches: main

In the declarative debugger, dynamically calculate the depth implicit subtrees
need to be built to, to achieve a desired weight.

This is done by recording the number of events at each depth in each
implicit subtree.  The array used to record these depths need only be
as big as the desired weight divided by two, since the thinnest a tree can be
is a stick with two events at each depth (a CALL and an EXIT/FAIL/EXCP).

Initially the tree is built down to a predetermined, conservative depth.  At
the root of each implicit subtree in the newly materialized tree, we record
the depth the implicit subtree needs to be built to, to achieve the desired
weight (this is refered to as the ideal depth in the code).  This is done
everytime we materialize a new implicit subtree.

This results in about a 3.6% slowdown when the declarative debugger reexecutes
a portion of the program.  However, this also reduces the number of
reexecutions of the program, since we needn't be conservative about how deep to
build subtrees to anymore.  We also avoid adding too many nodes to the
annotated trace if the tree has a large branching factor, so we are able to
control memory usage more easily.

I also added a progress indicator which is activated if a reexecution continues
for more than a second.

I added some macros to optionally print benchmarking information when
building a new portion of the annotated trace.

browser/declarative_debugger.m:
 	Pass the ideal depth of a subtree to the backend.

browser/declarative_edt.m:
	Handle the case where edt_dependency says an explicit subtree is
	required.

browser/declarative_execution.m:
	Record the ideal depth at the CALL event corresponding to the root
	of an implicit subtree.

	Add predicates to get and set this value from the backend.

browser/declarative_tree.m:
	Export a new predicate, trace_implicit_tree_info, which is used to
	get the info stored at the root of an implicit root.

	Make trace_dependency respond that an explicit subtree is required
	if it needs to explore the children of an implicit subtree.  Previously
	we made this situation impossible by requiring the backend to
	always generate the children of nodes at the depth limit.  This,
	however, complicated the backend code unnecessarily.

doc/user_guide.texi:
	Change the --depth-step-size dd option to just --depth which is now
	only used as the initial depth to build the subtree to.  Comment out
	the --depth option, since it requires knowledge of the internal
	workings of the declarative debugger.

	Document the new dd option, --nodes, which controls how many nodes
	to build in the annotated trace at a time.

library/gc.m:
	Export garbage_collect so it can be called from the backend when
	printing out benchmarking information.

tests/debugger/declarative/*.{inp*, exp*}
	For the tests set the --nodes and --depth options to a low value, so
	that we exercise the code that builds new portions of the annotated
	trace.

trace/mercury_trace_declarative.[ch]:
	Move the MR_DECL_UNTABLED_IO_RETRY_MESSAGE macro to
	mercury_trace_declarative.h.

	Add some macros and functions which print benchmarking information
	if the MR_DD_PRINT_EDT_STATS macro is defined.

	Add an overview of the backend.

	Show progress if the tree takes more than a second to generate.

	Count the events at each depth in each implicit subtree.
	Calculate the ideal depth when exiting an implicit subtree and store
	this in the annotated trace.

	Add the depth limit as an argument to MR_trace_restart_decl_debug
	instead of using the value of the global MR_edt_depth_step_size
	(which no longer exists).

	Do not materialize the children of nodes at the depth limit, since
	this is no longer necessary.

trace/mercury_trace_internal.c:
	Add and handle the --nodes dd option.  Rename the --depth-step-size
	option to --depth.
2005-05-20 05:40:37 +00:00

48 lines
942 B
Plaintext

1: 1 1 CALL pred func_call.main/2-0 (det) func_call.m:8
mdb> echo on
Command echo enabled.
mdb> register --quiet
mdb> break fib
0: + stop interface func func_call.fib/1-0 (det)
mdb> continue
2: 2 2 CALL func func_call.fib/1-0 (det) func_call.m:14 (func_call.m:9)
mdb> finish -n
151: 2 2 EXIT func func_call.fib/1-0 (det) func_call.m:14 (func_call.m:9)
mdb> dd -d 3 -n 7
fib(6) = 9
Valid? no
Call =<(6, 1)
Unsatisfiable? yes
-(6, 1) = 5
Valid? yes
fib(5) = 6
Valid? no
Call =<(5, 1)
Unsatisfiable? yes
-(5, 1) = 4
Valid? yes
fib(4) = 4
Valid? no
Call =<(4, 1)
Unsatisfiable? yes
-(4, 1) = 3
Valid? yes
fib(3) = 3
Valid? yes
-(4, 3) = 1
Valid? yes
fib(1) = 1
Valid? yes
+(3, 1) = 4
Valid? yes
Found incorrect contour:
-(4, 1) = 3
fib(3) = 3
-(4, 3) = 1
fib(1) = 1
+(3, 1) = 4
fib(4) = 4
Is this a bug? yes
75: 8 4 EXIT func func_call.fib/1-0 (det) func_call.m:14 (func_call.m:20)
mdb> quit -y