mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-19 15:54:18 +00:00
faa18a15bd332b51ec6d6fdae4d999ec2bf3fa82
73 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c75c45c5dd |
Simplify the interface between the runtime system and the trace subsystem
Estimated hours taken: 3
Simplify the interface between the runtime system and the trace subsystem
by centralizing processing in the trace subsystem. Previously, the lookup
of the stack slots containing the depth and the call event numbers were
done in the runtime; now it is done in the trace subsystem.
runtime/mercury_wrapper.[ch]:
runtime/mercury_trace_base.[ch]:
runtime/mercury_init.h:
Change the signature of MR_trace_{real,fake} and of the function
pointer that points to one of them, to remove the depth and call
sequence number arguments.
This removes duplicated code from MR_trace and MR_trace_struct
to compute those arguments. By removing the need for some argument
shuffling as well, it ought to make the code faster. (The depth
and sequence number are now usually used only inside MR_trace_real;
they are only passed to other functions if the event requires
interaction.)
trace/mercury_trace.c:
Move the code for computing the depth and call sequence number here.
|
||
|
|
07cad7c169 |
If calling from the internal debugger, use readline input for the
Estimated hours taken: 6 If calling from the internal debugger, use readline input for the interactive term browser and interactive queries. browser/browse.m: Change some if-then-elses to switches, which will help catch errors if a new functor is added to the debugger type. browser/parse.m: browser/util.m: Return a string from util__trace_getline/4 rather than a list of chars, which saves converting from a string to a list of chars and then back again. browser/util.m: Add a version of util__trace_getline that also takes I/O stream arguments. Pass these arguments to MR_trace_getline. browser/declarative_oracle.m: Call util__trace_getline/4 to do input via readline (if available). Improve error handling. browser/interactive_query.m: Call util__trace_getline to get user input, instead of standard library predicates. runtime/mercury_init.h: runtime/mercury_wrapper.c: runtime/mercury_wrapper.h: trace/mercury_trace_internal.c: trace/mercury_trace_internal.h: Add two I/O stream arguments to MR_trace_getline. |
||
|
|
60b24d6e1d |
Add a module layout structure containing a string table and a table of
Estimated hours taken: 14 Add a module layout structure containing a string table and a table of pointers to the proc layouts of the module's procedures. This speeds up debugger initialization, and reduces the executable size of the compiler by almost 1.2 Mb (about 3.7%) when compiled with debugging. Instead of representing variables names as strings (32 or 64 bit pointers) in the debugger's static data structures, with the string's prefix representing the variable's number (e.g. "5:X"), represent them as a 16-bit variable number and a 16 bit offset into the module-wide string table. This gains simplicity of processing (no more search for the ":") and reduces the amount of storage required, a bit on 32-bit platforms (we don't have to store "5:ModuleInfo" and "10:ModuleInfo" strings separately, and there are no string prefixes to store) and more on 64-bit platforms. The 16-bit limits are generous. A procedure with more than 64K variables will take forever to compile (that is why we impose a 4K limit on the number of variables in inlining), and even the string tables of typecheck.m and make_hlds require less than four kilobytes each. Exceeding the limits would require code no human would write. Automatically generated code may be a problem, but the help the debugger can give on such code is limited already. In any case, we detect overflows and handle them sensibly. This change does not enhance the debugger to take advantage of the easier availability of variable numbers, except to improve the implementation of retry; that will come later. The inclusion of the procedure table in the module layout structure reduces the cost of registering all procedures in all modules, a task usually performed at the time of the setting of the first breakpoint. This used to require processing all the internal labels in the label table, and thus used to take a few seconds for large executables. The sweep of all internal labels is no longer required, so registering is now much faster. runtime/mercury_stack_layout.h: Add the definition of MR_Module_Layout. Modify label layouts to represent names as offsets in the string table, not as raw character pointers. This required modifing proc layouts to include a pointer to the module's layout, so you can find the string table. Update the macros that look up variable names. runtime/mercury_layout_util.h: Use the updated macros for looking up variable names. runtime/mercury_wrapper.[ch]: Add a new indirect pointer, MR_register_module_layout, which points to a function that registers a module layout, or is NULL if debugging is not enabled. runtime/mercury_init.h: Declare the function whose address may be assigned to MR_register_module_layout in a <main>_init.c file. util/mkinit.c: Initialize MR_register_module_layout with either the address of MR_register_module_layout_real or NULL, depending on whether debugging is enabled or not. compiler/continuation_info.m: Don't give names (V_n) to nameless variables, because we don't want them to be included in the variables debugging knows about. compiler/llds.m: Add a new function symbol to the type data_addr, which stands for the module layout structure of the named (now always the current) module. Add a new function symbol to the type rval_const. The new function symbols, multi_string_const, contains an array of characters of an explicitly given length, which consists of several strings, each terminated by a null character. compiler/llds_out.m: Accommodate the changes to llds.m, and expand the module initialization code to register the module layout structure, if the pointer to the registration function is not NULL. compiler/stack_layout.m: Generate the new data structures for representing variable names, as well as the module layout. compiler/mercury_compile.m: Rename some variables to reflect the fact that stack_layout.m can now include a module layout structure in the list of static layout structures it returns. compiler/dupelim.m: compiler/exprn_aux.m: compiler/jumpopt.m: compiler/opt_debug.m: Minor changes to accommodate multi_string_consts. trace/mercury_trace_tables.[ch]: Replace the old data structures for recording information about each debuggable module with the module layout structure, and register module layout structures directly, instead of trying to discover them through the internal label table. trace/mercury_trace.[ch]: Now that it is more easily accessible, use variable numbers instead of variable names to find the current locations of the input arguments when implementing retry. Unlike our previous method, this works even if the user names some variables HeadVar__1, etc. Remove an unnecessary export of an internal function. trace/mercury_trace_external.c: trace/mercury_trace_internal.c: runtime/mercury_layout_util.c: Use the updated macros for looking up variable names. |
||
|
|
2bbf02daaf |
Use the same method of input for the browser as for the internal
Estimated hours taken: 5 Use the same method of input for the browser as for the internal tracer. Previously, the browser did input via the Mercury library and the internal tracer did input via readline (if available). This did not work properly if files were redirected into stdin, which meant that test cases could not be written for the browser. This change also adds a test case. browser/util.m: Add a predicate, util__trace_getline/4, which does input via the same method used by the internal debugger. browser/parse.m: Call util__trace_getline/4 instead of io__read_line/3. browser/browse.m: Pass the prompt to browser/parse.m as a string, rather than printing it before calling. trace/mercury_trace_internal.c: trace/mercury_trace_internal.h: Declare MR_trace_getline extern. runtime/mercury_init.h: runtime/mercury_wrapper.c: runtime/mercury_wrapper.h: util/mkinit.c: Make MR_trace_getline available to the browser via a function pointer. tests/debugger/Mmakefile: Add the new test case. tests/debugger/browser_test.m: tests/debugger/browser_test.inp: tests/debugger/browser_test.exp: The new test case. runtime/mercury_trace_base.c: runtime/mercury_trace_base.h: Export MR_tracing_not_enabled() for use by browser/util.m. |
||
|
|
dc03496d06 |
Rewrite significant parts of minimal model tabling so that it works
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.)
|
||
|
|
59f61e4edf |
Fix a bug causing the debugger tests to get link errors.
Estimated hours taken: 3
Fix a bug causing the debugger tests to get link errors.
browser/declarative_debugger.m:
Call MR_edt_root_node indirectly via MR_address_of_edt_root_node.
runtime/mercury_wrapper.{c,h}:
Add a global function pointer, MR_address_of_edt_root_node.
util/mkinit.c:
Make sure MR_address_of_edt_root_node is initialized.
trace/mercury_trace_declarative.c:
Define MR_edt_root_node even if the declarative debugger is not
used.
|
||
|
|
f9f4c73cd6 |
MR_trace_init_external() and MR_trace_final_external() are defined
Estimated hours taken: 2 MR_trace_init_external() and MR_trace_final_external() are defined in trace/mercury_trace_external.c but are also needed in runtime/mercury_trace_base.c. As we can not do direct calls from runtime/ to trace/, we do an indirect call via a function pointer address_of_trace_init_external. runtime/mercury_trace_base.c: Remove an out of date comment. runtime/mercury_init.h: runtime/mercury_wrapper.c: runtime/mercury_wrapper.h: Add prototype declaration for MR_trace_init_external() and MR_trace_final_external(). runtime/mercury_wrapper.h: util/mkinit.c: Remove useless prototypes. |
||
|
|
9d0fd6601a |
Add support to mdb for doing the debugger I/O in a different
Estimated hours taken: 4 Add support to mdb for doing the debugger I/O in a different window to the I/O of the program being debugged. (TODO: I/O from the browser still goes to the standard I/O streams rather than the debugger I/O streams. I will commit that soon as a separate change.) runtime/mercury_wrapper.h: runtime/mercury_wrapper.c: Add new runtime options for specifying filenames for the mdb I/O streams. doc/user_guide.texi: Document the new options. trace/mercury_trace_internal.c: Add three new variables holding the mdb I/O streams. Initialise them based on the option settings. Change the code so that all I/O goes through these streams. trace/mercury_trace_tables.c: trace/mercury_trace_tables.h: Pass a `void *' parameter through MR_process_matching_procedures() to the function it calls. This is needed by mercury_trace_internal.c to pass `MR_mdb_in' down to MR_print_proc_id_for_debugger(). runtime/mercury_stack_trace.c: runtime/mercury_stack_trace.h: Add a `FILE *' parameter to MR_print_proc_id_for_debugger(). tests/debugger/Mmakefile: When creating the `.out' files, redirect stderr as well as stdout, since debugger error messages now go to stderr rather than stdout. |
||
|
|
2236de7b28 |
Add some comments.
Estimated hours taken: 0.25 runtime/mercury_wrapper.h: runtime/mercury_layout_util.h: Add some comments. |
||
|
|
8a0ceb49aa |
This checkin has several major purposes, set out in the sections below,
Estimated hours taken: 240
This checkin has several major purposes, set out in the sections below,
all connected with the implementation of the new debugger command set.
DOCUMENT NEW DEBUG COMMAND SET
doc/user_guide.texi:
Add a new section on the debugger. The description of the commands
is complete, but some of the background sections, and the section
about how to build debuggable executables, are not yet done.
Update the documentation of the tracing options.
doc/generate_mdb_doc:
A new shell script that automatically converts some of the new
sections of the user guide into the online documentation of the
debugger.
doc/mdb_categories:
The fixed initial part of the online documentation.
doc/Mmakefile:
Add rules for creating mdb_doc, the file that is the online
documentation of the debugger, and for installing it together
with mdbrc.
Mmake.common.in:
Define INSTALL_DOC_DIR for doc/Mmakefile.
scripts/mdbrc.in:
A debugger command script that reads in the online documentation
and then defines some standard aliases.
configure.in:
Define the variable that scripts/mdb.in and scripts/mdbrc.in use
to find the right files, and get configure to perform the
substitutions.
configure.in:
scripts/mdb:
scripts/mdb.in:
Replace mdb with mdb.in. Mdb is now created during configuration
from mdb.in, filling in the name of the file that contains the default
debugger initialization commands.
util/info_to_mdb.c:
A program that does most of the work involved in automatically
converting user guide sections into online documentation.
(This couldn't easily be written in sh, because sh's read
command has no notion of pushback.)
util/Mmakefile:
Add info_to_mdb to the list of targets.
tools/bootcheck:
Make sure that the tests in tests/debugger are executed with an
initialization setup that is equivalent to what users will see
by default.
REORGANIZE TRACING OPTIONS
compiler/globals.m:
compiler/handle_options.m:
compiler/options.m:
compiler/trace.m:
Reorganize the handling of trace levels around the new options
--trace-internal, --trace-redo, and --trace-return.
compiler/*.m:
Use the new ways of getting at trace levels.
tests/hard_coded/typeclasses/Mmakefile:
s/--trace all/--trace deep/
SUPPORT RETRY
compiler/trace.m:
After every call to MR_trace(), emit code that checks whether it
should jump away, and if yes, performs the jump. This is used to
implement retry. (The debugger cannot execute the jump itself
because it is in the wrong C stack frame.)
compiler/llds.m:
compiler/continuation_info.m:
compiler/stack_layout.m:
Modify the data structures that record information about live
value at program points, to record the identity of each variable.
This is necessary for the implementation of the restart command,
since we do not want to confuse two distinct variables just because
they have the same name. For example, a variable whose name is X
and number is 5 is now recorded in the name array as "5:X".
Clean up the data structure a bit, so that we don't have to store
dummy names for values that are not variables.
compiler/*.m:
Minor changes to conform to the data structure changes.
runtime/mercury_stack_layout.h:
Redefine an existing macro to strip away the initial number: prefix
from the "name" of a variable (keeping its original function on
changed data), and add a new one to access the raw unstripped data.
runtime/mercury_init.h:
runtime/mercury_wrapper.h:
Update the prototype of MR_trace_{fake,real}, and the type of the
global that points to them.
runtime/mercury_layout_util.h:
Add an extra function, MR_get_register_number, for use by retry.
USE FIXED STACK SLOTS FOR TRACE INFO
compiler/code_gen.m:
compiler/code_info.m:
compiler/live_vars.m:
compiler/trace.m:
If execution tracing is enabled, reserve the first few stack slots
to hold the event number of the call event, the call number, the
call depth, the redo layout structure address (if generating redo
events) and the from_full flag at the time of call (if we are doing
shallow tracing). By allocating the first four of these to fixed stack
slots, the debugger knows where to look for them without having
to be told. It finds out the location of the fifth, if needed,
from a new slot in the proc layout structure. (It is not possible
to allocate all five to fixed stack slots without wasting stack space
in some cases.)
compiler/trace.m:
Remove from the call to MR_trace the parameters that are now in fixed
stack slots, since MR_trace can now look them up itself.
compiler/continuation_info.m:
compiler/stack_layout.m:
Add an extra field to the proc_layout_info. If the module is shallow
traced, this field says which stack slot holds the saved value of
MR_from_full. If it is not shallow traced, this field says that
there is no such stack slot.
runtime/mercury_stack_layout.h:
Add macros for accessing the fixed stack slots holding the event
number of the call event, the call number, the call depth, and,
at a redo event, the redo layout structure address.
Support the new field in proc layouts that gives the location of the
from-full flag (if any).
runtime/mercury_trace_base.[ch]:
trace/mercury_trace.[ch]:
Remove the call number and call depth arguments from MR_trace
and its avatars, since this info is now in fixed stack slots
in every procedure that can call MR_trace. This should reduce
the size of the executable significantly, since there are lots
of calls to MR_trace.
runtime/mercury_init.h:
runtime/mercury_wrapper.h:
Update the prototype of MR_trace_{fake,real}, and the type of the
global that points to them.
START NUMBERING FRAMEVARS FROM ONE
compiler/code_info.m:
compiler/live_vars.m:
compiler/llds_out.m:
compiler/trace.m:
Start numbering framevars from 1 internally to the compiler;
the runtime already starts from 1. This simplifies several tasks.
ADD REDO EVENTS
compiler/trace.m:
compiler/code_gen.m:
Before the code that executes "succeed()", emit code to push a
a temp nondet frame whose redoip points to a label in the runtime
that calls MR_trace for a REDO event and then fails, provided
--trace-redo is set.
compiler/llds.m:
Add a new code address constant, do_trace_redo_fail, which stands
for the address in the trace system to which calls MR_trace for
the redo event and then fails.
compiler/trace.m:
compiler/llds_out.m:
Provided we are doing redo tracing, fill in the slot that holds
the layout information for the REDO event.
compiler/*.m:
Minor changes to conform to handle the new code address constant.
browser/debugger_interface.m:
Add redo to trace_port_type.
runtime/mercury_trace_base.[ch]:
Add a C module containing the code that calls MR_trace for REDO
events.
ENSURE THAT INPUT ARGUMENTS ARE ALWAYS VISIBLE
compiler/trace.m:
When generating the set of live variables at internal ports,
the variables that are in the pre-death set of the goal into which
we are entering may not be available. However, the variables in the
pre-death set that are also in the resume vars set will be available,
so now include info about them in the layout structure for the event.
Since with tracing the non-clobbered input args are in all resume vars
sets, this ensures that these input args will be available from all
internal events.
compiler/code_info.m:
Export a previously internal predicate (current_resume_point_vars)
to make this possible.
BUG FIX: WANT RETURN LAYOUTS
compiler/globals.m:
compiler/call_gen.m:
compiler/code_info.m:
compiler/mercury_compile.m:
Add a new pred globals__want_return_layouts, which says whether the
compiler should generate layout structures for call returns. This pred
centralizes the several previous copies of the test. One of those
copies (the one in call_gen) was faulty, leading to a bug: in the
presence of execution tracing but the absence of accurate gc,
information about the variables that are live at the call return
wasn't being gathered properly.
BUG FIX: #include mercury_trace_base.h
compiler/llds_out.m:
#include mercury_trace_base.h, not mercury_trace.h, since now
mercury_trace_base.h defines everything directly accessible from
modules compiled with tracing.
RECAST MERCURY_TRACE_UTIL AS MERCURY_LAYOUT_UTIL
runtime/mercury_trace_util.[ch]:
runtime/mercury_layout_util.[ch]:
Rename this module from trace_util to layout_util, since it is also
used by the native garbage collector. Remove "trace" from the names
of functions.
Get rid of the global variable MR_saved_regs, and instead thread
a pointer to this data structure through the relevant functions
as an extra argument.
Add a lot more documentation in the header file.
runtime/Mmakefile:
Reflect the module rename.
runtime/*.c:
Refer to the new module.
DELETE EASY-TO-MISUSE MACROS
runtime/mercury_stacks.h:
Delete the based_framevar and based_detstackvar macros, since their
continued use can lead to off-by-one errors, and the saved_framevar
and saved_detstackvar macros, since they are no longer used.
runtime/*.c
Update any references to any macros removed from mercury_stacks.h.
MISC RUNTIME CHANGES
runtime/mercury_trace_base.[ch]:
trace/mercury_trace*.[ch]:
Make typedef'd names conform to the naming convention.
Make MR_trace_call_{seqno,depth} consistently Unsigned, rather than
sometimes Word and sometimes Unsigned.
FIX BUG: MAKE THE DEBUGGER PRINT TO STDOUT, NOT THE CURRENT STREAM
library/io.m:
Export to C code the predicates that return the identities and types
of stdin, stdout and stderr, as well as io__print/[34].
library/std_util.m:
Export to C code a predicate that returns the type_info for the
type stdutil:type_info. This type_info is required if C code
wants to invoke make_permanent on any type_info structure,
as the debugger does.
runtime/mercury_init.h:
Add extern declarations for the C functions now exported from io.m.
runtime/mercury_wrapper.[ch]:
Add new global variables to hold the addresses of these C functions.
runtime/mercury_layout_util.c:
Use indirect calls through these global variables to print Mercury
values, instead of lower-level code.
util/mkinit.c:
Assign the addresses of the functions exported from io.m to the
global variables defined in mercury_wrapper.h.
BUG FIX: STACK TRACE FUNCTIONS DEPEND ON THE LABEL TABLE
runtime/mercury_stack_trace.c:
On entry to any of the functions exported from this module,
ensure that the label table is loaded by calling do_init_modules.
Without a filled-in label table, the stack trace will not be able to
find any stack layout info.
BUG FIX: REMOVE BROWSER/*.C
configure.in:
When removing .c files generated by the C compiler, remove those
in the browser directory as well as the compiler, library and
profiler directories.
IMPLEMENT NEW DEBUGGER COMMAND SET
runtime/mercury_stack_trace.[ch]:
Factor out the code that prints the id of a procedure into a function
of its own, so that it can also be used from the debugger, ensuring
appearance commonality.
Add more documentation in the header file.
trace/mercury_trace_internal.c:
Implement the proposed command set. Command names are now words,
and several commands now have options allowing the user to override
the default print level or strictness of the command, or the
invocation conditions or action of a break point. Allows control
over command echoing and the scrolling of sequences of event reports.
Supports aliases, command file sourcing etc. Implements the retry
command, using the info in the fixed stack slots.
trace/mercury_trace.[ch]:
Extend the trace controls to support the new functionalities
required by the new debugger language, which are print levels,
variable-strictness commands, a more flexible finish command,
and the retry command.
Pass the command structure to MR_trace_event_report, since
the user can now forcibly terminate the scrolling of reports.
trace/mercury_trace_alias.[ch]:
New module to manage aliases for the debugger.
trace/mercury_trace_help.[ch]:
New module to interface to browser/help.m.
trace/mercury_trace_spy.[ch]:
New module to manage break points. The test of whether an event
matches a break point is now much more efficient than before.
The new module also allows several breakpoints with different
actions and different invocation conditions (e.g. all ports,
entry port, interface ports or specific (possibly internal) port)
to be defined on the same procedure.
trace/mercury_trace_tables.[ch]:
New module to manage a table of the debuggable modules, in which
each such module is linked to the list of the layouts of all the
procedures defined in that module. This information allows the
debugger to turn the name of a predicate/function (possibly together
with its arity and mode number) into the procedure layout structure
required by the spy point module. Eventually it may also be useful
in supplying lists of identifiers for command line completion.
Modules for which no stack layout information is available will
not be included in the table, since do_init_modules will not
register any labels for them in the label table.
trace/Mmakefile:
Mention the new files.
runtime/mercury_array_macros.h:
A new file holding macros that can be useful in more than one module.
runtime/Mmakefile:
Mention the new file.
runtime/mercury_conf.h.in:
Mention a new configuration macro, MR_CANNOT_USE_STRUCTURE_ASSIGNMENT,
used by runtime/mercury_array_macros.h.
configure.in:
Find out whether we need to define MR_CANNOT_USE_STRUCTURE_ASSIGNMENT.
ADD TRACE DEPTH HISTOGRAMS
runtime/mercury_conf_param.h:
Document MR_TRACE_HISTOGRAM.
runtime/mercury_trace_base.[ch]:
Define the data structures for the histogram, and print the histogram
when a traced program exits if MR_TRACE_HISTOGRAM is set.
trace/mercury_trace.[ch]:
If MR_TRACE_HISTOGRAM is defined, record a count of the number of
events at each depth. This information can help us evaluate space-time
tradeoffs.
FACTOR OUT SHELL CODE HANDLING GRADE IMPLICATIONS
scripts/final_grade_options.sh-subr:
A new file to contain any code that implements implications between
grade flags; currently implements the implication debug -> use trail.
scripts/mgnuc.in:
scripts/ml.in:
Replace the code that is now in final_grade_options.sh-subr with
an inclusion of final_grade_options.sh-subr.
configure.in:
Handle final_grade_options.sh-subr as {init,parse}_grade_options.sh-subr
are handled.
SIMPLIFY THE MAINTAINANCE OF CONSISTENCY BETWEEN DEBUGGER CODE AND DOCUMENTATION
doc/Mmakefile:
Add rules for creating mdb_command_list, a C code fragment
that can included manually in trace/mercury_trace_internal.c
to supply the list of valid commands, and mdb_command_test.inp,
which is a list of invalid invocations of debugger commands,
which tests whether the help message for such invocations
can be located as expected.
doc/generate_mdb_command_list:
doc/generate_mdb_command_test:
Awk scripts to create mdb_command_list and mdb_command_test.inp
respectively from mdb_doc.
tools/bootcheck:
Copy mdb_command_test.inp from doc to tests/debugger.
tests/debugger/Mmakefile:
Add a new test that checks whether we get an internal error, unable
to locate the right help node, for each invalid command invocation in
mdb_command_test.inp.
UPDATE TEST CASES
tests/debugger/Mmakefile:
Reenable queens. Conform to the new set of options.
tests/debugger/*.inp:
tests/debugger/*.exp:
Update the inputs and expected outputs of the debugger test cases
to use the new command set and output formats.
|
||
|
|
8ddce575d4 |
Introduce two new directories, trace and browser, containing libraries
Estimated hours taken: 10
Introduce two new directories, trace and browser, containing libraries
holding the C and Mercury code of the debugger respectively. (Although
the browser directory does not have a browser in it yet, the browser
should soon become its biggest component.) Take the opportunity to
rename the existing libraries, for consistency.
After this change, the linking order becomes:
the object of the auto-generated init file
program object files
trace library (libmer_trace.a)
browser library (libmer_browser.a)
standard library (libmer_std.a)
runtime library (libmer_rt.a)
Boehm collector (libgc.a)
To avoid circularities, libraries cannot contain direct calls to
any routines that are defined in libraries (or object files) that
occur earlier in the above list. Any such calls must be made into
indirect calls via function pointers.
In particular, there was a circularity caused by the library calling
MR_trace() which invokes the tracer which in turn invokes the
library. This circularity was broken by having MR_trace(),
which is defined in the runtime, call the tracer indirectly via
a global variable named MR_trace_func_ptr. This global variable
is initialized by the auto-generated *_init.c file.
To avoid linking in the tracer even when it is not being used,
this global variable is only set to point to MR_trace_real()
if you're using a debugging grade or if c2init was invoked
with the `-t' flag. Otherwise it is set to MR_trace_fake()
which just prints an error message telling the user to
rebuild the executable with debugging enabled.
Makefile.DLLs:
Reserve random locations for the two new libraries. Whether they work
will be decided by testing on Windows.
Mmake.common.in:
Add variables naming the new directories, and create variables
naming the libraries.
Mmakefile:
Add targets for the new directories, and modify existing rules
as appropriate.
browser/Mmakefile:
Mmakefile for the new directory, modelled on library/Mmakefile.
browser/browser_library.m:
Umbrella file for the new directory, modelled on library/library.m.
{browser,library}/debugger_interface.m:
Moved this file from library to browser without change.
browser/help.m:
A new module for the help system of the debugger. Not yet used.
compiler/Mmakefile:
Update to refer to the new directories and libraries where
appropriate.
compiler/mercury_compile.m:
If we are doing tracing, then pass -t instead of -i to c2init.
compiler/modules.m:
When generating the .dep file, get the grade flags passed to c2init.
doc/Mmakefile:
Remove the special treatment of library/debugger_interface.m.
library/Mmakefile:
Update to refer to the new directories and libraries where
appropriate, and to conform to the new name of the library.
library/library.m:
Do not import debugger_interface.
profiler/Mmakefile:
Update to refer to the new directories and libraries where
appropriate.
runtime/Mmakefile:
Update to refer to the new directories and libraries where
appropriate, and to conform to the new name of the library.
Remove references to files being moved to the trace directory.
runtime/mercury_init.h:
Refer to the automatically generated dll header file by its new name
(renamed because the runtime library is renamed).
Add declarations to support the new global variable MR_trace_func_ptr.
runtime/mercury_memory_handlers.c:
runtime/mercury_memory_zones.c:
runtime/mercury_misc.c:
Remove inappropriate #includes of "mercury_trace.h", and substitute
a #include of "mercury_trace_base.h" if necessary.
{runtime,trace}/mercury_trace.[ch]:
{runtime,trace}/mercury_trace_external.[ch]:
{runtime,trace}/mercury_trace_internal.[ch]:
Move these files from the runtime to the trace directory.
The only changes are the removal from mercury_trace.h of declarations
added to runtime/mercury_trace_base.h, and the change from MR_trace
to MR_trace_real.
runtime/mercury_trace_base.[ch]:
Define MR_trace(), which does an indirect call through
MR_trace_func_ptr if the event should be traced.
Define MR_trace_fake, which just prints an error message.
Its address will be assigned to MR_trace_func_ptr if tracing
is not enabled.
Define the types needed by the signature of MR_trace.
Fix an old bug: s/MERCURY_TRACE_PERMANENT_H/MERCURY_TRACE_BASE_H/.
runtime/mercury_wrapper.[ch]:
Add the new global variable MR_trace_func_ptr.
scripts/c2init.in:
Add a new option, -t/--trace, which enables tracing by causing the
address of MR_trace_real to be assigned to MR_trace_func_ptr.
Have this option be implied by the grade. Also have the old option
-i (need initialization code) be implied by the grade, as well as by
-t.
scripts/ml.in:
Include the new libraries in the link command.
tests/debugger/Mmakefile:
Include -t instead of -i in the list of c2init options. (-t implies
-i.)
tools/bootcheck:
Copy and build the new directories as appropriate. The trace directory
is treated like the runtime, the browser directory is treated like the
library.
trace/Mmakefile:
Mmakefile for the new directory, modelled on runtime/Mmakefile.
util/mkinit.c:
Add the new option -t, as discussed above.
Mmakefile for the new directory, modelled on runtime/Mmakefile.
util/Mmakefile:
Specify -O0, since with the default optimization level, gcc on
cyclone ignores the assignment of TRUE to need_tracing when -t is
given (!!!).
|
||
|
|
c961dac3e6 |
This change implements one by one retrieval of live variables within the
Estimated hours taken: 50 This change implements one by one retrieval of live variables within the external debugger. To do so, we basically need two new primitives at the debugger user disposal: 'current_live_var_names/0' to retrieve the live variables names and their types (to let user chose which variable he wants to retrieve) and 'current_nth_var/1' to retrieve the live variable given in argument. library/debugger_interface.m: Implement new predicates that are called in mercury_trace_external.c: output_current_nth_var/5 send to the debugger process the requested live variable. output_current_live_var_names/6 send to the debugger process the list of the internal names of the currently live variables and the list of their corresponding types. get_var_number/1 returns the integer 'n' where its argument is of the form 'current_nth_var(n)'. library/std_util.m: Export type_name/1; is is needed to convert type_info into string in mercury_trace_external.c. runtime/mercury_init.h: Add prototype declarations for the new procedures. runtime/mercury_trace_external.c: MR_output_current_nth_var() calls the predicate output_current_nth_var/5 defined in library/debugger_interface.m. MR_output_current_live_var_names() calls the predicate output_current_live_var_names/6 defined in library/debugger_interface.m. MR_trace_make_type_list() returns the list of the types of the live variables. MR_trace_make_nth_var() returns the requested live variables. MR_get_var_number() calls the predicate get_var_number/1 defined in library/debugger_interface.m. runtime/mercury_trace_util.c: runtime/mercury_trace_util.h: Define a new function MR_trace_get_type() that retrieves the type_info of a live variable. It is the same function as MR_trace_get_type_and_value() except it does not retrieves the value. Abstract away the code by folding duplicated code into 2 new functions MR_trace_get_type_and_value_filtered() and MR_trace_get_type_filtered(). runtime/mercury_wrapper.h: Declare prototypes of new procedures. util/mkinit.c: Handling new procedures. |
||
|
|
2064c02b2e |
There are 2 parts in this change (1) do not test whether or not an attribute is
Estimated hours taken: 30 There are 2 parts in this change (1) do not test whether or not an attribute is wanted to retrieve it and (2) make the retrieval of arguments and other slots done separately. The rationale for (1) is to reduce the average size of the messages sent to the socket; for small fields, it takes less socket traffic to always send the value, since it avoids the need to send a `bool' in the request and a `maybe(T)' in the response. The rationale for (2) is that since arguments slot can be very big, we still want to be able to retrieve any slot without retrieving arguments; so we retrieve that slot separately. library/debugger_interface.m: Split 'current' requests into 'current_var' and 'current_slots'; 'current_vars' requests for live variables and 'current_slots' for the other slots. output_current_slots/13 is a new predicate that sends to the debugger all the slots of the current event, except the argument slot. output_current_var/5 is a new predicate that sends to the debugger the list of currently live variables and the list of their internal names. runtime/mercury_trace_external.c: Delete MR_output_current(); define MR_output_current_slots() and MR_output_current_vars(). Define a function MR_trace_make_var_name_list() that returns the list of the internal name of the currently live variables. runtime/mercury_init.h: Declare prototypes of ML_DI_output_current_vars and ML_DI_output_current_slots. runtime/mercury_wrapper.h: Declare prototypes of MR_DI_output_current_vars and MR_DI_output_current_slots. util/mkinit.c: Link MR_DI_output_current_vars to ML_DI_output_current_vars and MR_DI_output_current_slots to ML_DI_output_current_slots. |
||
|
|
376f2c69af |
An initial implementation of the accurate garbage collector.
Estimated hours taken: 90 An initial implementation of the accurate garbage collector. WORK_IN_PROGRESS: Add an entry for the accurate garbage collector. library/builtin.m: library/mercury_builtin.m: library/std_util.m: runtime/mercury_tabling.h: Deep copy terms using the address of the value instead of just the value. library/io.m: Initialize the garbage collector's rootset with the globals. runtime/Mmakefile: Add new files to the Mmakefile. runtime/mercury_accurate_gc.h: runtime/mercury_accurate_gc.c: The new garbage collector. runtime/mercury_agc_debug.c: runtime/mercury_agc_debug.h: Debugging utilities for the new garbage collector. runtime/mercury_deep_copy.c: runtime/mercury_deep_copy.h: runtime/mercury_deep_copy_body.h: Put the deep copy code in mercury_deep_copy_body.h, and #include it with appropriate #defines in order to get a variant for deep_copy(), and one for agc_deep_copy(). agc_deep_copy() forwards pointers as it copies. Also, deep_copy (all variants) have been modified to take a pointer to the data to be copied, because some variants need to be able to modify it. runtime/mercury_engine.c: runtime/mercury_engine.h: Add a second heap_zone which is the to-space of the copying collector. Add a debug_heap_zone, which is used as a scratch heap for debugging. runtime/mercury_label.c: Instead of realloc(entry_table, ....) do entry_table = realloc(entry_table, ....) to avoid horrible bugs. Also, make sure the tables get initialized before looking up an entry label. runtime/mercury_imp.h: Include mercury_debug.h before most of the modules. (mercury_engine.h adds a new MemoryZone only if we are debugging accurate GC). runtime/mercury_memory.c: Setup the debug_memory_zone sizes. Remove an unnecessary prototype. runtime/mercury_memory_handlers.c: Add code to get the program counter and the stack pointer from the signal context. Call MR_schedule_agc() from default_handler() if doing accurate gc. runtime/mercury_memory_zones.c: Setup the hardzone regardless of whether redzones are used. Add some more debugging information. runtime/mercury_regorder.h: runtime/machdeps/alpha_regs.h: runtime/machdeps/i386_regs.h: Add definitions to make the real machine registers name/number for MR_sp available. runtime/mercury_trace_internal.c: runtime/mercury_trace_util.c: runtime/mercury_trace_util.h: Add MR_trace_write_variable(), which writes terms given their value and type_info. runtime/mercury_wrapper.c: runtime/mercury_wrapper.h: Change the size of the heap redzone when doing accurate GC. Use a small heap when debugging agc. runtime/mercury_debug.h: runtime/mercury_conf_param.h: Add new debugging macros and document them. runtime/mercury_type_info.c: Add const to the pointer arguments of MR_make_type_info. |
||
|
|
72b57a9569 |
Fix obsolete references to old file names.
Estimated hours taken: 0.1 runtime/mercury_context.c: runtime/mercury_goto.h: runtime/mercury_ho_call.c: runtime/mercury_regs.h: runtime/mercury_wrapper.h: Fix obsolete references to old file names. |
||
|
|
9cbccbd5dc |
This change adds a new extras directory, "references".
Estimated hours taken: 70 (plus whatever pets spent when he wrote the original version of this) This change adds a new extras directory, "references". This directory contains two impure reference type modules and a module that allows scoped non-backtrackable update, along with examples of using them and tests. These modules are intended to be useful when HAL is retargetted to Mercury, for implementing global variables (backtracking and non-backtracking), and may also be useful for the debugger. In order to implement these features, a new memory zone "global heap" was added to the runtime system, for a heap which is not reclaimed on failure, along with a pair of functions for copying terms to this heap. runtime/mercury_deep_copy.c: runtime/mercury_deep_copy.h: Added two functions, MR_make_permanent() and MR_make_partially_permanent(), which essentially do a deep copy of a term to the global heap. (In conservative GC grades, these functions actually do nothing). runtime/mercury_engine.c: runtime/mercury_engine.h: Added fields global_heap_zone and e_global_hp (for the global heap and its heap pointer) to the MR_mercury_engine_struct, along with appropriate initialisation, etc. Defined MR_heap_zone, MR_solutions_heap_zone, and MR_global_heap_zone for convenient access to the corresponding field of the relevant Mercury engine. runtime/mercury_memory.c: Added code for handling the size and zone size of the global heap. runtime/mercury_regorder.h: runtime/mercury_regs.h: Defined MR_global_hp (the global heap pointer for general use), along with corresponding other changes. runtime/mercury_wrapper.c: runtime/mercury_wrapper.h: Added declarations and initialisation of the size and zone_size of the global_heap. Added an entry for MR_GLOBAL_HP_RN to print_register_usage_counts() (plus missing entries for MR_SOL_HP_RN, MR_MIN_HP_REC and MR_MIN_SOL_HP_REC). New files: extras/references/Mmakefile: Mmakefile for building and testing these modules. extras/references/README: Description of contents of this directory. extras/references/global.m: A wrapper module for building a library containing the nb_reference, reference and scoped_update modules. extras/references/nb_reference.m: Implements references which are not backtracked on failure. extras/references/reference.m: Implements references which *are* backtracked on failure. extras/references/scoped_update.m: Allows nested scoping of non-backtracking references. extras/references/samples/Mmakefile: extras/references/samples/max_of.m: extras/references/samples/max_test.exp: extras/references/samples/max_test.m: An example of using a non-backtracking reference (to find the maximum of the solutions generated by a predicate), with tests. extras/references/tests/Mmakefile: extras/references/tests/ref_test.exp: extras/references/tests/ref_test.m: Some tests of references (backtracking and non-backtracking) and scoping. |
||
|
|
67d8308260 | Same as previous message. | ||
|
|
a16424f6a1 |
Add support to the Mercury tracer for interacting with an external
Estimated hours taken: 24 Add support to the Mercury tracer for interacting with an external Opium-style debugger via a socket. TODO: currently there is no way for the debugger to specify constraints on the arguments for a `forward_move' query. The current code for doing that doesn't work. (However, the reporting of arguments to the debugger for an `output_current' query works fine.) runtime/mercury_trace.c: Add code to MR_trace() to open a socket connection to an external debugger, and to process requests from that debugger, and send responses back. runtime/mercury_trace.h: runtime/mercury_wrapper.c: Call MR_trace_end() from mercury_runtime_terminate() so that the external debugger gets notified when the program does a (normal) exit. runtime/mercury_stack_layout.h: Fix a bug where the structures here did not match the output produced by compiler/stack_layout.m. library/debugger_interface.m: New file. Declares the Mercury types used for the debugger socket interface and defines support routines used by runtime/mercury_trace.c. library/io.m: runtime/mercury_types.h: Move the definition of MercuryFile from library/io.m to runtime/mercury_types.h, for use by runtime/mercury_trace.c. library/io.m: When printing out values of type `c_pointer', print out the "<<c_pointer>>" string in single quotes, to ensure that it has valid syntax for a Prolog or Mercury term. This is necessary because otherwise c_pointers in procedure arguments could lead to the Mercury process sending a syntactically invalid term down the socket to the debugger, which would then be unable to parse it. library/library.m: Add reference to debugger_interface.m, so that it gets include in libmercury.a. doc/Mmakefile: Make sure that the library/debugger_interface.m does *not* get included in the Mercury library reference manual. runtime/mercury_wrapper.h: runtime/mercury_wrapper.c: runtime/mercury_init.h: util/mkinit.c: Declare, define, and initialize pointers to the C functions exported by library/debugger_interface.m. (This is to avoid having a circular dependency where the runtime depends on the library.) compiler/notes/authors.html: Add Erwan Jahier. |
||
|
|
5ef3bb6fdc |
Use stack layout tables to transmit information to the tracer, to allow
Estimated hours taken: 20
Use stack layout tables to transmit information to the tracer, to allow
the tracer to print the names and values of variables at CALL and EXIT ports.
Extend stack layout tables to permit this.
For the time being the tables do not contain information about how to fill
in pseudo-typeinfos, so printing only works for monomorphic procedures.
compiler/llds.m:
Allow space for variable names in the information we gather about live
variables at given labels.
compiler/llds_out.m:
Print out variable names in the information we gather about live
variables at given labels in comments.
compiler/continuation_info.m:
Include variable names in the information we gather about live
variables at given labels.
Record the determinism of each procedure, not its code model.
compiler/{call_gen,code_gen,code_info}.m:
Include the names of variables in the data given to
continuation_info.m.
compiler/options.m:
Add a new developer-only option, --procid-stack-layout, whose effect
is to extend stack_layout structures with static info identifying the
procedure. This is used by execution tracing, and could (should) be
used by stack tracing and profiling.
Rename --alternate-liveness as --typeinfo-liveness. This is more
expressive. Later we should add a new option --trace-liveness, which
preserves every variable until the end of the clause for use by
the trace debugger.
compiler/handle_options.m:
Handle the option implications of --procid-stack-layout.
compiler/stack_layout.m:
Include the encoded determinism instead of the code model in stack
layout tables.
Include variable names in the live data section of stack layout tables
if they are available.
Include procedure identification information in the stack layout tables
if --procid-stack-layout is set.
compiler/trace.m:
Use the new interface to MR_trace.
compiler/*.m:
Trivial changes following from the renaming of --alternate-liveness.
runtime/mercury_accurate_gc.h:
Add macros to decode encoded determinisms.
Define structs for accessing the stack layout tables.
runtime/mercury_regs.h:
Define a macro similar to virtual_reg, except in that it can refer
to an arbitrary memory area, not just fake_reg.
runtime/{mercury_string,mercury_types}.h:
Move the typedefs of Char, UnsignedChar, String and ConstString
from mercury_string.h to mercury_types.h to avoid problems with
circular #includes.
runtime/mercury_trace.[ch]:
Revise the interface to MR_trace so that it takes the layout table
of the procedure as an argument. From the layout table, we can get
to the module name, predicate name, arity, mode number, and
determinism of the procedure, so we don't need to pass these any more,
reducing parameter passing overhead. We can also get to information
about where the input and output arguments are. We now use this
information to allow the user to print out the value of the arguments
at the CALL and EXIT ports.
Change the prompt to a less intrusive "mtrace> ".
runtime/mercury_wrapper.[ch]:
Add a new global variable, MR_library_trace_browser. We reserve space
for this variable in mercury_wrapper.c. It will be initialized by the
automatically generated xxx_init.c file to point to the procedure
that the tracer will invoke to let the user browse the values of
variables. This mechanism allows the runtime to maintain its current
ignorance about the contents of the standard library.
util/mkinit.c:
Generate additional code in the xxx_init.c files to fill in the value
of MR_library_trace_browser.
tests/misc_tests/debugger_test.{inp,exp}:
Add a few printing commands into the input for this test case, and
update the expected output.
|
||
|
|
e6ac077bae |
Add support for memory profiling.
Estimated hours taken: 40 (+ unknown time by Zoltan)
Add support for memory profiling.
(A significant part of this change is actuallly Zoltan's work. Zoltan
did the changes to the compiler and a first go at the changes to the
runtime and library. I rewrote much of Zoltan's changes to the runtime
and library, added support for the new options/grades, added code to
interface with mprof, did the changes to the profiler, and wrote the
documentation.)
[TODO: add test cases.]
NEWS:
Mention support for memory profiling.
runtime/mercury_heap_profile.h:
runtime/mercury_heap_profile.c:
New files. These contain code to record heap profiling information.
runtime/mercury_heap.h:
Add new macros incr_hp_msg(), tag_incr_hp_msg(),
incr_hp_atomic_msg(), and tag_incr_hp_atomic_msg().
These are like the non-`msg' versions, except that if
PROFILE_MEMORY is defined, they also call MR_record_allocation()
from mercury_heap_profile.h to record heap profiling information.
Also, fix up the indentation in lots of places.
runtime/mercury_prof.h:
runtime/mercury_prof.c:
Added code to dump out memory profiling information to files
`Prof.MemoryWords' and `Prof.MemoryCells' (for use by mprof).
Change the format of the `Prof.Counts' file so that the
first line says what it is counting, the units, and a scale
factor. Prof.MemoryWords and Prof.MemoryCells can thus have
exactly the same format as Prof.Counts.
Also cleaned up the interface to mercury_prof.c a bit, and did
various other minor cleanups -- indentation changes, changes to
use MR_ prefixes, additional comments, etc.
runtime/mercury_prof_mem.h:
runtime/mercury_prof_mem.c:
Rename prof_malloc() as MR_prof_malloc().
Rename prof_make() as MR_PROF_NEW() and add MR_PROF_NEW_ARRAY().
runtime/mercury_wrapper.h:
Minor modifications to reflect the new interface to mercury_prof.c.
runtime/mercury_wrapper.c:
runtime/mercury_label.c:
Rename the old `-p' (primary cache size) option as `-C'.
Add a new `-p' option to disable profiling.
runtime/Mmakefile:
Add mercury_heap_profile.[ch].
Put the list of files in alphabetical order.
Delete some obsolete stuff for supporting `.mod' files.
Mention that libmer_dll.h and libmer_globals.h are
produced by Makefile.DLLs.
runtime/mercury_imp.h:
Mention that libmer_dll.h is produced by Makefile.DLLs.
runtime/mercury_dummy.c:
Change a comment to refer to libmer_dll.h rather than
libmer_globals.h.
compiler/llds.m:
Add a new field to `create' and `incr_hp' instructions
holding the name of the type, for heap profiling.
compiler/unify_gen.m:
Initialize the new field of `create' instructions with
the appropriate type name.
compiler/llds_out.m:
Output incr_hp_msg() / tag_incr_hp_msg() instead of
incr_hp() / tag_incr_hp().
compiler/*.m:
Minor changes to most files in the compiler back-end to
accomodate the new field in `incr_hp' and `create' instructions.
library/io.m:
Add `io__report_full_memory_stats'.
library/benchmarking.m:
Add `report_full_memory_stats'. This uses the information saved
by runtime/mercury_heap_profile.{c,h} to print out a report
of memory usage by procedures and by types.
Also modify `report_stats' to print out some of that information.
compiler/mercury_compile.m:
If `--statistics' is enabled, call io__report_full_memory_stats
at the end of main/2. This will print out full memory statistics,
if the compiler was compiled with memory profiling enabled.
compiler/options.m:
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/ml.in:
scripts/mgnuc.in:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Add new option `--memory-profiling' and new grade `.memprof'.
Add `--time-profiling' as a new synonym for `--profiling'.
Also add `--profile-memory' for more fine-grained control:
`--memory-profiling' implies both `--profile-memory' and
`--profile-calls'.
scripts/mprof_merge_runs:
Update to handle the new format of Prof.Counts and to
also merge Prof.MemoryWords and Prof.MemoryCells.
profiler/options.m:
profiler/mercury_profile.m:
Add new options `--profile memory-words' (`-m'),
`--profile memory-cells' (`-M') and `--profile time' (`-t').
Thes options make the profiler select a different count file,
Prof.MemoryWords or Prof.MemoryCells instead of Prof.Counts.
specific to time profiling.
profiler/read.m:
profiler/process_file.m:
profiler/prof_info.m:
profiler/generate_output.m:
Update to handle the new format of the counts file.
When reading the counts file, look at the first line of
the file to determine what is being profiled.
profiler/globals.m:
Add a new global variable `what_to_profile' that records
what is being profiled.
profiler/output.m:
Change the headings to reflect what is being profiled.
doc/user_guide.texi:
Document memory profiling.
Document new options.
doc/user_guide.texi:
compiler/options.m:
Comment out the documentation for `.proftime'/`--profile-time',
since doing time and call profiling seperately doesn't work,
because the code addresses change when you recompile with a
different grade. Ditto for `.profmem'/`--profile-memory'.
Also comment out the documentation for
`.profcalls'/`--profile-calls', since it is redundant --
`.memprof' produces the same information and more.
configure.in:
Build a `.memprof' grade. (Hmm, should we do this only
if `--enable-all-grades' is specified?)
Don't ever build a `.profcalls' grade.
|
||
|
|
bd19208eb9 |
Remove old .h files.
Estimated hours taken: 1 runtime/*.h: runtime/*.c: runtime/mercury_conf.h.in: Remove old .h files. Update #includes to refer to mercury_*.h Update #ifdef MODULE_H to be #ifdef MERCURY_MODULE_H |
||
|
|
523ef149e5 |
Add support for using ITIMER_REAL or ITIMER_VIRTUAL rather than ITIMER_PROF.
Estimated hours taken: 4 Add support for using ITIMER_REAL or ITIMER_VIRTUAL rather than ITIMER_PROF. This is useful on Unix because it lets you profile elapsed (real time) or just user time rather than user+system time. It is also essential on Windows because gnu-win32 only supports ITIMER_REAL (for the other two, setitimer() just returns an error). runtime/mercury_wrapper.h: runtime/mercury_wrapper.c: Add new options for selecting the time profiling method. runtime/mercury_prof.c: Use the new option settings to control the argument passed to setitimer(), and (since that in turn affects which signal will be sent) the argument to signal(). doc/user_guide.texi: Document the above changes. |
||
|
|
7ce7d489a2 |
Cleaned up runtime directory.
Estimated hours taken: 2 Cleaned up runtime directory. runtime/*.c: - Renamed all .c files as mercury_*.c Some have been renamed to make their purpose clearer. call.mod -> mercury_ho_call.c runtime/*.h: - Moved contents of .h files to mercury_*.h - *.h now contain #include mercury_*.h. They be removed later. - Updated references to conf.h -> mercury_conf.h runtime/conf.h.in: - Renamed conf.h.in as mercury_conf.h.in. Didn't leave a forwarding header for this one, as conf.h was never part of the repository anyway. runtime/Mmakefile: - Convert lists to one-per-line lists. - Add mercury_accurate_gc.h to HDRS. - Remove all .mod files - Make sure runtime.init uses the ORIG_CS not MOD_CS. - Fix the rules for "clean_o" and "clean_mod_c", which used wildcards like "*.o" to remove files. The one that removed all .c files corresponding with *.mod, instead of using MOD_CS was particularly vicious. - Cope with the file renamings. configure.in: - Cope with the file renamings. |