mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 23:05:21 +00:00
d5015935214fd9d1b7136373f368e80718550d9c
75 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
bbb0bc267c |
Fix a bug in my previous change, which stopped it compiling in
Estimated hours taken: 0.25 Branches: main compiler/stack_layout.m: Fix a bug in my previous change, which stopped it compiling in non-IL grades. |
||
|
|
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. |
||
|
|
ed83fe4623 |
Optimize shallow traced modules by not adding calls to MR_trace to shallow
Estimated hours taken: 12
Branches: main
Optimize shallow traced modules by not adding calls to MR_trace to shallow
traced procedures which cannot be called from a deep traced environment.
A shallow traced procedure can be optimized in this way if it is neither
exported from its defining module nor has its address taken.
The main purpose of this optimization is not the avoidance of the cost of the
MR_trace calls as much as it is the restoration of tail recursion optimization.
Previously, compiling a program in a debug grade would disable all tail
recursion in the program (since debug grades require at least shallow tracing
every module). This was a problem because it limited the sizes of the inputs
the debugged program could process before running out of memory. As long as
the procedures that recurse on the input are in the implementation section
of a shallow traced module, this should no longer happen.
compiler/trace_params.m:
Introduce the concept of a procedure's effective trace level. This is
identical to the global trace level, except if the procedure is not
exported and doesn't have its address taken, and the global trace level
is shallow. In that case, we say that the procedure's effective trace
level is none.
Computing a procedure's effective trace level requires its proc_info
and its parent pred_info, so require callers to supply these as
parameters.
compiler/code_info.m:
Store the current pred_info as well as the current proc_info, for
trace parameter lookups.
compiler/continuation_info.m:
compiler/code_gen.m:
Record the required trace parameters of a procedure in its layout
structure, since it can no longer be computed from the global trace
level.
compiler/stack_layout.m:
Use the trace parameters in procedures' layout structures, instead of
trying to compute them from the global trace level.
compiler/inlining.m:
compiler/liveness.m:
compiler/stack_alloc.m:
compiler/store_alloc.m:
compiler/trace.m:
Use procedures' effective trace level instead of the global trace level
where relevant.
compiler/llds.m:
Record the required trace parameter of a procedure in its c_procedure
representation, since it can no longer be computed from the global
trace level.
Delete an obsolete field.
compiler/optimize.m:
compiler/jumpopt.m:
Use a required trace parameter of a procedure in its c_procedure
representation, since it can no longer be computed from the global
trace level.
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/llds_out.m:
compiler/mercury_compile.m:
Trivial changes to conform to updated interfaces.
compiler/stack_opt.m:
Use the option opt_no_return_calls, instead of approximating it
with the trace level. (The old code was a holdover from before the
creation of the option.)
tests/debugger/shallow.m:
tests/debugger/shallow2.m:
tests/debugger/shallow.{inp,exp*}:
Divide the old test case in shallow.m in two. The top level predicates
stay in shallow.m and continue to be shallow traced. The two bottom
predicates move to shallow2.m and are now deep traced.
The new test input checks whether the debugger can walk across the
stack frames of procedures in shallow traced modules whose effective
trace level is "none" (such as queen/2).
|
||
|
|
048f8357cf |
Until now, programmers could add `tabled_for_io' annotations to foreign_procs
Estimated hours taken: 12 Branches: main Until now, programmers could add `tabled_for_io' annotations to foreign_procs that do I/O, which asks the compiler to make those foreign_procs idempotent, i.e. ensures that they are performed at most once even in the presence of a retry operation in the debugger. This change adds a compiler option, --trace-table-io-require, which generates an error if a foreign_proc that does I/O does not have this annotation. Specifying this option thus ensures that all I/O done by the program is idempotent. In the future, we may want to have this option turned on in all debugging grades. Until we decide about, the new option is not yet documented. compiler/options.m: Add the new option --trace-table-io-require. compiler/handle_options.m: Make --trace-table-io-require imply --trace-table-io. compiler/table_gen.m: If --trace-table-io-require is enabled, require all I/O primitives to have the tabled_for_io annotation. compiler/mercury_compile.m: Pass I/O states to table_gen.m, since it can now generate error messages. trace/mercury_trace_util.h: trace/mercury_trace_vars.c: When calling Mercury code from the trace directory, disable I/O tabling, since any I/O actions executed by Mercury code in the browser directory (or by library code called from there) should not be tabled, not being part of the user program. Due to the depth of nesting, make mercury_trace_vars.c use four-space indentation. browser/collect_lib.m: browser/declarative_debugger.m: browser/declarative_execution.m: browser/dl.m: browser/io_action.m: browser/mdb.m: browser/name_mangle.m: browser/util.m: compiler/gcc.m: compiler/mercury_compile.m: compiler/passes_aux.m: compiler/process_util.m: compiler/stack_layout.m: library/io.m: library/time.m: tests/debugger/declarative/tabled_read_decl.m: Add a whole lot of tabled_for_io annotations, to enable the compiler to bootstrap with --trace-table-io-require enabled. In many cases, this required turning old-style pragma c_code into pragma foreign_proc. While doing that, I standardized the layouts of pragma foreign_procs. browser/util.m: Turn an impure semidet predicate into a pure det predicate with I/O states, to allow it to be tabled. Make it return a Mercury bool to indicate success or failure. library/bool.m: Add functions that allow C code to get their hands on the constants `yes' and `no', for communication with Mercury code. library/table_builtin.m: Add debugging code to the main primitive of I/O tabling. This is controlled both by the macro for retry debugging and a boolean global. library/mercury_trace_base.[ch]: Add the boolean global variable to switch the new debugging code in table_builtin.m on and off. library/mercury_trace_internal.c: When starting I/O tabling with retry debug enabled, turn on the switch. tests/debugger/queens.exp3: New expected output file that applies when the library is compiled with --trace-table-io-require. |
||
|
|
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. |
||
|
|
d6fbaa2161 |
Add two pieces of information that will be needed to an upcoming change
Estimated hours taken: 2 Branches: main Add two pieces of information that will be needed to an upcoming change to the representation of procedure bodies in the declarative debugger. The first piece is the full list of head vars. This is needed now because the debugger no longer ignores variables of type type_info, and thus the Nth headvar is no longer guaranteed to be variable number N. The second piece is a cut/no_cut indicator in `some' goals. This is needed to allow us to reconstruct goal paths exactly as we traverse goal representations. browser/program_representation.m: Make the two data structure changes described above. browser/*.m: Trivial changes to conform to the new data structures. compiler/prog_rep.m: Create the updated data procedure representation. compiler/*.m: Record and transmit the information needed by the updated procedure representation. runtime/mercury_stack_layout.h: Update the documentation of the relevant field in proc_layouts. |
||
|
|
28d26ba1a7 |
Minor sylistic changes.
Estimated hours taken: 0.1 Branches: main compiler/stack_layout.m: Minor sylistic changes. |
||
|
|
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. |
||
|
|
41a27af862 |
Change type_id to the more descriptive type_ctor everywhere.
Estimated hours taken: 6 Branches: main compiler/*.m: Change type_id to the more descriptive type_ctor everywhere. |
||
|
|
63404237ff |
Generate closure layouts for the MLDS back-end.
Estimated hours taken: 24 Branches: main Generate closure layouts for the MLDS back-end. compiler/ml_unify_gen.m: Add code to generate closure layouts. XXX Note that we still don't fill in the MR_closure_id field yet. compiler/stack_layout.m: Export stack_layout__represent_locn_as_int, for use by ml_unify_gen.m. compiler/mercury_compile.m: Invoke the arg_info.m pass for the MLDS back-end, since the arg_infos are needed by the code in continuation_info.m which ml_unify_gen.m calls to generate closure layouts. compiler/ml_elim_nested.m: compiler/ml_util.m: compiler/ml_code_util.m: Fix a bug, exposed by the changes above, which led to some dangling references. The bug was that it was not hoisting out local static RTTI data even when this data was referred to by other static constants were being hoisted, because it was only checking for references via `var(mlds__var)' lvals, not via `data_addr_const(data_addr)' rvals. The fix was to change the code for *_contains_var so that it accepts a data_name rather than a var_name, and counts references via data_addr_consts, and to change the code for ml_decl_is_static_const so that it just checks for `data(_)' rather than `data(var(_))'. Hoisting RTTI data also required adding code to ml_elim_nested.m to eliminate duplicate definitions. compiler/rtti_to_mlds.m: Mark RTTI definitions as `final'; this is needed to ensure that they have the same flags (apart from the access) as ml_static_const_flags, so that ml_decl_is_static_const succeeeds for these. compiler/ml_optimize.m: Update to reflect the interface changes in ml_util.m. runtime/mercury_deep_copy_body.h: Delete a call to MR_fatal_error(), since it is no longer needed. tests/hard_coded/Mmakefile: Re-enable the copy_pred and copy_pred_2 test cases for the MLDS back-end, since they now pass. |
||
|
|
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.
|
||
|
|
8b0dcbb231 |
Various fixes to get the GCC back-end interface to bootstrap.
Estimated hours taken: 20 Various fixes to get the GCC back-end interface to bootstrap. library/exception.m: Define function versions of mercury__exception__builtin_catch_3_p_*. This is needed (a) in case we take their address, and (b) for the GCC back-end interface, where we can't use C macros, since we're compiling to assembler. browser/dl.m: browser/util.m: browser/interactive_query.m: compiler/stack_layout.m: Add #includes for header files needed by these modules. browser/dl.m: Delete an unnecessary nested extern declaration, to avoid a warning from `gcc -Wshadow'. compiler/mlds_to_gcc.m: When calling mlds_to_c to process foreign_code, make all definitions public, so that the can be used from the assembler code that we generate in mlds_to_gcc. Don't call mlds_to_c to generate `.c' and `.h' files if the module contains only `pragma foreign_decls', not `pragma foreign_code', `pragma foreign_proc', or `pragma export'. This change is needed to avoid calling mlds_to_c when intermodule optimization is enabled and `pragma c_header_code' declarations have been read in from the `.opt' file and have propagated through to the MLDS. Calling mlds_to_c when the module itself doesn't contain C code breaks things, since Mmake won't compile and link in the generated `.c' files, but those files contain the definition of the `*__init_type_tables()' functions that are referenced by `*_init.c'. XXX This is not quite right, since if the module itself contains `pragma foreign_decls', the `.h' file might be needed. But the Mercury standard library needs intermodule optimization enabled for `make install' to work. A better fix would be to ignore foreign_decls that were defined in other modules, but to call mlds_to_c for foreign_decls that were defined in the module that we're compiling. compiler/modules.m: Change the code which decides when to link in extra object files for foreign code to reflect the above change to when mlds_to_gcc.m invokes mlds_to_c.m. compiler/mlds_to_c.m: When target=asm, i.e. we're compiling to asm, but mlds_to_c.m has been invoked to generate C code for a `foreign_code', `foreign_proc', or `pragma export' declaration, don't generate #include directives for the imported modules, since we may not have generated any header file for them. XXX This is a bit of a hack; it might sometimes lead to problems, since the header files might sometimes be needed. But including them unconditionally is definitely wrong, since they may not exist, and so this change is needed to get the compiler to bootstrap. compiler/Mmakefile: Add a dependency of mercury_compile on $(GCC_BACK_END_LIBS), so that we know to relink it if the GCC back-end has changed. (That variable is set to empty if we're not linking in the GCC back-end, so it won't cause problems when not using the GCC back-end.) library/Mmakefile: browser/Mmakefile: compiler/Mmakefile: Add an `ss' target, for use by tools/bootcheck. tools/bootcheck: Add `--target asm' option. If that is set, pass `--target asm' to mmake, and build and compare the stage 3 `.s' files rather than the `.c' files. Also add `--make-opts' option, for passing options to `make'. Put `-k' in `--make-opts', not `--mmake-opts', since `-k' is an option to `make', not to `mmake'. This makes a difference since although `make' options can be passed to `mmake', any options after the first `make' option are assumed to be options to `make', not to `mmake'. |
||
|
|
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. |
||
|
|
ebe9f9a3ec |
Add tabling of I/O actions for the debugger.
Estimated hours taken: 80
Add tabling of I/O actions for the debugger.
compiler/options.m:
Add a new option, --trace-table-io, that enables the tabling of I/O
actions, and another, --trace-table-io-states, that governs whether the
tabling includes the I/O state variables themselves. (You want to table
these variables iff they contain meaningful information that is not
stored in global variables.) These options are for developers only
for now.
compiler/modules.m:
Implicitly import table_builtin if --trace-table-io is specified.
compiler/prog_data.m:
Add eval_table_io as a new eval method.
compiler/hlds_pred.m:
Add a mechanism for checking whether a predicate has an input/output
pair of io__state args.
Extend the tables indexed by eval_method to handle eval_table_io.
compiler/hlds_out.m:
Print the eval method in HLDS dumps.
compiler/table_gen.m:
If a procedure has a pair of I/O state args and is defined using pragma
C code that has the tabled_for_io marker, and --trace-table-io is
specified, then perform I/O tabling on it and mark it as tabled.
compiler/notes/compiler_design.m:
Document that table_gen.m can now change the evaluation methods of
procedures (to eval_table_io).
compiler/stack_layout.m:
runtime/mercury_stack_layout.h:
Add an extra field to proc layouts. If debugging is enabled and a
procedure has I/O state arguments, this field gives the number of the
stack slot which will be filled with the I/O action counter at the
time of the call, so that on retry the debugger can reset the I/O
action counter to this value.
compiler/trace.m:
Add code to reserve and fill this stack slot.
Make the order of fields in the trace_slots structure match the order
in proc layouts.
compiler/code_info.m:
compiler/live_vars.m:
Pass a module_info to trace__setup and trace__reserved_slots.
library/io.m:
Mark the I/O primitives (i.e. procedures that are defined by pragma C
code and do I/O) with the tabled_for_io feature. (See the discussion
of I/O primitives in compiler/table_gen.m.)
Standardize the formatting of predicates defined by pragma C codes.
library/table_builtin.m:
Define the predicates that perform I/O tabling, to which calls are
inserted in I/O tabled predicates. These depend on knowing what the
maximum MR_Unsigned value is.
library/table_builtin.m:
runtime/mercury_tabling_macros.h:
Table nodes implementing a simple kind of trie, which can also be
viewed as a hash table with the hash function hash(n) = hash - start
were already supported by mercury_tabling.c. They are used to
implement I/O tabling, since I/O the tabled action numbers form a
contiguous sequence. Now allow that functionality to be accessed
from the library through macros.
runtime/mercury_trace_base.[ch]:
Add the global variables required by I/O tabling.
trace/mercury_trace.c:
Implement retry across I/O by resetting the I/O counter to the value
it had on entry to the retried call. However, since this is not safe
in general, ask the user for permission first.
trace/mercury_trace.h:
Add two extra arguments to MR_trace_retry to specify the input and
output streams on which to ask permission.
trace/mercury_trace_internal.c:
Add commands to start and stop I/O tabling. For now, they are for use
by developers only and are undocumented; I expect they will change
significantly before being let loose on users.
trace/mercury_trace_external.c:
trace/mercury_trace_declarative.c:
Pass extra arguments to MR_trace_retry to indicate that these modules
are not interested (at least for now) in retry across I/O, since they
do not (yet) have mechanisms for asking the user for permission.
tests/debugger/tabled_read.{m,inp,exp,data}:
A new test case to check retry across tabled and non-tabled I/O.
tests/debugger/Mmakefile:
Enable the new test case.
|
||
|
|
2cefe05a11 |
Record the trace level that the module was compiled with in the module
Estimated hours taken: 3 Record the trace level that the module was compiled with in the module layout structure. Use this to avoid an abort if the 'dd' command is used on a module that is compiled with trace level 'deep'. compiler/trace_params.m: Encode the trace level as an integer. runtime/mercury_stack_layout.h: Add a field to MR_Module_Layout to store the encoded trace level. compiler/stack_layout.m: Fill in this field. trace/mercury_trace_declarative.c: Ignore events from modules that don't have an appropriate trace level. This effectively assumes that the events are correct, so we warn the user that this has happened. Also, disallow the 'dd' command at these events. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/deep_sub.m: tests/debugger/declarative/deep_warning.exp: tests/debugger/declarative/deep_warning.inp: tests/debugger/declarative/deep_warning.m: A test case for the new feature. |
||
|
|
1c8cb6faf2 |
Get the compiler to bootstrap with -DMR_NO_BACKWARDS_COMPAT.
Estimated hours taken: 2 Get the compiler to bootstrap with -DMR_NO_BACKWARDS_COMPAT. compiler/c_util.m: compiler/rtti_out.m: Add MR_ prefixes to various type names in generated code. compiler/*.m: browser/*.m: library/*.m: Add MR_prefixes to various type and function names in pragma C code. runtime/*.[ch]: trace/*.[ch]: Add MR_prefixes to various type and function names in hand-written code. |
||
|
|
82378c381b |
Allow polymorphic ground insts. This change assumes that all inst
Estimated hours taken: 80 Allow polymorphic ground insts. This change assumes that all inst parameters in the mode declaration for a predicate or function are constrained to be ground-shared. This is a temporary measure until we work out a nice syntax to allow the programmer to tell the compiler that certain inst parameters may be treated as ground insts. Since we don't currently support unconstrained inst parameters anyway, this shouldn't cause a problem. TODO: - Add syntax, something like `:- mode p(in(I)) <= ground(I).', to specify that an inst parameter represents a ground inst. - Allow abstract ground insts that are treated in a similar way to what we've done here with ground inst parameters. - Make mode checking more efficient (i.e. rewrite the mode system). compiler/inst.m: Add a new alternative for ground insts: `constrained_inst_var(inst_var)'. Define the type `inst_var_sub'. compiler/inst_match.m: Change inst_matches_initial so that it: - handles constrained_inst_vars correctly; - returns the inst_var substitutions necessary for the call; - handles inst_matches_initial(ground(...), bound(...), ...) properly (this requires knowing the type of the variable). The last change has also been made for inst_matches_final and inst_matches_binding. However, the check is disabled for now because, without alias tracking, the mode checker becomes too conservative. compiler/hlds_pred.m: compiler/mode_info.m: compiler/simplify.m: compiler/det_util.m: Include the inst_varset in the proc_info, mode_info and simplify_info. Add a vartypes field to the det_info. Remove the vartypes field from the simplify_info since it is now in the det_info. Use record syntax for these data structures and their access predicates to make future changes easier. compiler/prog_io.m: When processing pred and func mode declarations, convert all inst_var(V) insts to ground(shared, constrained_inst_var(V)). compiler/prog_data.m: compiler/hlds_data.m: compiler/make_hlds.m: compiler/mode_util.m: Use inst_vars instead of inst_params. compiler/modes.m: compiler/modecheck_call.m: compiler/unique_modes.m: compiler/mode_util.m: When checking or recomputing initial insts of a call, build up an inst_var substitution (using the modified inst_matches_initial) and apply this to the final insts of the called procedure before checking/recomputing them. compiler/mode_util.m: Make sure that recompute_instmap_delta recomputes the instmap_deltas for lambda_goals even when RecomputeAtomic = no. compiler/type_util.m: Add a new predicate, type_util__cons_id_arg_types which nondeterministically returns the cons_ids and argument types for a given type. Add a new predicate type_util__get_consid_non_existential_arg_types which is the same as type_util__get_existential_arg_types except that it fails rather than aborting for existenially typed arguments. compiler/accumulator.m: compiler/check_typeclass.m: compiler/clause_to_proc.m: compiler/common.m: compiler/continuation_info.m: compiler/deforest.m: compiler/det_analysis.m: compiler/det_report.m: compiler/det_util.m: compiler/dnf.m: compiler/follow_code.m: compiler/goal_store.m: compiler/goal_util.m: compiler/higher_order.m: compiler/inst_util.m: compiler/instmap.m: compiler/lambda.m: compiler/magic.m: compiler/magic_util.m: compiler/mercury_to_mercury.m: compiler/modecheck_unify.m: compiler/module_qual.m: compiler/pd_info.m: compiler/pd_util.m: compiler/polymorphism.m: compiler/post_typecheck.m: compiler/prog_io_util.m: compiler/prog_rep.m: compiler/saved_vars.m: compiler/stack_layout.m: compiler/table_gen.m: compiler/unify_proc.m: compiler/unneeded_code.m: compiler/unused_args.m: Pass inst_varsets and types where needed. Changes to reflect change in definition of the inst data type. compiler/inlining.m: Recompute the instmap deltas for a procedure after inlining. This bug showed up compiling tests/hard_coded/lp.m with inlining and deforestation turned on: deforestation was getting incorrect instmap deltas from inlining, causing the transformation to break mode-correctness. It has only just shown up because of the added call to `inst_matches_initial' from within `recompute_instmap_delta'. tests/invalid/Mmakefile: tests/invalid/unbound_inst_var.m: tests/invalid/unbound_inst_var.err_exp: tests/valid/Mmakefile: tests/valid/unbound_inst_var.m: Move the `unbound_inst_var' test case from `invalid' to `valid' and extend its coverage a bit. |
||
|
|
fdccd65e30 |
The debugger's retry command at the moment works only from a final port for
Estimated hours taken: 60
The debugger's retry command at the moment works only from a final port for
the call to be retried, the reason being that the RTTI does not have the
information required to make sure that the state of the stacks is reset
correctly. If you invoke retry from a non-final port, the current
implementation skips forward to a final port and then does the retry;
this does not work if you get a core dump or a infinite loop during the forward
skip. This change adds the required info to the RTTI and thus enables
direct retries from the middle of calls.
The information added has two components. First, if a procedure that lives on
the nondet stack allocates any temporary nondet stack frames, then it must
record the old value of maxfr in a stack slot so that retry can restore it.
Second, if a procedure is tabled, then it must record the call table tip node
corresponding to the actual input arguments, so we can reset this node to
uninitialized (if we don't, then the retried call will find the active call
marker and report an infinite loop error).
The support for retries across minimal model calls is not finished yet.
Finding out what the right thing to do in such cases is a research project,
one that cannot even be started until minimal model tabling works reliably
in the *absence* of retries. However, such retries do grossly wrong things
at the moment; this change is a definite improvement. It attempts to perform
the retry from the fail port, since that is the only time when the minimal
model tabling data structures are quiescent. The "fail" command I added to
the debugger command set to let this be done is not complete yet and is
therefore undocumented; the problem is that a call to a model_non predicate
in a committed choice context will not get to the fail port. I added goal paths
to return layouts so that we will eventually be able to tell when execution
leaves a committed choice context surrounding an ancestor of a model_non
predicate call, but this functionality is not yet implemented.
compiler/stack_layout.m:
Generate the three new fields: the evaluation method, (maybe) the id
of the stack slot containing the saved value of maxfr, and (maybe)
the id of the stack slot containing the call table tip.
compiler/continuation_info.m:
Record the information about the new fields for later use by
stack_layout.m.
Add a new field to record the goal path of calls for their return
layouts.
Fix a screwed comment for the continuation_info data structure.
compiler/llds.m:
Add a new field to call() instructions to hold the goal path of the
call.
Add a utility function for use by trace.m.
compiler/call_gen.m:
Fill in this new field.
compiler/trace.m:
compiler/live_vars.m:
Reserve the fixed stack slot for the saved maxfr if necessary,
and if the call table tip node is needed, make sure that the variable
holding its address is allocated a low-numbered stack slot (otherwise,
its number may not fit into the MR_int_least8_t field in the
proc_layout).
compiler/trace.m:
If necessary, fill in the saved maxfr slot.
If necessary, initialize the call table tip slot.
compiler/hlds_goal.m:
Add a goal feature which marks its goal as defining the variable
representing the call table tip node.
Add a field to the goal path step representing quantification;
the field says whether the quantification changes the determinism of
the goal (i.e. whether it cuts away solutions).
compiler/hlds_pred.m:
compiler/hlds_out.m:
Add two fields to proc_infos which (a) record which variable, if any,
holds the call table tip node, and (b) record whether the procedure's
layout structure needs to reserve a slot for the saved value of maxfr.
compiler/table_gen.m:
Put this feature on the appropriate goal.
Also, rename a predicate to make it reflect its purpose better.
compiler/code_gen.m:
Generate code to put the call table tip variable in its stack slot
immediately after it has been generated.
Add a sanity check to ensure that if a procedure that lives on the det
stack can create a temporary nondet frame, and debugging is enabled,
then it did have a stack slot reserved for the saved maxfr.
compiler/code_util.m:
Add a predicate to make a conservative prediction of whether a
procedure may allocate a temporary nondet stack frame. We cannot
just generate the code and see, because the code generator needs to
know which variables live in which stack slots, and we cannot decide
that until we know whether we need a stack slot for the saved value of
maxfr.
Make an unrelated predicate semidet procedure use a det helper, in
order to make it more robust in the face of changes to the HLDS
(e.g. it was missing code for handling bi_implications).
compiler/code_info.m:
Record whether a procedure has in fact created a temporary nondet stack
frame.
compiler/handle_options.m:
Disable hijacks if debugging is enabled. The code we now use to
restore the stacks for direct retries works only if the retry does not
"backtrack" over a hijacked nondet stack frame whose hijack has not
been undone. Note that code compiled without debugging may still hijack
nondet stack frames. Execution may reemerge from the nondebugged region
in one of two ways. If the nondebugged code returns, then it will have
undone hijack, and the retry code will work. If the nondebugged code
calls debugged code, there will be a region on the stacks containing
no debugging information, and the retry command will refuse to perform
retries that go into or beyond this region. Both cases preserve
correctness.
compiler/*.m:
Trivial changes to conform to changes in data structures.
runtime/mercury_stack_layout.h:
Add three new fields to proc layouts: the numbers of the stack slots
(if any) storing the saved maxfr and the call table tip, and a
representation of the procedure's evaluation method.
runtime/mercury_stack_trace.[ch]:
Now that return layouts contain goal paths, print them in stack dumps
only if the include_trace_data flag is set (in mdb, this requires the
-d flag of the "stack" command).
Pass this flag around directly, instead of encoding its value in
the NULL vs non-NULL values of sp and curfr.
runtime/mercury_regorder.h:
Provide a mechanism to access the values of the first few rN registers
from a save area, for use in debugging low-level C code in the runtime
and the trace directories.
trace/mercury_trace.[ch]:
Reimplement MR_trace_retry to allow retries from the middle.
If the stack segment being retried over contains minimal model
procedures, we must still arrange to skip to the end of the retried
call. If this call is a minimal model generator, skipping to just any
final port is not sufficient to guarantee correctness on retry; to
ensure that subgoal is complete, we must skip to a fail port.
trace/mercury_trace.[ch]:
trace/mercury_trace_internal.c:
Implement a debugger command, "fail", which skips to the fail port or
the exception port of the specified ancestor. Since procedures that are
not model_non are not guaranteed to get to such a port, this
command reports an error if the specified call is not model_non.
Actually, even calls to model_non procedures may not get to the fail
port, as explained above; this is why the command is not yet
documented.
trace/mercury_trace.c:
trace/mercury_trace_util.[ch]:
Move some functions to print parts of the Mercury abstract machine
state from mercury_trace to mercury_trace_util, so that they are
available for use in debugging e.g. mercury_trace_declarative.
trace/mercury_trace_internal.c:
trace/mercury_trace_external.c:
trace/mercury_trace_declarative.c:
Use the new implementation of retries. At the moment, only the
internal debugger implements the full functionality. The declarative
debugger issues retry commands only from situations where the missing
functionality is not (yet) needed. The external debugger should
continue to work correctly, but Erwan may wish to update it to
exploit the availability of the fail command.
trace/mercury_trace*.[ch]:
Fix MR_prefixes, and a signed/unsigned mismatch.
doc/user_guide.texi:
Document the new "fail" command, but comment it out for now.
tests/debugger/retry.{m,inp,exp,exp2}:
A new test case for exercising retry.
tests/debugger/Mmakefile:
Enable the new test case.
tests/debugger/*.exp:
Update the expected output, given the extra info now output e.g. for
exception events and detailed stack traces.
|
||
|
|
07d6517521 |
Implement a general mechanism for suppressing selected aspects of execution
Estimated hours taken: 8 Implement a general mechanism for suppressing selected aspects of execution tracing. compiler/trace_params.m: This new file contains two abstract data types that define the parameters of the execution tracing system, and the operations on them. The two ADTs are the trace level (moved from globals.m) and a new one, trace_suppress_items, which replaces --no-trace-internal, --no-trace-redo and --no-trace-return, and provides additional capabilities requested by Erwan. Basically any given port can now be suppressed, with the exception of call (because the call event's layout structure is needed for implementing redo from any other event) and excp (because they are created on the fly by exception.m, and are not put into object code in the first place). compiler/globals.m: Delete the stuff now migrated to trace_params.m. Make trace_suppress_items part of the globals structure. compiler/code_gen.m: compiler/trace.m: Allow the suppression of individual ports. compiler/stack_layout.m: Allow the suppression of parts of layout structures. compiler/*.m: Minor changes, mainly importing trace_params, to conform to the main modifications. compiler/options.m: Delete --no-trace-internal, --no-trace-redo and --no-trace-return. Add --suppress-trace, but do not document it, since it is really intended only for implementors. doc/user_guide.texi: Delete the documentation of --no-trace-internal, --no-trace-redo and --no-trace-return. Do not document it --suppress-trace, since it is really intended only for implementors. (The only reason why other three were documented is that most consumers of the users' guide then *were* implementors.) |
||
|
|
36fc174bed |
Make declarative debugging a trace level, not a separate option.
Estimated hours taken: 2 Make declarative debugging a trace level, not a separate option. compiler/globals.m: Make trace_level an abstract data type. Define and export several functions that check whether the current trace level requires particular kinds of treatment. compiler/options.m: Remove --trace-decl as an option. compiler/*.m: Instead of checking for particular values of the trace level, use the functions now exported by globals.m. tests/debugger/declarative/Mmakefile: Use the trace level to ask for declarative debugging. |
||
|
|
3ce3b14c84 |
Make procedure bodies available to the declarative debugger.
Estimated hours taken: 20 Make procedure bodies available to the declarative debugger. browser/program_representation.m: Add _rep suffixes to the function symbols, to make iit easier to distinguish HLDS goals and goal representations. compiler/static_layout.m: If --trace-decl is specified, include a representation of the procedure body in the procedure's layout structure. compiler/prog_rep.m: A new module, containing the code that converts goals from HLDS to a term in the format we want to put in the layout structure. compiler/static_term.m: A new module, containing the code that converts Mercury terms to the LLDS rval we need to give to llds_out.m. compiler/code_gen.m: compiler/continuation_info.m: Preserve the information needed by prog_rep compiler/Mmakefile: Extend the search path to the browser directory, since the new file prog_rep.m imports one of the submodules of mdb.m stored there. compiler/notes/compiler_desigm.html: Document the new modules. library/std_util.m: Add a mechanism for static_term.m to use in converting terms into rvals. This mechanism uses RTTI information to deconstruct terms, and return not only their arguments, but also information about how the term can be constructed from its arguments. runtime/mercury_type_info.h: Add a couple of macros to make construction and deconstruction of univs easier, for use in std_util.m. trace/mercury_trace_internal.c: Add a new command, "proc_body", that prints out the representation of the body of the current procedure. This is meant only for developers to use to check that the procedure body representation is OK; it is deliberately not documented. Also fix a bug: make sure that we do not pass a NULL pointer to fputs when echoing a line of input that isn't there (because we got EOF). |
||
|
|
c014e2a20b |
Store the offsets leading to the names of variables in a central location.
Estimated hours taken: 8 Store the offsets leading to the names of variables in a central location. Previously, each label layout included offsets for the variables live at that label; now we store the offsets of variables in the proc layout. The new data structure will soon be required by the declarative debugger for displaying contours through representations of HLDS goals. compiler/code_gen.m: Preserve the varset of every procedure for use by stack_layout.m. compiler/continuation_info.m: Add a field to the cell from which proc layouts are derived to hold the varset. compiler/stack_layout.m: Delete the offsets from label layouts and add them to proc layouts. The var name offsets array will always contain meaningful offsets for every variable that is live at a label with a label layout; with --trace-decl, it will also contain meaningful offsets for all the other variables in the procedure body. runtime/mercury_stack_layout.h: Reflect the change in the types of the label and proc layout structures. trace/mercury_trace.c: trace/mercury_trace_vars.c: Look up variable names using the new location of the offsets leading to them. |
||
|
|
a1f326f4e9 |
Add an alternative to code_exprn that does eager code generation (code_exprn
Estimated hours taken: 140 Add an alternative to code_exprn that does eager code generation (code_exprn always does lazy code generation). Its main advantages are that the new code is significantly simpler, and that it does not generate unnecessary shuffling code. Its main disadvantage, which is that it does not eliminate the creation of unneeded cells, can be eliminated by switching on --unneeded-code. For now, you can select the use of the new code generator with the --no-lazy-code option (which was previously present but unused). This will be made the default later, after I do more performance tests. Var_locn contains stricter self-checks than code_exprn does. This required modifications to some other parts of the code generator to ensure that the self-checks do not fail unnecessarily. (This mostly took the form of explicitly killing off dead variables before calling code_info__clear_all_registers, which would complain about losing the last record of the value of a variable that was alive as far as it knew.) To make my changes simpler, also took the opportunity to simplify parts of the code generator which were handing around rvals that in fact had to be wrappers around lvals, by handing around the lvals directly. Testing this change also required fixing an old bug which prevented compiling the library with -O1 --trace deep, together with the usual intermodule optimization. The bug is that a library module reads predicates from builtin.opt or private_builtin.opt, does not eliminate them because of the -O1, and then tries to generate traced code for them. However, this fails because the builtin modules contain some predicates that cannot be made to conform to typeinfo-liveness, which is required by tracing. compiler/var_locn.m: The new module that implements eager code generation. compiler/follow_vars.m: Improve the follow_vars pass, since eager code generation requires better follow_vars information. We now generate correct information for generic calls, and record not only where some vars (e.g. those which appear as input arguments of following calls) should be put, but also which registers are not reserved for those variables and are thus available for other variables. compiler/hlds_goal.m: Modify the follow_vars field of the goal_info to record the number of the first non-reserved register. compiler/code_info.m: Replace the general-purpose predicate code_info__cache_exprn, which associated a variable with an rval without generating code, with a set of special-purpose predicates such as code_info__assign_const_to_var and code_info__assign_cell_to_var, some of which can generate code. These new predicates and some older ones (e.g. code_info__setup_call) now choose at runtime whether to call code_exprn or var_locn. The basis for the decision is checking whether the code_info structure contains an exprn_info or a var_locn_info. This is decided in code_info__init based on the value of the lazy_code option, and maintained unchanged from then on. Rename some predicates to better reflect their current possible behaviors. compiler/unify_gen.m: Call the new special-purpose predicates in code_info instead of code_info__cache_exprn. Replace an incorrect clause with a call to error, since that clause could never be invoked. compiler/call_gen.m: Hand over the task of generating the args of generic calls to code_info, since it already has code to do the right thing, which includes reserving the registers to be used for the input args. Notify the rest of the code generator after the last use of non-forward-live variables, in order to avoid spurious calls to error (it is an error to clobber the last location of a live variable). Notify the rest of the code generator when generic calls overwrite registers, to allow the proper consistency checks to be made. If an output variable is singleton, then do not make it known to the code generator. It never will never become dead, and may thus cause a spurious compiler abort if its storage is ever clobbered. Export a predicate for use by follow_vars. Factor out some common code. Call the new preds in code_info where necessary. compiler/pragma_c_gen.m: Notify the rest of the code generator after the last use of non-forward-live variables, in order to avoid spurious calls to error (it is an error to clobber the last location of a live variable). If an output variable is singleton, then do not make it known to the code generator. It never will never become dead, and may thus cause a spurious compiler abort if its storage is ever clobbered. When using var_locn, ensure that none of the input arguments of a model_semi pragma_c_code is assigned to r1. If we did, and the last reference to the value of that argument was after an assignment to SUCCESS_INDICATOR, the C compiler would be forced to generate code to shuffle the value of the argument out of the way. compiler/code_exprn.m: Minor changes to return lvals directly instead of lvals wrapped inside rvals and to conform the new format of follow_vars. Do not include the registers reserved by follow_vars in the search for a spare register. compiler/lookup_switch.m: compiler/switch_gen.m: Fix an old bug that did not matter with code_exprn but does matter with var_locn: the branch end structure was being computed in the wrong place. compiler/disj_gen.m: At the ends of non-last disjuncts, kill off the variables that we needed to know inside the disjunct but won't need to know after the disjunct, in order to avoid error messages about throwing away their state. The variables affected are those which are needed only by the resumption point of the next disjunct, not by enclosing resumption points or forward execution. compiler/arg_info.m: Associate an lval, not an rval, with each argument. compiler/*.m: Minor changes to conform to (a) the new format of follow_vars, (b) the replacement of rvals containing lvals by lvals. compiler/code_util.m: Add some utility predicates for var_locn.m. compiler/exprn_aux.m: Add some utility functions for var_locn.m. Export a predicate for var_locn.m. compiler/handle_options.m: If --no-lazy-code is set, switch on the "optimizations" on whose presence it depends. compiler/mercury_compile.m: compiler/code_gen.m: Turn off tracing for predicates that don't obey typeinfo liveness for backend_by_preds and backend_by_phases respectively. Look up options in the globals structure in the module_info, not in the globals structure in the I/O state, since this is where we turn off tracing. (We should later make sure that other parts of the compiler are also consistent on this issue.) compiler/stack_layout.m: Throw away any continuation_info structures that belong to predicates that don't obey typeinfo liveness. |
||
|
|
12af7b3793 |
Consistently use counters to allocate label numbers and cell numbers
Estimated hours taken: 12 Consistently use counters to allocate label numbers and cell numbers throughout the LLDS backend. compiler/hlds_module.m: Change the module_info structure to store a counter instead of an integer for cell numbers. compiler/llds.m: Change the c_procedure structure to include a proc_label and a counter, to allow LLDS to LLDS optimizations to use this counter to allocate new label numbers. (The labels also include the proc_label.) compiler/code_info.m: Change the code_info structure to store counters instead of integers for both label numbers and cell numbers. compiler/code_gen.m: When creating the c_procedure, copy the final value of the counter from code_info to the c_procedure. compiler/opt_util.m: Delete the existing, inefficient procedure for allocating label numbers, and modify the interface of the get_prologue predicate to no longer return the proc_label (since it can now be looked up more directly). compiler/*.m: Minor changes to conform to the new data structures and to use counters instead of direct addition. |
||
|
|
8fa19d7065 |
Fix bug that only occurs if the list of tvars at a location has a hole,
Estimated hours taken: 1 compiler/stack_layout.m: Fix bug that only occurs if the list of tvars at a location has a hole, i.e. tvar N is live but tvar N-1 isn't. |
||
|
|
6ba459bdaa |
Add some `MR_' prefixes.
Estimated hours taken: 0.75 Add some `MR_' prefixes. runtime/mercury_string.h: runtime/mercury_misc.h: runtime/mercury_misc.c: runtime/mercury_make_type_info_body.h: runtime/mercury_type_info.c: runtime/mercury.c: extras/*/*.m: extras/*/*/*.m: library/*.m: trace/*.c: compiler/fact_table.m: compiler/ml_code_gen.m: compiler/stack_layout.m: Add `MR_' prefixes to fatal_error(), hash_string(), do_hash_string, and HASH_STRING_FUNC_BODY. runtime/mercury_bootstrap.h: Add backwards compatibility macros for fatal_error() and hash_string(). |
||
|
|
cbbd48080f |
Restructure the handling of RTTI and pseudo_type_infos
Estimated hours taken: 30 Restructure the handling of RTTI and pseudo_type_infos to reduce dependencies on the LLDS. compiler/rtti.m: - Change the various occurrences of llds__rval to rtti_data. - Add `field_types' and `pseudo_type_info' as new alternatives in the rtti_data and rtti_name types, to provide ways of representing things that were previously represented as create() llds__rvals. compiler/rtti_out.m: - Add some documentation to the interface. - Modify to handle the changes to rtti.m. compiler/type_ctor_info.m: - Modify to handle the changes to rtti.m. - Don't thread the cell_count or module_info through most of the code here, since it is no longer necessary. - Modify the interface to eliminate dependency on LLDS: change generate_llds to return a list(rtti_data) rather than a list(llds__comp_gen_c_data), and rename it as generate_rtti. compiler/mercury_compile.m: Update to reflect the changed interface to type_ctor_info.m. compiler/pseudo_type_info.m: Rewrite much of this module to eliminate all dependencies on LLDS. Rather than generating an llds__rval, this module now generates a new type pseudo_type_info (which is used in the pseudo_type_info alternative of the rtti_data type). compiler/ll_pseudo_type_info.m: New file, contains the parts of pseudo_type_info.m that depended on LLDS. This is needed for stack_layout.m, which still needs pseudo_type_infos represented as llds__rvals. compiler/stack_layout.m: Call the routines in ll_pseudo_type_info rather than those in pseudo_type_info. compiler/llds_common.m: Don't traverse rtti_data rvals, since they can't contain create() rvals anymore. compiler/opt_debug.m: Handle the new `field_types' and `pseudo_type_info' alternatives in the rtti_data and rtti_name types. compiler/rtti.m: compiler/rtti_out.m: compiler/llds_out.m: The predicate `rtti_address_would_include_code_addrs' was duplicated in both rtti.m and rtti_out.m. I deleted the version in rtti.m, exported the version in rtti_out.m, and changed llds_out.m to call the version in rtti_out.m. runtime/mercury_type_info.h: - Define macros for defining MR_TypeInfo and MR_PseudoTypeInfo struct types of different arities, for use by the code generated by compiler/rtti_out.m. - Define MR_TypeCtorInfo as a pointer to a _const_ struct type, to avoid the need to generate casts to cast-away-const in various places in compiler/rtti_out.m. Likewise for MR_PseudoTypeInfo. (It would be nice to do the same thing for MR_TypeInfo, since we never modify MR_TypeInfo values after constructing them, but currently they are modified by the MR_fill_in_*() macros which are used to construct them.) - Fix a couple of places where macro arguments were not properly parenthesized. |
||
|
|
4ccc3b32ac |
Cleanup of the type_ctor_infos and their components, to achieve two goals.
Estimated hours taken: 65
Cleanup of the type_ctor_infos and their components, to achieve two goals.
First, the new data structure is defined in strongly typed C, with only
two unions, whereas the old data structure was defined by a bunch of macros
that used casts all over the place. The new design should therefore make it
significantly easier to debug code that uses RTTI, and to get it right in
the first place. Second, the new data structures are logically organized,
whereas the old ones had several bad features (such as fixed fields coming
after variable-length arrays in "structures") required by backward
compatibility.
For the time being, the runtime system will be able to handle type_ctor_infos
using both the old and the new data structures, which are distinguished by
the type_ctor_info's version number.
To minimize the disruption caused by such bootstrapping, this change also
incorporates an improvement in the RTTI: for most pseudo_type_infos included
in the RTTI, it records information that allows the runtime system to tell
whether the pseudo_type_info is ground or not; if it is, then the runtime
need not scan the pseudo_type_info looking for type parameters to expand.
Based on statistics I have gathered, this will eliminate between half and two
thirds of all such scans when we do unification and comparison by RTTI.
This change does not impact the structures of typeinfos, base_typeclass_infos
or typeclass_infos.
runtime/mercury_type_info.h:
Define the C types for the new type_ctor_info components.
Update the C type for type_ctor_infos themselves, and the macros
that act on it.
Centralize the list of files that depend on type info representation
here.
Make the names of the two macros that give the number of (all kinds of)
type info vars and the number of existential type info vars consistent.
runtime/mercury_std.h:
Change a comment to refer to one of these renamed macros by its new
name.
compiler/rtti.m:
compiler/rtti_out.m:
New files: rtti.m defines new types that allow us to construct
Mercury representations of the C structures we want to emit,
and rtti_out.m converts those representations to C definitions.
These files are intended to be independent of whether the backend
is LLDS or MLDS. At the moment, there are several vestiges that
tie them to LLDS, mostly due to (a) the lack of a shared common
infrastructure between llds_out.m and mlds_to_c.m, and (b)
the continued use of the old representation of (pseudo-) typeinfos
as rvals. These concerns will be addressed in a future change.
compiler/llds.m:
Update the definition of the comp_gen_c_data and data_addr types
to account for the new RTTI structures.
compiler/llds_out.m:
Update the code to output comp_gen_c_data and data_addr values
to account for the new RTTI structures.
Make some parts of the code more modular, so that rtti_out.m
can use what used to be selected parts of predicates.
Export several predicates for use by rtti_out.m. Some of these
should later be moved to a file for infrastructure shared by
llds_out.m and mlds_to_*.m. Others should be made internal again
when the representation of typeinfos is made independent of the LLDS.
Rename some predicates to better reflect their purpose.
compiler/base_type_layout.m:
compiler/base_type_info.m:
These files are obsoleted by this change. They remain in CVS, but
are no longer used. All of base_type_info.m has been moved into
type_ctor_info.m, and so have the parts of base_type_layout.m
that create the functors and layout structures inside type_ctor_infos;
the remaining part of base_type_layout.m is now in pseudo_type_info.m.
compiler/pseudo_type_info.m:
New file containing the code to create pseudo_type_infos from
base_type_layout.m, slightly updated for the new compiler structure.
compiler/type_ctor_info.m:
New module: almost total rewrite of the base_type_info.m and the
relevant part of base_type_layout.m for the new data structure.
Do not invoke base_typeclass_info.m, since the structures it creates
are not parts of the type_ctor_infos.
compiler/ml_base_type_info.m:
Comment out obsolete unfinished code. It should be replaced by
calls to type_ctor_info, once type_ctor_info's dependence on LLDS
has been eliminated.
compiler/hlds_module.m:
Rename the data structure from which type_ctor_infos are generated.
Delete the data structure from which type_ctor_layouts were generated,
since it is redundant.
Switch to using field names.
compiler/make_tags.m:
compiler/hlds_data.m:
make_tags.m had code that duplicated much of the the functionality
of an existing predicate in hlds_data.m. This change moves that
predicate to hlds_data where it belongs, and gives it an appropriate
name.
compiler/mercury_compile.m:
Do not invoke the predicates that used to be in base_type_layouts
directly; let type_ctor_info do it for the types for which it is
appropriate.
Do invoke base_typeclass_info directly.
compiler/dead_proc_elim.m:
compiler/llds_common.m:
compiler/opt_debug.m:
compiler/stack_layout.m:
compiler/unify_gen.m:
Trivial changes to conform to the changes in the representation of
compiler-generated C data.
compiler/notes/compiler_design.html:
Updates to reflect the new files.
runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
runtime/mercury_type_info.c:
Provide alternate implementations of functionality that used the
old functors and layout structures, to use the new ones instead
if the relevant type_ctor_info's version number calls for it.
In many cases, doing this cleanly required reducing the scopes of
variables.
runtime/mercury_tabling.[ch]:
Note where additional work on tabling of typeclass infos is needed,
but do not do the work yet, since it would conflict with DJ's coming
change.
library/std_util.m:
Provide alternate implementations of functionality that used the
old functors and layout structures, to use the new ones instead
if the relevant type_ctor_info's version number calls for it.
In many cases, doing this cleanly required reducing the scopes of
variables.
The predicates get_functor and construct take an integer argument
that identifies a functor of a du type. The integer used to be
the functor's ordinal number in the type definition, but this
was not documented. It is now the functor's position in the list
of the type's functors sorted first on name and then on arity.
This functionality is potentially more useful, since io__read
could do binary instead of linear search when looking for a given
functor. This is an incompatibility, but a very minor one.
Add a new predicate, get_functor_ordinal, to provide a way
to convert lexicographic position into ordinal position.
This is not used yet.
Rename the two different kinds of variables named "info" so that
one can tell them apart.
tests/hard_coded/construct.exp:
Update the expected output of this test based on the new definition
of the meaning of functor numbers in the get_functor and construct
predicates in std_util.
tests/hard_coded/deep_copy.{m,exp}:
Add some code to test the "type contains var" bit vector in du
functor descriptions.
tests/hard_coded/existential_rtti.{m,exp}:
Make the test case print out results as it goes along, to make it
easier which subtask a core dump is coming from. Update the expected
output accordingly.
|
||
|
|
3a26ad82d5 |
Add information required for structure reuse and compile time garbage
Estimated hours taken: 2 Add information required for structure reuse and compile time garbage collection to the LLDS. The code generator does not yet generate this information. This will be committed to the main branch to avoid CVS conflicts. compiler/llds.m: Add an LLDS instruction `free_heap(rval)', which applies the MR_free_heap macro to its argument. Add a `maybe(rval)' field to `create' rvals to hold the address of a cell to reuse. This field should always be `no' after code generation, because all non-constant creates are converted into lower-level operations during code generation. compiler/value_number.m: Don't reorder instructions around a `free_heap' instruction to avoid generating code which looks at deallocated memory. compiler/*.m: Handle the new instruction and field. |
||
|
|
3995b5050f |
Fix the problem with contexts at exception ports in a way that (unlike Fergus's
Estimated hours taken: 4 (Committed by fjh on behalf of zs.) Fix the problem with contexts at exception ports in a way that (unlike Fergus's fix) does not slow down the speed-critical code path inside the debugger. compiler/stack_layout.m: When generating label layouts for return labels, give the two fields of the layout structure that correspond to arguments of the old four-argument MR_trace() values that are appropriate for use in exception events, i.e. port is exception and goal path is empty. compiler/llds.m: compiler/llds_out.m: Add exception to the trace port type, since the compiler now refers to it. runtime/mercury_stack_layout.h: trace/mercury_trace.c: Undo Fergus's change. library/exception.m: Undo Fergus's change, and my change previous to that. Pass the return layout to MR_trace unchanged, after checking that it indeed specifies an exception port. |
||
|
|
0642a10ff8 |
Reduce the number of arguments of MR_trace() to one.
Estimated hours taken: 24 WARNING: this change affects binary compatibility for debuggable code; the debuggable modules of the program and the runtime linked into the executable must either all come from before this change, or they must all come from after this change. However, this change does *not* affect binary compatibility for non-debuggable executables. Reduce the number of arguments of MR_trace() to one. Two of the arguments, the port and the goal path, move into the label layout structure, as 16-bit numbers; the port as a simple enumeration type, and the goal path as an index into the module-wide string table. (The latter will eventually allow the debugger to support the placement of breakpoints on labels with specific goal paths.) The third argument, the number of the highest-numbered rN register in use at the label, has been moved into the proc layout structure. In theory, this will require more register saves and restores, since the number in the proc layout is conservative (it is the max of the numbers that would be required at the individual labels). However, this is not important, for two reasons. First, we always save and restore all the rM registers that appear in the mrM array before the last special-purpose register, and in most cases this dictates how many registers we save/restore. Second, we save/restore registers only when the debugger starts interaction, so save/restore is a time critical activity only for the external debugger. This change reduces the execution time of debuggable executables by about 4-5% when executing outside mdb and 3-4% when executing under mdb. It also reduces executable sizes, but only by about 0.7% on x86. This change eliminates the --trace-just-in-case compiler option, since we now have the best of both --trace-just-in-case and --no-trace-just-in-case. The drawback of this scheme is slightly increased executable size with the accurage garbage collector, but that seems a small enough price to pay. compiler/code_gen.m: compiler/code_info.m: Record the number of the highest numbered rN register live at a trace label. compiler/continuation_info.m: Record the number of the highest numbered rN register live at a trace label, and the port and goal path associated with the labels of trace events. compiler/stack_layout.m: Put the number of the highest numbered rN register live at a trace label into proc layouts, and the port and goal path into label layouts. Since we are breaking binary compatibility with old debuggable modules anyway, compress the procedure id parts of proc layouts by using only 16 bits to store the procedure's arity and mode number, instead of 32 or 64. compiler/trace.m: Update the handling of ports, goal paths and max live register numbers, so that instead of being passed as MR_trace arguments, they are recorded in data structures. Generate separate labels and layouts for the fail and redo events. Although they still have the same layout information, they now record different ports. compiler/llds.m: Since trace.m now generates a label layout structure for the redo event, we must include redo events in the llds goal path type. compiler/hlds_goal.m: Since the code for handling the port type for nondet pragma events has moved from the nondet-pragma-specific to the generic part of trace.m, we must now include their event types in the hlds goal path type. compiler/llds_out.m: Add a predicate for converting ports into numbers, now that we must store ports in static data. Using their symbolic names would be better, but that would require complications in the llds type system, which would be inadvisable just before the release. compiler/options.m: compiler/handle_options.m: doc/user_guide.texi: Eliminate --trace-just-in-case. compiler/llds.m: compiler/llds_common.m: compiler/llds_out.m: Eliminate the data structure needed by --trace-just-in-case. compiler/optimize.m: Trivial update to conform to data structure changes. library/exception.m: Update the call to MR_trace. runtime/mercury_stack_layout.h: Update the C structure declarations for the layout structures as discussed above. runtime/mercury_init.h: Update the declarations of MR_trace_real and MR_trace_fake to use only one argument. runtime/mercury_wrapper.[ch]: Update the declaration of MR_trace_func to use only one argument. runtime/mercury_trace_base.[ch]: Update the declarations of MR_trace, MR_trace_real and MR_trace_fake to use only one argument. Delete MR_trace_struct(); since we deleted --trace-just-in-case, there will not be calls to it anymore. Since we are breaking binary compatibility anyway, move the exception port to be with the other interface ports. This should speed up a frequently executed test in the debugger. Update the handling of redo events. trace/mercury_trace.h: Simplify and speed up the macro that tests a port for being an interface port, now that exceptions are grouped with other interface events. trace/mercury_trace.c: Update the definition of MR_trace_real to use only one argument. The port is pulled out of the label layout structure only when needed to perform the termination tests for the current debugger command, and the goal path and the max live register number are looked up only when the termination test succeeds. |
||
|
|
93b1c221fe |
Implement RTTI for functors with existentially typed arguments.
Estimated hours taken: 160
Implement RTTI for functors with existentially typed arguments. This allows
these functors to be deconstructed (and therefore io__write works for them)
and deep_copied.
compiler/base_type_layout.m:
Generate extra information in the stack layout: the RTTI needs to
include the number of extra arguments added for type infos and
typeclass infos for each functor, as well as the locations of the
type infos for each type.
compiler/stack_layout.m:
Pass some extra arguments indicating that the pseudo type infos being
handled are not existentially quantified.
compiler/std_util.m:
Change ML_expand so that it includes information about existentially
quantified arguments in the expand info.
compiler/base_typeclass_info.m:
Extend the typeclass info structure to include enough information to
copy it at runtime.
runtime/mercury_type_info.c:
Use the new information in the RTTI to look up the type info packed
inside a constructor if the pseudo type-info in question is
existentially quantified. This may involve looking inside a typeclass
info or just taking the type info directly.
runtime/mercury_deep_copy_body.h:
Use the new RTTI to lookup up type so existentially quantified
variables when doing a deep copy.
Implement a function to deep copy typeclass infos.
runtime/mercury_deep_copy.c:
#define the appropriate things to make copy_typeclass_info work for
the different ways of allocating memory.
runtime/mercury_type_info.h:
Change some prototypes and add macros to access the new information in
the functor descriptor.
Change the macros which access typeclass infos to reflect the new
structure.
tests/hard_coded/existential_rtti.{m,exp}:
A bunch of test cases for this change.
tests/hard_coded/Mmakefile:
Turn this test case on.
|
||
|
|
f87f9d2120 |
Ensure that the none.gc and none grades compile using a compiler
Estimated hours taken: 24
Ensure that the none.gc and none grades compile using a compiler
other than gcc. This is not completely tested as lcc on linux can't
generate code for boehm_gc, and 'cc -std1' on the alpha runs out of
memory while trying to link the compiler. However the compiler does
bootstrap using just gcc and also with lcc with boehm_gc compiled by
gcc.
configure.in:
-Wl,opt1,opt2 syntax is not supported by lcc instead use -Wlopt1
-Wopt2.
compiler/export.m:
Only output a label declaration if that label is exported, as the
static label declarations are not legal C.
library/io.m:
compiler/stack_layout.m:
Replace escape sequence \x with \\x in pragma c code.
library/array.m:
library/std_util.m:
Define what the struct is before using it, so the correct size for the
struct can be calculated.
library/private_builtin.m:
Replace escape sequence \x with \\x in pragma c code.
Ensure that there is at least one local variable so that the
structure definition for holding the local vars contains something.
runtime/mercury_faultaddr.h:
Remove an unnecessary cast.
runtime/mercury_reg_workarounds.h:
#include sys/time.h for FD_ZERO().
runtime/mercury_stack_trace.h:
Remove an extraneous ',' which was causing warnings.
|
||
|
|
229aeed2b7 |
Reduce the size of traced executables slightly.
Estimated hours taken: 0.2 Reduce the size of traced executables slightly. runtime/mercury_stack_layout.h: Change the type of three fields of proc layouts from MR_int_least16_t MR_int_least8_t, since all three are the numbers of initially allocated stack slots. They are thus guaranteed to be less than 10, and thus fit into 8 bits with plenty to spare. compiler/stack_layout.m: Make the corresponding change when generating proc layouts. |
||
|
|
f0964815a3 |
Support line numbers in the debugger. You now get contexts (filename:lineno
Estimated hours taken: 40
Support line numbers in the debugger. You now get contexts (filename:lineno
pairs) printed in several circumstances, and you can put breakpoints on
contexts, when they correspond to trace events or to calls. The latter are
implemented as breakpoints on the label layouts of the return sites.
This required extending the debugging RTTI, so that associated with each
module there is now a new data structure listing the source file names that
contribute labels with layout structures to the code of the module. For each
such source file, this table gives a list of all such labels arising from
that file. The table entry for a label gives the line number within the file,
and the pointer to the label layout structure.
compiler/llds.m:
Add a context field to the call instruction.
compiler/continuation_info.m:
Instead of the old division of continuation info about labels into
trace ports and everything else, divide them into trace ports, resume
points and return sites. Record contexts with trace ports, and record
contexts and called procedure information with return sites.
compiler/code_info.m:
Conform to the changes in continuation_info.m.
compiler/options.m:
Add a new option that allows us to disable the generation of line
number information for size benchmarking (it has no other use).
compiler/stack_layout.m:
Generate the new components of the RTTI, unless the option says not to.
compiler/code_gen.m:
compiler/pragma_c_gen.m:
compiler/trace.m:
Include contexts in the information we gather for the layouts
associated with the events we generate.
compiler/call_gen.m:
Include contexts in the call LLDS instructions, for association
with the return site's label layout structure (which is done after
code generation is finished).
compiler/handle_options.m:
Delete the code that tests or sets the deleted options.
compiler/mercury_compile.m:
Delete the code that tests the deleted options.
compiler/basic_block.m:
compiler/dupelim.m:
compiler/frameopt.m:
compiler/livemap.m:
compiler/llds_common.m:
compiler/llds_out.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/value_number.m:
compiler/vn_*.m:
Trivial changes to conform to the changes to llds.m.
compiler/jumpopt.m:
Do not optimize away jumps to labels with layout structures.
The jumps we are particularly concerned about now are the jumps
that return from procedure calls. Previously, it was okay to redirect
returns from several calls so that all go to the same label, since
the live variable information associated with the labels could be
merged. However, we now also associate line numbers with calls, and
these cannot be usefully merged.
compiler/optimize.m:
Pass the information required by jumpopt to it.
doc/user_guide.texi:
Document that you can now break at line numbers.
Document the new "context" command, and the -d or --detailed option
of the stack command and the commands that set ancestor levels.
runtime/mercury_stack_layout.h:
Extend the module layout structure definition with the new tables.
Remove the conditional facility for including label numbers in label
layout structures. It hasn't been used in a long time, and neither
Tyson or me expect to use it to debug either gc or the debugger itself,
so it has no uses left; the line numbers have superseded it.
runtime/mercury_stack_trace.[ch]:
Extend the code to print stack traces to also optionally print
contexts.
Add some utility predicates currently used by the debugger that could
also be use for debugging gc or for more detailed stack traces.
trace/mercury_trace_internal.c:
Implement the "break <context>" command, the "context" command, and
the -d or --detailed option of the stack command and the commands
that set ancestor levels.
Conditionally define a conditionally used variable.
trace/mercury_trace_external.c:
Minor changes to keep up with the changes to stack traces.
Delete an unused variable.
trace/mercury_trace_spy.[ch]:
Check for breakpoints on contexts.
trace/mercury_trace_tables.[ch]:
Add functions to search the RTTI data structures for labels
corresponding to a given context.
trace/mercury_trace_vars.[ch]:
Remember the context of the current environment.
tests/debugger/queen.{inp,exp}:
Test the new capabilities of the debugger.
tests/debugger/*.{inp,exp}:
Update the expected output of the debugger to account for contexts.
In some cases, modify the input script to put contexts where they don't
overflow lines.
|
||
|
|
d5d75ac65a |
Implement deep_copy() of closures.
Estimated hours taken: 3 Implement deep_copy() of closures. compiler/stack_layout.m: Change the way we generate closure layouts so that it matches the MR_Closure_Layout structure defined in runtime/mercury_ho_call.h. runtime/mercury_deep_copy_body.h: Handle copying of closures, using the layout information in the MR_Closure_Layout structure. runtime/mercury_deep_copy.c: #include "mercury_ho_call.h", since it is needed for the MR_Closure_Layout type. tests/hard_coded/Mmakefile: tests/hard_coded/copy_pred.m: tests/hard_coded/copy_pred.exp: A test case for this change. |
||
|
|
466c844964 |
Make the retry command work in trailing grades (e.g. for HAL).
Estimated hours taken: 18 Make the retry command work in trailing grades (e.g. for HAL). compiler/trace.m: In trailing grades, reserve two stack slots to hold (a) the trail pointer on entry, and (b) a new ticket obtained on entry. Arrange to put the numbers of these stack slots in the proc layout. compiler/stack_layout.m: Put the number of the first of these stack slots in the proc layout. compiler/code_info.m: Arrange the default: there are no such slots if debugging is not enabled. compiler/code_gen.m: Insert code to discard the allocated ticket, in the success epilog of model_det procedures, the success and failure epilogs of model_semi procedures, and the failure epilogs of model_non procedures. (Model_det procedures don't have failure epilogs, and discarding the ticket in the success epilog of a model_non procedure would be premature.) compiler/llds.m: Add two new alternatives to the type describing stack slots: a stack slot may contain a trail pointer or a ticket. Add a new reason for resetting the trail: a retry in the debugger. compiler/llds_out.m: Minor changes to conform to llds.m, and to make diagnostic output less misleading. library/builtin.m: Add the type_ctor_info for the new "types" describing stored trail pointers and tickets. Bring up to date the type_ctor_infos of other "types" used only for describing stack slots. library/std_util.m: Add the missing code to handle the type_ctor_infos of trail pointers, tickets and other "types" used only for describing stack slots. runtime/mercury_type_info.h: Add a new type_ctor representation value for stored trail pointers, tickets, and for other "types" used only for describing stack slots. runtime/mercury_deep_copy_body.h: runtime/mercury_tabling.c: Add the missing code to handle the type_ctor_infos of trail pointers, tickets and other "types" used only for describing stack slots. runtime/mercury_stack_layout.h: Add a field to proc layouts to hold either the number of the first of the two stack slots holding trail info, or -1. runtime/mercury_trail.h: Add the new reason why the trail may be reset. trace/mercury_trace.c: In trailing grades, reset the trail, with the reason being given as retry, when the debugger's retry command is executed. extras/references/scoped_update.m: extras/trailed_update/var.m: clpr/cfloat.m: extras/trailed_update/tests/func_trail_test.m: extras/trailed_update/tests/func_trail_test_2.m: Handle MR_retry as a reason for unwinding the trail. |
||
|
|
73de42711a |
Fix a reference to a C type name.
Estimated hours taken: 0.1 compiler/stack_layout.m: Fix a reference to a C type name. |
||
|
|
3c2a19adfd |
Make closures always include layout information, not just in grades in which
Estimated hours taken: 51 Make closures always include layout information, not just in grades in which typeinfo liveness is turned on. This requires separating two notions, which were previously combined: - Body typeinfo liveness means that when a variable X is live, any typeinfo variables describing type variables that occur in the type of X must also be live. - Interface typeinfo liveness means that when the input arguments of a procedure include a polymorphically typed variable (e.g. X), typeinfo variables describing type variables that occur in the type of X must also be among the arguments. This change turns on interface typeinfo liveness for procedures that either have their address taken in the current module, or are exported and thus may have their address taken in some other module. compiler/hlds_pred.m: Centralize decisions wrt whether procedure interfaces and bodies use typeinfo liveness here. compiler/options.m: Rename the typeinfo_liveness option as body_typeinfo_liveness, since this reflects its new function. compiler/call_gen.m: compiler/higher_order.m: compiler/live_vars.m: compiler/liveness.m: compiler/unused_args.m: Use hlds_pred.m to make decisions about liveness. compiler/lambda.m: Always include the relevant typeinfos in the interfaces of procedures created for lambdas. compiler/continuation_info.m: compiler/stack_layout.m: compiler/unify_gen.m: Modify the predicates that record and use layout information about closures to always do so, since the necessary information is now always available about the interfaces of procedures which can be put into closures. Previously, they only did so if typeinfo_liveness was set. Also, generate information about the types of the variables in a closure from the pred_info's arg types field, not from the proc_info's var types field, because unlike the latter, it is valid even for imported predicates. compiler/hlds_out.m: Print the non-clause-related information in the clauses_info part of a pred_info (e.g. the type parameters) even if the predicate has no actual clauses. Simplify the code a bit by getting rid of a duplicate test. compiler/middle_rec.m: Require that the code generated for the base case not refer to any stack slots if this way of generating code is to be used. This is necessary because the base case is executed when the current procedure has no stack frame, and thus any references to stack slots would refer to and possibly overwrite the data in another procedure's frame. In the absence of requiring body typeinfo liveness for exported procedures, such references were not generated; in its presence, they were. However, we now require only interface liveness for exported procedures, so we can still use middle recursion for them. compiler/handle_options.m: Do not turn off middle_rec if (body) typeinfo liveness is turned on, now that the bug has been fixed. For polymorphic predicates, the base case will still contain references to stack slots, and thus the middle-rec optimization will not applied for them, but the optimization may apply to monomorphic predicates. compiler/passes_aux.m: Add the ability to call compiler passes with the procedure id as well as the predicate id of the procedure they are passed. tests/hard_coded/typeclasses/Mmakefile: Refer to --body-typeinfo-liveness instead of --typeinfo-liveness. |
||
|
|
d66c8481ae |
Some more changes to minimize the complexity of the intermodule dependencies.
Estimated hours taken: 4 Some more changes to minimize the complexity of the intermodule dependencies. In particular, ensure that hlds_module.m does not need to import llds.m. compiler/hlds_module.m: compiler/llds.m: Move the definition of the c_interface_info type (and the types used for all its fields) from llds.m into hlds_module.m, since this type contains high-level information about the user-level C interface stuff that is not directly related to the LLDS and is needed by other back-ends. compiler/hlds_module.m: compiler/llds.m: compiler/mercury_compile.m: compiler/code_gen.m: compiler/stack_layout.m: compiler/table_gen.m: Move the `global_data' type from hlds_module.m into llds.m, since this type contains low-level stuff that is dependent on the LLDS. Delete the `global_data' field of the module_info, instead passing it around as a separate argument where needed. Move the code for inserting llds__tabling_pointer_vars into the global_data from table_gen.m to code_gen.m, since this is dependent on the LLDS and table_gen.m should be a pure HLDS->HLDS transformation, so that it can work with other back-ends. compiler/continuation_info.m: Update some comments which this change makes obsolete. compiler/optimize.m: Delete the import of module hlds_data, since it is no longer needed. |
||
|
|
e3232306cb |
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. |
||
|
|
3e7367b29c |
Add options to turn off various RTTI features.
Estimated hours taken: 5 Add options to turn off various RTTI features. Also switch off the generation of variable names for accurate GC (this should be the default unless we are tracing). These new options are for space measurement only. There is little chance the code will link or work if the options are used. compiler/base_type_layout.m: Let --type-ctor-layout and --type-ctor-functors control the generation of layout and functors. compiler/mercury_compile.m: Let --type-ctor-info control the generation of type_ctor_info structures. compiler/stack_layout.m: Turn off the generation of variable names structures unless tracing. compiler/unify_proc.m: Use --special-preds to control the generation of unify and compare predicates. compiler/options.m: Add the new options (as internal use only options). |
||
|
|
f97297c65d |
Compress the representation of value shape information.
Estimated hours taken: 3 Compress the representation of value shape information. Instead of a pointer to a two-word cell containing a pseudotypeinfo and a dummy inst, just have the pseudotypeinfo itself. However, we were previously using small integer "pointers" to represent special kinds of values such as saved succips, hps, etc. Since pseudotypeinfos use small integer values for their own purposes (to represent type variables), we can't continue doing this. Therefore this change also creates type_ctor_info structures for each of these special kinds of values. These values are only used by the garbage collector, so nothing else is affected. compiler/stack_layout.m: Effect the above change. library/builtin.m: Add type_ctor_info structures and their components for the new kinds of values. runtime/mercury_stack_layout.h: Delete the section on shape information, since we don't generate such structures anymore. runtime/mercury_layout_util.c: Access pseudotypeinfos directly, not through the shape structure. runtime/mercury_type_info.h: Add new values to the type_ctor_layout enum for the special kinds of values. |
||
|
|
c2da42e6d0 |
Allow the compiler to handle create rvals whose arguments have a size
Estimated hours taken: 16 Allow the compiler to handle create rvals whose arguments have a size which is different from the size of a word. Use this capability to reduce the size of RTTI information, in two ways. The first way is by rearranging the way in which we represent information about the live values at a label. Instead of an array with an entry for each live value, the entry being a pair of Words containing a shape representation and a location description respectively, use an array of shape representations (still Words), followed by an array of 32-bit ints (which may be smaller than Word) describing locations whose descriptions don't fit into 8 bits, followed by an array of 8-bit ints describing locations whose descriptions do fit into 8 bits. The second way is by reducing the sizes of some fields in the C structs used for RTTI. Several of these had to be bigger than necessary in the past because their fields were represented by the args of a create rval. On cyclone, this reduces the size of the object file for queens.m by 2.8%. IMPORTANT Until this change is reflected in the installed compiler, you will not be able to use any modules compiled with debugging in your workspaces if the workspace has been updated to include this change. This is because the RTTI data structures generated by the old installed compiler will not be compatible with the new structure definitions. The workaround is simple: if your workspace contains modules compiled with debugging, don't do a cvs update until this change has been installed. configure.in: Check whether <stdint.h> is present. If not, autoconfigure types that are at least 16 and 32 bits in size. runtime/mercury_conf.h.in: Mention the macros used by the configure script, MR_INT_LEAST32_TYPE and MR_INT_LEAST16_TYPE. runtime/mercury_conf_param.h: Document the macros used by the configure script, MR_INT_LEAST32_TYPE and MR_INT_LEAST16_TYPE. runtime/mercury_types.h: If <stdint.h> is available, get the basic integer types (intptr_t, int_least8_t, etc) from there. Otherwise, get them from the autoconfigure script. Define types such as Word in terms of these (eventually) standard types. runtime/mercury_stack_layout.h: Add macros for manipulating short location descriptions, update the types and macros for manipulating long location descriptions. Modify the way the variable count is represented (since it now must count locations with long and short descriptions separately), and move it to the structure containing the arrays it describes. Reduce the size of the some fields in structs. This required some reordering of fields to avoid the insertion of padding by the compiler, and changes to the definitions of some types (e.g. MR_determinism). runtime/mercury_layout_util.[ch]: runtime/mercury_stack_trace.c: runtime/mercury_accurate_gc.c: trace/mercury_trace.c: trace/mercury_trace_external.c: trace/mercury_trace_internal.c: Update the code to conform to the changes to stack_layout.h. compiler/llds.m: Modify the create rval in two ways. First, add an extra argument to represent the types of the arguments, which used to always be implicit always a word in size, but may now be explicit and possibly smaller (e.g. uint_least8). Second, since the code generator would do the wrong thing with creates with smaller than wordsize arguments, replace the old must-be-unique vs may-be-nonunique bool with a three-valued marker, must_be_dynamic vs must_be_static vs can_be_either. Add uint_least8, uint_least16, uint_least32 (and their signed variants) and string as llds_types. Add a couple of utility predicates for checking whether an llds_type denotes a type whose size is the same as word. compiler/llds_out.m: Use explicitly given argument types when declaring and initializing the arguments of a cell, if they are given. compiler/llds_common.m: Don't conflate creates with identical argument values but different C-level argument types. The probability of a match is minuscule anyway. compiler/stack_layout.m: Use the new representation of creates to generate the new versions of RTTI data structures. compiler/code_exprn.m: If a create is marked must_be_static, don't inspect the arguments to decide whether it can be static or not. If it can't, we'll get an abort later on in llds_out or during C compilation anyway. compiler/base_type_layout.m: When creating pseudo typeinfos, return the llds_type of the resulting rval. Minor changes required by the change in create. compiler/base_type_info.m: compiler/base_typeclass_info.m.m: compiler/code_util.m: compiler/dupelim.m: compiler/exprn_aux.m: compiler/jumpopt.m: compiler/livemap.m: compiler/lookup_switch.m: compiler/middle_rec.m: compiler/opt_debug.m: compiler/opt_util.m: compiler/string_switch.m: compiler/unify_gen.m: compiler/vn_cost.m: compiler/vn_filter.m: compiler/vn_flush.m: compiler/vn_order.m: compiler/vn_type.m: compiler/vn_util.m: compiler/vn_verify.m: Minor changes required by the change in create. library/benchmarking.m: library/std_util.m: Use the new macros in hand-constructing proc layout structures. library/Mmakefile: Add explicit dependencies for benchmarking.o and std_util.o on ../runtime/mercury_stack_layout.h. Although this is only a subset of the truth (in reality, all library objects depend on most of the runtime headers), it is a good tradeoff between safety and efficiency. The other runtime header files tend not to change in incompatible ways. trace/Mmakefile: Add explicit dependencies for all the object files on ../runtime/mercury_stack_layout.h, for similar reasons. |
||
|
|
3bf462e0b7 |
Switch to a closure representation that includes runtime type and procedure id
Estimated hours taken: 36
Switch to a closure representation that includes runtime type and procedure id
information, so that closures can be copied, garbage collected, printed, etc.
This RTTI information is not yet used. Adding code to use it would be futile
until Tyson finishes his changes to the other RTTI data structures.
Note also that this change provides the information required for solving the
problem of trying to deep copy closures only for grades that include
--typeinfo-liveness. Providing this info for other grades is future work.
configure.in:
Find out what the right way to refer to a variable-sized array
at the end of a struct is.
runtime/mercury_ho_call.h:
New file to define the structure of closures and macros for accessing
closures.
runtime/Mmakefile:
Add the new header file.
runtime/mercury_ho_call.c:
Add an entry point to handle calls to new-style closures. The code
to handle old-style closures, which was unnecessarily duplicated for
each code model, stays until all the installed compilers use the new
closure representation.
Until that time, the new entry point will contain code to detect
the use of old-style closures and invoke the old code instead.
This allows stage1s compiled with old compilers to use the old style
and stage2 to use the new style without any special tricks anywhere
else.
Add a new entry point to handle method calls of all code models.
The old entry points, which had the same code, will also be deleted
after this change has been bootstrapped.
runtime/mercury_calls.h:
Remove the macros that call closures. Their interface sucked, they
were not used, and their implementation is now out of date.
runtime/mercury_stack_layout.h:
Add a new type, MR_Type_Param_Locns, for use by the C type
representing closures. Since MR_Stack_Layout_Vars has a field,
MR_slvs_tvars, which references a data structure identical
in every way to MR_Type_Param_Locns, change the type of that field
to this new type, instead of the previous cheat.
runtime/mercury_layout_util.h:
Minor update to conform to the new type of the MR_slvs_tvars field.
(This is the only use of that field in the system.)
runtime/mercury_type_info.h:
Add new types MR_TypeInfo and MR_PseudoTypeInfo. For now, they
are just Word, but later we can make them more accurate.
In the meantime, we can refer to them instead of to Word,
making code clearer. One such reference is now in mercury_ho_call.h.
compiler/notes/release_checklist.html:
Add a reminder to remove the redundant code from mercury_ho_call.c
after bootstrapping.
compiler/llds.m:
Replace three code addresses for calling closures and another three
for calling methods with one each.
compiler/call_gen.m:
compiler/dupelim.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/llds_out.m:
Trivial updates in accordance with the change to llds.m
compiler/code_info.m:
Move the code to handle layouts to continuation_info.m,
since that's where it belongs. Leave only the code for picking
up parameters from code_infos and for putting results back in there.
Remove the redundant arguments of code_info__init, and extract
them from ProcInfo, to make clear that they are related.
compiler/code_gen.m:
Since we pass ProcInfo to code_info__init, don't pass its components.
compiler/continuation_info.m:
Add the code moved from code_info.m, in a form which takes explicit
arguments for things that used be hidden in the code_info.
Add new code, closely related to the moved code, that creates
layout info from a procedure's argument info, rather than from a
(part of) the current code generator state. This way, it can be
invoked from places that don't have a code_info for the procedure
for which they want to generate layouts. This is the case when
we generate layouts for closures.
compiler/par_conj_gen.m:
compiler/trace.m:
Minor changes required by the move of stuff from code_info to
continuation_info.
compiler/stack_layout.m:
Export some predicates for use by unify_gen.
compiler/unify_gen.m:
Switch to creating new style closures, complete with layout info.
Optimize the code for extending closures a bit. By copying the
fixed words of the closure outside the loop, we avoid incurring
the loop overhead twice.
compiler/code_util.m:
Add a couple of utility predicates for continuation_info.m and
unify_gen.m
library/benchmarking.m:
library/std_util.m:
Refer to the new entry point for handling closures.
browser/dl.m:
Use the new closure representation.
Note that extras/dynamic_linking/dl.m, which is supposed to be
the same as browser/dl.m but is not, should also be updated, but
this will be handled later by Fergus.
tests/hard_coded/closure_extension.{m,exp}:
A new test case to exercise the code for extending closures.
tests/hard_coded/Mmakefile:
Enable the new test case.
|
||
|
|
27f024b2e9 |
Reorganize the handling of global data structures, and expose the table
Estimated hours taken: 16 Reorganize the handling of global data structures, and expose the table pointers for tabled predicates to allow the tables to be reset to empty by hand-written C code for benchmarking purposes. compiler/hlds_module.m: Introduce a new submodule for dealing with global data. At the moment it deals with (a) layout structures and (b) tabling pointers. compiler/continuation_info.m: Remove the data structures and predicates whose equivalents are now in hlds_module. compiler/llds.m: Introduce a new kind of item, that of compiler-generated variables whose value is not defined by rvals. At the moment, the only such item is a tabling pointer variable. compiler/mercury_compile.m: Include the new kind of item in the generated LLDS. compiler/table_gen.m: Use the new kind of item instead of a static variable declaration in pragma C code to hold the tabling pointer. Remove lots of spaces at ends of lines, since many of these screw up paragraph commands in vi. compiler/base_type_layout.m: compiler/bytecode_gen.m: compiler/code_gen.m: compiler/code_util.m: compiler/dependency_graph.m: compiler/hlds_out.m: compiler/llds_out.m: compiler/mercury_to_mercury.m: compiler/switch_gen.m: compiler/transform_llds.m: compiler/unify_gen.m: Handle the changes in the data structures. library/private_builtin.m: Remove the predicate get_table, which is no longer used after the changes to table_gen.m. |