mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-25 14:24:11 +00:00
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.
7 lines
37 B
Plaintext
7 lines
37 B
Plaintext
echo on
|
|
step
|
|
finish
|
|
dd -d 3 -n 7
|
|
q
|
|
c
|