mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-12 12:26:29 +00:00
caa865fd92dd2806a074b79ee32ec0bda41f951b
12 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4954da84cc |
Reduce the dependence of the MLDS backend on the LLDS backend by moving
Estimated hours taken: 2 Branches: main Reduce the dependence of the MLDS backend on the LLDS backend by moving functionality dealing with proc_labels from the LLDS backend (code_util.m) to a new module, proc_label.m, which is part of backend_libs. compiler/code_util.m: compiler/proc_label.m: Move a type and some code from code_util to the new module. Convert predicates to functions as relevant. (The old code was written before functions were available). compiler/backend_libs.m: Add proc_label to the list of submodules. compiler/rtti.m: Rename a function to avoid a name clash with a function in proc_label.m. compiler/*.m: Conform to the changes above. Ensure that all imports of modules in the compiler directory are on lines of their own, to make CVS merges easier. Sort the imports. |
||
|
|
90d353d06c |
Implement concat_strings in Mercury.
Estimated hours taken: 2 Branches: main compiler/stack_layout.m: Implement concat_strings in Mercury. compiler/layout.m: compiler/layout_out.m: compiler/stack_layout.m: Use a separate type `string_with_0s' rather than `string' for strings which may contain null characters. |
||
|
|
2bef47ce85 |
Extend the information we record about procedures when debugging is enabled
Estimated hours taken: 20
Branches: main (for now, after more testing, on release branch too)
Extend the information we record about procedures when debugging is enabled
to include information about the tabling transformation, if the procedure
in question is tabled. This is useful to developers in debugging the tabling
mechanism, and can be useful to general users by helping them understand the
space (and hence time) costs of tabling.
Add a new mdb command "table" that uses this information to print
programmer-selected subsets of the tables of a tabled procedure.
compiler/hlds_pred.m:
Generalize the existing field in procedures that used to hold
information about I/O tabling to contain information about tabling
in general, including forms other than I/O tabling.
compiler/continuation_info.m:
compiler/code_gen.m:
compiler/stack_layout.m:
Conform to the changes in hlds_pred.m.
compiler/layout.m:
Provide Mercury parallels for the new data structures in
mercury_stack_layout.h.
compiler/layout_out.m:
Generate the new data structures in mercury_stack_layout.h.
compiler/table_gen.m:
Generate the new data structures in hlds_pred.m.
compiler/llds_common.m:
compiler/opt_debug.m:
Conform to the changes in layout.m
compiler/llds_out.m:
Abstract out existing code into a new procedure to make it available
to layout_out.m.
Make tabling pointer variables their natural type.
compiler/modules.m:
Fix an old bug: implicitly import table_builtin.m in .mm grades.
doc/mdb_categories:
doc/user_guide.texi:
Document the new mdb command "table".
runtime/mercury_types.h:
Move some type definitions here from mercury_tabling.h and
mercury_stack_layout.h. This was necessary to avoid problems with
circular #includes, in which a.h #includes b.h to get access to a
definition, but b.h #includes a.h, which is prevented by the macro
guarding against duplicate definition, which causes syntax errors
in the rest of b.h because the rest of b.h depends on typedefs in
a.h that occur in a.h *after* the #include of b.h.
runtime/mercury_label.h:
Adjust the list of #includes after the change to mercury_types.h.
runtime/mercury_stack_layout.h:
Extend the debugging data structures with constructs that describe
the call tables, answer tables and answer blocks of tabled procedures.
Delete typedefs that are now in mercury_types.h.
runtime/mercury_tabling.[ch]:
Add new functions to allow lookups without insertions in hash tables
containing ints, floats and strings.
Add new functions to return the entire contents of these hash tables.
Change to four-space indentation where this wasn't done previously.
runtime/mercury_grade.h:
Increment the binary compatbility version number, partially to
account for the change to mercury_stack_layout.h in this diff, but
mostly to account for all the other diffs to mercury_stack_layout.h
since the last released version.
trace/mercury_trace_tables.[ch]:
Rename MR_print_proc_id_for_debugger as MR_print_proc_id_and_nl,
since this better describes what the function does.
trace/mercury_trace_util.[ch]:
Add a new function MR_trace_is_integer that reads in signed integers.
Rename MR_trace_is_number as MR_trace_is_natural_number, since the
former would now be ambiguous.
Add a new function MR_trace_is_float that reads in floating point
values.
library/string.m:
Document that MR_trace_is_float uses the same logic as
MR_trace_is_float.
trace/mercury_trace_browse.c:
trace/mercury_trace_vars.c:
Update calls to MR_trace_is_number.
trace/mercury_trace_internal.c:
Implement the new mdb command "table".
Update calls to MR_trace_is_number and to
MR_print_proc_id_for_debugger.
tests/debugger/print_table.{m,inp,exp}:
New test case to test the new mdb command.
tests/debugger/Mmakefile:
Enable the new test case.
Disable the sensitive test cases in .mm grades.
tests/debugger/completion.exp:
Update the expected output to include the new mdb command.
tests/debugger/mdb_command_test.inp:
Update this automatically generated file to include the new mdb
command.
|
||
|
|
bdbf93e971 |
Delete trace level decl, since there was only a very small distinction
Estimated hours taken: 4 Branches: main Delete trace level decl, since there was only a very small distinction left between it and trace level deep, to wit, you could suppress events in trace level deep but not in trace level decl. Implement the relevant test more precisely by checking whether any event types *were* suppressed, as opposed to whether they *could have been* suppressed. Preserve the user interface by making --trace decl a synonym for --trace rep. compiler/layout.m: Include an integer encoding the set of suppressed event types in the module layout structures. compiler/trace_params.m: Add a function for computing this encoded integer. Delete trace level decl. compiler/stack_layout.m: Call that function when creating module layouts. compiler/layout_out.m: compiler/llds_out.m: compiler/llds_common.m: Handle the extra field in module layouts. doc/user_guide.texi: Delete or comment out all mentions of --trace decl and decldebug grades. runtime/mercury_trace_base.h: Update the list of places that know about the set of events. runtime/mercury_stack_layout.h: Delete trace level decl. Include an integer encoding the set of suppressed event types in the module layout structures. trace/mercury_trace_declarative.c: Accept trace level deep without any suppressed event types as sufficient to enable declarative debugging. tests/debugger/declarative/Mercury.options: Now that trace level deep is sufficient for declarative debugging, suppress the event types that weren't part of the old trace level deep, in order to elicit the warning message we are testing. tests/debugger/declarative/deep_warning.exp: Update the text of the warning message. |
||
|
|
37e1c49f78 |
Implement a flag that can be used by the compiler to signal to the debugger
Estimated hours taken: 1 Branches: main Implement a flag that can be used by the compiler to signal to the debugger that some events should be hidden from the user. The flag is not used yet. compiler/continuation_info.m: compiler/layout.m: Make room for the flag in the data structures storing information about events. compiler/layout_out.m: Output the flag in label layouts. runtime/mercury_stack_layout.h: Define a field for the flag in label layouts. compiler/trace.m: Specify "no" as the value of the hidden flag, for now. Later, when we add hidden events, we will specify "yes" for them. compiler/code_info.m: compiler/stack_layout.m: Pass on the value of the hidden flag. |
||
|
|
0b2c0c6b6c |
Remove the code that reserves two stack slots for declarative debugging.
Estimated hours taken: 0.5 Branches: main Remove the code that reserves two stack slots for declarative debugging. Now that code for MR_USE_DECL_STACK_SLOT no longer exists, there is no chance that the stack slots will be required. compiler/layout.m: Remove the maybe_decl_debug_slot field from proc_layout_exec_trace. compiler/layout_out.m: Don't print the field that was just removed. Update a couple of comments. compiler/trace.m: Remove the slot_decl field from trace_slot_info. Don't reserve the two slots. compiler/llds_common.m: compiler/code_info.m: compiler/stack_layout.m: Propagate the effects of the above changes. compiler/trace_params.m: Remove trace_level_needs_decl_debug_slots. runtime/mercury_stack_layout.h: Remove the MR_exec_maybe_decl_debug field from MR_Exec_Trace. runtime/mercury_conf_param.h: Don't document MR_USE_DECL_STACK_SLOT. trace/mercury_trace_declarative.c: Remove the prototypes of two unused functions whose definitions were removed earlier. |
||
|
|
f6f04fb5b3 |
To handle the tracing of dependencies in polymorphic predicates, the
Estimated hours taken: 4 Branches: main To handle the tracing of dependencies in polymorphic predicates, the declarative debugger will soon need to know, for each procedure, the full list of that procedure's head variables, not just the list of programmer-created head variables. To this end, we add to each procedure's layout structure a vector of the head variables' variable numbers. Code to make use of this new vector will be in a later change. compiler/layout.m; Add a way to refer to the head variable number vector. compiler/layout_out.m; compiler/opt_debug.m; Add code to output the head variable number vector. compiler/stack_layout.m; Add code to generate the head variable number vector. Fix some old variable names. runtime/mercury_stack_layout.h; Add the head variable number vector to procedure layouts. Add some missing documentation. |
||
|
|
7597790760 |
Use sub-modules to structure the modules in the Mercury compiler directory.
The main aim of this change is to make the overall, high-level structure of the compiler clearer, and to encourage better encapsulation of the major components. compiler/libs.m: compiler/backend_libs.m: compiler/parse_tree.m: compiler/hlds.m: compiler/check_hlds.m: compiler/transform_hlds.m: compiler/bytecode_backend.m: compiler/aditi_backend.m: compiler/ml_backend.m: compiler/ll_backend.m: compiler/top_level.m: New files. One module for each of the major components of the Mercury compiler. These modules contain (as separate sub-modules) all the other modules in the Mercury compiler, except gcc.m and mlds_to_gcc.m. Mmakefile: compiler/Mmakefile: Handle the fact that the top-level module is now `top_level', not `mercury_compile' (since `mercury_compile' is a sub-module of `top_level'). compiler/Mmakefile: Update settings of *FLAGS-<modulename> to use the appropriate nested module names. compiler/recompilation_check.m: compiler/recompilation_version.m: compiler/recompilation_usage.m: compiler/recompilation.check.m: compiler/recompilation.version.m: compiler/recompilation.version.m: Convert the `recompilation_*' modules into sub-modules of the `recompilation' module. compiler/*.m: compiler/*.pp: Module-qualify the module names in `:- module', `:- import_module', and `:- use_module' declarations. compiler/base_type_info.m: compiler/base_type_layout.m: Deleted these unused empty modules. compiler/prog_data.m: compiler/globals.m: Move the `foreign_language' type from prog_data to globals. compiler/mlds.m: compiler/ml_util.m: compiler/mlds_to_il.m: Import `globals', for `foreign_language'. Mmake.common.in: trace/Mmakefile: runtime/Mmakefile: Rename the %.check.c targets as %.check_hdr.c, to avoid conflicts with compiler/recompilation.check.c. |
||
|
|
13f0e7610a |
A large step towards declarative debugging of goals that do I/O.
Estimated hours taken: 40
Branches: main
A large step towards declarative debugging of goals that do I/O. This step
does everything needed for that except modify the declarative debugger itself;
that is for Mark to do.
If you give the new option --trace-table-io-decl, the transformation performed
by the compiler on I/O primitives will preserve not just the output arguments
of the primitive, so that the primitive can be "reexecuted" without performing
any side-effects, but also the input arguments and the identity of the I/O
primitive itself. The I/O table therefore will contain a list of the I/O
primitives executed by the program after I/O tabling is started.
You can test this via the new debugger commands "print action <action-number>"
and "browse action <action-number>".
The new option is currently not documented, because the declarative debugger
does not yet use the information it provides. The new debugger commands are
not documented because they are meant only for implementors, at least for
now.
Since this change adds a field to proc_layout structures, any workspaces
compiled with debugging enabled will need to do a cvs update when this change
is installed.
compiler/options.m:
Add the option --trace-table-io-decl. When set, this causes the
compiler to transform I/O action primitives to allow declarative
debugging of I/O actions.
compiler/handle_options.m:
Make --trace-table-io-decl imply --trace-table-io.
compiler/table_gen.m:
Perform the transformation, which is similar to the existing
--trace-table-io transformation, but preserves the identity of all
non-io-state arguments (not just the outputs) and the identity
of the I/O primitive itself.
Provide better names for variables generated by tabling
transformations.
compiler/hlds_goal.m:
Add extra parameters to procedures whose job it is to create new
goals to name the variables in those goals.
compiler/layout.m:
Add a new layout structure to contain the information the runtime
system needs to interpret the information saved by the new
transformation.
compiler/layout_out.m:
Output the new layout structure.
compiler/continuation_info.m:
Add a field to proc_layouts to point to the declarative I/O tabling
structure, and another to identify the proc_layout without using LLDS
types.
compiler/code_gen.m:
Provide the definition of this field when appropriate.
compiler/hlds_pred.m:
Add a field to proc_infos to store the information from the tabling
transformation until code generation.
compiler/stack_layout.m:
Add a mechanism for transforming the high level description of I/O
action tabling data in proc_infos to the low level description we need
to generate C data structures.
compiler/hlds_data.m:
Add a new cons_id and a new cons_tag; they are used to refer to I/O
tabling structures in code generated by the new transformation.
compiler/*.m:
Handle the updates to global data types above.
library/table_builtin.m:
Modernize some old code.
Fix an old off-by-one error: make I/O tabling use the first slot
in the I/O action table.
library/varset.m:
Add a mechanism for creating a variable that is named iff the caller
has a name for it.
runtime/mercury_layout_util.[ch]:
Add a function for materializing type parameters from an answer block,
not from registers or a closure.
runtime/mercury_stack_layout.h:
Declare a C type for the data structure holding information about
I/O primitives transformed by --trace-table-io-decl, and add a field
to proc_layout structures to point to these new structures.
Add a new evaluation method for --trace-table-io-decl.
runtime/mercury_tabling_macros.h:
Add some conditionally-compiled debugging code to the primitive for
saving answers.
trace/mercury_trace_vars.[ch]:
Add functions for printing I/O action goals.
trace/mercury_trace_internal.c:
Add code for recognizing and implementing commands to print I/O
action goals.
trace/mercury_trace.c:
Add code for handling the new eval method.
tests/debugger/tabled_read.{m,inp,exp*}:
Add a polymorphic I/O action primitive, add calls to it, and test
the printing of both monomorphic and polymorphic action goals.
tests/debugger/tabled_read_decl.{m,inp,exp*,data}:
A new test case. It does the same things as the new version of
tabled_read, but it is compiled with --trace-table-io-decl, not
just --trace-table-io. It therefore can (and does) test the printing
of tabled I/O actions.
tests/debugger/Mmakefile:
Add the new test case.
|
||
|
|
a9fed43d57 |
Major enhancements of the deep profiler. The most important ones are:
Estimated hours taken: 80 Branches: main Major enhancements of the deep profiler. The most important ones are: - The addition of several new classes of preferences, including: the use of colour, boxing, sorting, summarizing of higher order call sites, and time formats. - Making preferences persistent across different queries, so that once a preference is set, it "sticks" until the user changes it. Previously, preferences stuck during query sequences of the same command type. - Several new command types: - listing all the modules of the program - listing all the procedures in a module - listing all the callers of a procedure, grouped by calling call site, procedure, module, or clique, and filtering out certain classes of ancestors - jumping into the call graph close to the action - restarting the server (useful when the data file changes) - New optional columns showing time per call, allocations per call and words allocated per call. - Can now display memory consumption in bytes as well as words. - More robustness in the face of external events, e.g. machine shutdowns. - Fix a bug reported by Tom in the summaries of procedures that make higher order calls. The new functionality required adding some fields to ProcStatic structures; as a result, compilers and runtime systems that have this change are incompatible with compilers and runtime systems before this change in deep profiling grades. (They of course remain compatible in other grades.) compiler/deep_profiling.m: compiler/layout.m: compiler/layout_out.m: Add two new fields to ProcStatic structures, one giving the line number of procedure's context and one stating whether the procedure is exported from its module. compiler/layout.m: Be consistent about filename vs file_name in field names. compiler/*.m: Minor changes to handle the new fields. deep_profiler/interface.m: Define new command types, modify some of the parameters of existing ones, and delete obsolete ones. Define the types and predicates used by the new system of preferences, Update the predicates for recognizing and generating queries accordingly. Make the order of declarations and definitions more consistent. deep_profiler/split.m: Complete rewrite of the only predicate of this module. The old split predicate deleted any empty substrings resulting from the breakup of the original string. The new one preserves them, because they are needed by the new encoding scheme used in interface.m. deep_profiler/query.m: New module, containing code dealing with the computational issues of queries. Some of its code is old (from server.m), much of it is new. deep_profiler/html_format.m: New module, containing code dealing with HTML formatting. Some of its code is old (from server.m), much of it is new. deep_profiler/top_procs.m: New module, containing code dealing with issues involving sorting by various criteria. Some of its code is old (from server.m), much of it is new. deep_profiler/exclude.m: New module to handle contour exclusion. This means that when listing the callers of a procedure, we display the nearest parent that is *not* excluded by virtue of being in a given module. The set of modules so excluded forms a contour drawn through the program. deep_profiler/mdprof_cgi.m: deep_profiler/mdprof_server.m: deep_profiler/server.m: Minor changes to adapt to the new system of preferences. deep_profiler/array_util.m: Add a mode to foldl2. deep_profiler/io_combinator.m: Add predicates for reading in sequences of ten things. deep_profiler/measurements.m: Add a function needed by new code. deep_profiler/timeout.m: Make the profiler robust in the face of signals. deep_profiler/canonical.m: Some more work towards working canonicalization; not there yet. Move some procedures to profile.m, since other modules also need them now. deep_profiler/profile.m: Add the new fields to ProcStatic structures. Record the word size. Record more information about procedures whose activation counters are ever zeroed, in order to allow query.m to avoid giving misleading information in cases where a procedure calls itself through a higher order call site. Record information about the modules of the program. Add a bunch of lookup predicates, some moved from canonical.m. deep_profiler/call_graph.m: Minor changes to conform to changes in profile.m. deep_profiler/startup.m: Fill in the new parts of the profile data structure. deep_profiler/read_profile.m: Read the new fields in ProcStatic structures. Read in the id of the root node as a fixed part of the header, not as a node. Read in the word size. Make it easier to find all the debugging output sites. Record, for each call site which can call more than one procedure, whether this causes the caller's ProcStatic structure's activation count to be zeroed. runtime/mercury_deep_profiling.h: Add the new fields to ProcStatic structures. runtime/mercury_deep_profiling.c: Write out the new fields to ProcStatic structures. Write out the id of the root node as a fixed part of the header, not as a node. Write out the word size. Remove incorrect L suffixes on constants. Record that the artificial procedure "parent of main" is called once, not zero times, to avoid division by zero when computing per-call statistics. runtime/mercury_deep_profiling_hand.h: Add the new fields to the macros for creating ProcStatic structures. runtime/mercury_ho_call.c: library/array.m: library/builtin.m: library/exception.m: library/std_util.m: Add the new fields to the invocations of those macros. |
||
|
|
04e614485d |
Implement deep profiling; merge the changes on the deep2 branch back
Estimated hours taken: 500 Branches: main Implement deep profiling; merge the changes on the deep2 branch back onto the trunk. The main documentation on the general architecture of the deep profiler is the deep profiling paper. doc/user_guide.texi: Document how to use the deep profiler. deep_profiler: deep_profiler/Mmakefile: A new directory holding the deep profiler and its mmakefile. Mmakefile: Add targets for the new directory. Add support for removing inappropriate files from directories. deep_profiler/interface.m: The deep profiler consists of two programs: mdprof_cgi.m, which acts as a CGI "script", and mdprof_server.m, which implements the server process that the CGI script talks to. Interface.m defines the interface between them. script/mdprof.in: A shell script template. ../configure uses it to generate mdprof, which is a wrapper around mdprof_cgi that tells it how to find mdprof_server. deep_profiler/mdprof_cgi.m: The CGI "script" program. deep_profiler/mdprof_server.m: The top level predicates of the server. deep_profiler/profile.m: The main data structures of the server and their operations. deep_profiler/read_profile.m: Code for reading in profiling data files. deep_profiler/startup.m: Code for post-processing the information in profiling data files, propagating costs from procedures to their ancestors and performing various kinds of summaries. deep_profiler/server.m: Code for responding to requests from the CGI script. deep_profiler/cliques.m: Code to find cliques in graphs. deep_profiler/array_util.m: deep_profiler/util.m: Utility predicates. deep_profiler/dense_bitset.m: An implementation of (part of) the set ADT with dense bit vectors. deep_profiler/measurements.m: Operations on profiling measurements. deep_profiler/timeout.m: An implementation of a timeout facility. deep_profiler/conf.m: Functions that depend on autoconfigured settings. configure.in: Find out what command to use to find the name of the local host. Install deep profiling versions of the standard library along with the other profiling versions. runtime/mercury_conf.h.in: Add some macros for deep_profiler/conf.m to use. library/profiling_builtin.m: runtime/mercury_deep_call_port_body.h: runtime/mercury_deep_leave_port_body.h: runtime/mercury_deep_redo_port_body.h: A new library module that implements deep profiling primitives. Some of these primitives have many versions, whose common code is factor is factored out in three new include files in the runtime. compiler/deep_profiling.m: New module to perform the program transformations described in the paper. compiler/notes/compiler_design.html: Document the new compiler module. compiler/mercury_compiler.m: Invoke the new module in deep profiling grades. Allow global static data to be generated by deep_profiling.m. compiler/options.m: Add options to turn on deep profiling and (for benchmarking purposes) control its implementation. Add an optiooption disable tailcall optimization in the LLDS backend, to help benchmarking deep profiling. compiler/jumpopt.m: compiler/optimize.m: Obey the option to disable tailcalls. compiler/handle_options.m: Handle the implications of deep profiling. compiler/modules.m: In deep profiling grades, automatically import profiling_builtin.m. compiler/prog_util.m: doc/Makefile: library/library.m: Handle the new builtin module. compiler/export.m: In deep profiling grades, wrap deep profiling code around exported procedures to handle the "unscheduled call" aspects of callbacks to Mercury from the foreign language. compiler/higher_order.m: profiler/demangle.m: util/demangle.c: When creating a name for a higher-order-specialized predicate, include the mode number in the name. compiler/add_trail_ops.m: compiler/type_util.m: Move c_pointer_type from add_trail_ops to type_util, so it can also be used by deep_profiling.m. compiler/hlds_goal.m: Add a new goal feature that marks a tail call, for use by deep_profiling.m. compiler/hlds_pred.m: Add a new field to proc_info structures for use by deep_profiling.m. Add a mechanism for getting proc_ids for procedure clones. Remove next_proc_id, an obsolete and unused predicate. compiler/hlds_data.m: Add a new cons_id to refer to the proc_static structure of a procedure. compiler/bytecode_gen.m: compiler/code_util.m: compiler/dependency_graph.m: compiler/hlds_out.m: compiler/mercury_to_mercury.m: compiler/ml_unify_gen.m: compiler/opt_debug.m: compiler/prog_rep.m: compiler/rl_exprn.m: compiler/switch_util.m: compiler/unify_gen.m: Trivial changes to handle the new cons_id, goal feature and/or proc_info argument. compiler/rtti.m: Add a utility predicate for extracting pred_id and proc_id from an rtti_proc_label, for use by hlds_out.m compiler/layout.m: compiler/layout_out.m: compiler/llds.m: compiler/llds_common.m: Add support for proc_static and call_site_static structures. compiler/layout_out.m: compiler/llds_out.m: Add code for the output of proc_static structures. compiler/code_util.m: Make code_util__make_proc_label_from_rtti a function, and export it. util/mkinit.c: compiler/llds_out.m: compiler/layout.m: compiler/modules.m: Add support for a fourth per-module C function, for writing out proc_static structures (and the call_site_static structures they contains). Since proc_static structures can be referred to from LLDS code (and not just from other static structures and compiler-generated C code), reorganize the declarations of static structures slightly. Change the schema for the name of the first per-module C function slightly, to make it the addition of the fourth function easier. The scheme now is: mercury__<modulename>__init mercury__<modulename>__init_type_tables mercury__<modulename>__init_debugger mercury__<modulename>__write_out_proc_statics Improve formatting of the generated C code. library/*.m: runtime/mercury.c: runtime/mercury_context.c: runtime/mercury_engine.c: runtime/mercury_ho_call.c: runtime/mercury_tabling.c: runtime/mercury_trace_base.c: runtime/mercury_wrapper.c: trace/mercrury_trace.[ch]: trace/mercrury_trace_declarative.c: trace/mercrury_trace_external.c: trace/mercrury_trace_internal.c: Conform to the new scheme for initialization functions for hand-written modules. compiler/mercury_compile.m: library/benchmarking.m: runtime/mercury_conf_param.h: runtime/mercury.h: runtime/mercury_engine.c: runtime/mercury_goto.c: runtime/mercury_grade.h: runtime/mercury_ho_call.c: runtime/mercury_label.[ch]: runtime/mercury_prof.[ch]: Add an MR_MPROF_ prefix in front of the C macros used to control the old profiler. compiler/handle_options.m: runtime/mercury_grade.h: scripts/canonical_grade.sh-subr: scripts/init_grade_options.sh-subr: scripts/parse_grade_options.sh-subr: Make deep profiling completely separate from the old profiling system, by making the deep profiling grade independent of MR_MPROF_PROFILE_TIME and the compiler option --profile-time. library/array.m: library/builtin.m: library/std_util.m: runtime/mercury_hand_unify_body.h: runtime/mercury_hand_compare_body.h: In deep profiling grades, wrap the deep profiling call, exit, fail and redo codes around the bodies of hand-written unification and comparison procedures. Make the reporting of array bounds violations switchable between making them fatal errors, as we currently, and reporting them by throwing an exception. Throwing an exception makes debugging code using arrays easier, but since exceptions aren't (yet) propagated across engine boundaries, we keep the old behaviour as the default; the new behaviour is for implementors. runtime/mercury_deep_profiling_hand.h: New file that defines macros for use in Mercury predicates whose definition is in hand-written C code. library/exception.m: runtime/mercury_exception_catch_body.h: runtime/mercury_stacks.h: In deep profiling grades, wrap the deep profiling call, exit, fail and redo codes around the bodies of the various modes of builtin_catch. Provide a function that C code can use to throw exceptions. library/benchmarking.m: library/exception.m: library/gc.m: library/std_util.m: runtime/mercury_context.[ch]: runtime/mercury_engine.[ch]: runtime/mercury_debug.c: runtime/mercury_deep_copy.c: runtime/mercury_overflow.h: runtime/mercury_regs.h: runtime/mercury_stacks.h: runtime/mercury_thread.c: runtime/mercury_wrapper.c: Add prefixes to the names of the fields in the engine and context structures, to make code using them easier to understand and modify. runtime/mercury_deep_profiling.[ch]: New module containing support functions for deep profiling and functions for writing out a deep profiling data file at the end of execution. runtime/mercury_debug.[ch]: Add support for debugging deep profiling. Add support for watching the value at a given address. Make the buffered/unbuffered nature of debugging output controllable via the -du option. Print register contents only if -dr is specified. runtime/mercury_goto.h: runtime/mercury_std.h: Use the macros in mercury_std.h instead of defining local variants. runtime/mercury_goto.h: runtime/mercury_stack_layout.h: runtime/mercury_stack_trace.c: runtime/mercury_tabling.c: trace/mercury_trace.c: trace/mercury_trace_declarative.c: trace/mercury_trace_external.c: trace/mercury_trace_vars.c: Standardize some of the macro names with those used in the debugger paper. runtime/mercury_heap.h: Add support for memory profiling with the deep profiler. runtime/mercury_prof.[ch]: runtime/mercury_prof_time.[ch]: Move the functionality that both the old profiler and the deep profiler need into the new module mercury_prof_time. Leave mercury_prof containing stuff that is only relevant to the old profiler. runtime/mercury_prof.[ch]: runtime/mercury_strerror.[ch]: Move the definition of strerror from mercury_prof to its own file. runtime/mercury_wrapper.[ch]: Add support for deep profiling. Add suppory for controlling whether debugging output is buffered or not. Add support for watching the value at a given address. runtime/Mmakefile: Mention all the added files. scripts/mgnuc.in: Add an option for turning on deep profiling. Add options for controlling the details of deep profiling. These are not documented because they are intended only for benchmarking the deep profiler itself, for the paper; they are not for general use. tools/bootcheck: Compile the deep_profiler directory as well as the other directories containing Mercury code. Turn off the creation of deep profiling data files during bootcheck, since all but one of these in each directory will be overwritten anyway. Add support for turning on --keep-objs by default in a workspace. tools/speedtest: Preserve any deep profiling data files created by the tests. trace/mercury_trace.c: Trap attempts to perform retries in deep profiling grades, since they would lead to core dumps otherwise. util/Mmakefile: Avoid compile-time warnings when compiling getopt. tests/*/Mmakefile: tests/*/*/Mmakefile: In deep profiling grades, switch off the tests that test features that don't work with deep profiling, either by design or because the combination hasn't been implemented yet. |
||
|
|
2498d9d3fd |
Instead of generating the layout structures of labels, procs and modules
Estimated hours taken: 36 Instead of generating the layout structures of labels, procs and modules as rvals, generate them almost entirely as C structures. This will make future modifications much easier, since mismatches between what the runtime expects and what the compiler generates will now be pointed out by the C compiler. (It also reduces the size of the C source files generated with debugging enabled by about 5%.) Layout structures contain a few components that are not well-typed in C; we continue to generate these as rvals. Closure layout structures used to have a well-typed part and a non-well-typed part. We now generate the well-typed part as a separate structure, pointed to from the other. We also extend the well-typed part, so that instead of just giving the name the called procedure, it also identifies the source location where the closure was constructed. This could be useful for the debugger and for deep profiling. This diff also includes a change to get the compiler to bootstrap with lcc in grade none.gc.debug.tr: initializing the string tables in module layouts not as a string but as an array of characters. runtime/mercury_stack_layout.h: Reorganize the definitions of layout structures. Rename Stack_Layout_Entry structures as Proc_Layout structures, and Stack_Layout_Label structures as Label_Layout structures. (The debugger paper refers to the structures by the new names.) Fold the Stack_Layout_Vars structure into the structure that contains it, the Label_Layout structure. Add a Closure_Id structure that contains a Proc_Id structure as well as extra information identifying the source location where the closure was created. Create "short" versions of the Proc_Layout structures, which contain only the first one or two of the three groups of fields. Previously, the Mercury compiler would define new C types when it generated such short structures. Since we are not defining new C types anymore, there must be a C type for every kind of structure the Mercury compiler can generate. We now also have separate variants for the layouts of user-defined and compiler-generated procedures, since the format of their procedure id information is different. While the runtime system refers to their procedure id information through a union, the C types of the structures generated by the Mercury compiler do not use a union, since a union cannot be initialized through its second member. Make the constant fields of structures const, since we now generate values of those structure types, and initialize them with constant data. Move the documentation of layout structures here from stack_layout.m. runtime/mercury_ho_call.h: Instead of bodily including an MR_Proc_Id structure in closures, include a pointer to the more detailed MR_Closure_Id structure. runtime/mercury_accurate_gc.c: runtime/mercury_agc_debug.c: runtime/mercury_init.h: runtime/mercury_label.[ch]: runtime/mercury_layout_util.[ch]: Minor updates to conform to changes in mercury_stack_layout.h. runtime/mercury_goto.h: Use separate naming schemes for label layout structures and proc layout structures. library/exception.m: Minor updates to conform to changes in mercury_stack_layout.h. compiler/layout.m: A new module that defines data structures for label, proc and module layout structures and for closure id structures. compiler/layout_out.m: A new module that converts the Mercury data structures of layout.m into declarations and definitions of C data structures. compiler/stack_layout.m: Generate the new layout structures instead of rvals. Move the documentation of layout structures from here to runtime/mercury_stack_layout.h, since this module is no longer aware of some of their details. compiler/llds.m: Make layout structures a separate kind of compiler-generated data. compiler/llds_out.m: Remove the code for the output of layout structures; call layout_out.m instead. compiler/llds_out.m: compiler/rtti_out.m: Turn some predicates into functions. compiler/code_gen.m: compiler/code_info.m: compiler/llds.m: compiler/mercury_compile.m: compiler/unify_gen.m: Instead of handling closure layouts like other static data, handle them separately. Add a counter to the code_info structure in order to allow closure id structures to be identified uniquely by a pair consisting of the id of the procedure that generates them and a closure sequence number within that procedure. compiler/llds_common.m: Look for common rvals among the rvals in layout structures. compiler/opt_debug.m: Generate developer-friendly names for layout structure references. browser/dl.m: Update the code for constructing closure layouts. |