mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 15:26:31 +00:00
3c2a19adfda43f2e16fee932b93f80d6585d8827
267 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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. |
||
|
|
8ab130a3b0 |
Add a new pass to the compiler, that attempts to introduce accumulators
Estimated hours taken: 500
Add a new pass to the compiler, that attempts to introduce accumulators
into a procedure so as to make that procedure tail recursive.
WORK_IN_PROGRESS:
Document that the transformation now exists.
compiler/goal_util.m:
Create goal_util__can_reorder_goals, which is a version of
pd_util__can_reorder_goals that will work on the alias branch.
compiler/instmap.m:
Add instmap__changed_vars. This predicate is meant to provide the
same functionality as instmap_delta_changed_vars, but work on the
alias branch.
Also add comment to instmap_delta_changed_vars about using
instmap_changed_vars
compiler/accumulator.m:
The transformation.
compiler/mercury_compile.m:
Call the transformation.
compiler/options.m:
Add the option to turn the transformation on.
doc/user_guide.texi:
Document the option.
profiler/demangle.m:
util/mdemangle.c:
Demangle the accumulator version of the procedure labels.
compiler/notes/compiler_design.html:
Add the new pass to the documentation.
|
||
|
|
95517bc1c8 |
Remove support for --args simple. We don't use it, we won't use it even for
Estimated hours taken: 4.5 Remove support for --args simple. We don't use it, we won't use it even for experiments, and it is unnecessary complication. If anybody were using --args simple, this would need bootstrapping, but since nobody does, there is no need, and this can be committed as an ordinary change. compiler/options.m: doc/user_guide.texi: scripts/*.in: scripts/*.sh-subr: Remove the --args option. compiler/globals.m: Remove the args_method global and its access predicates. compiler/handle_options.m: Don't set the args_method global from the option. compiler/arg_info.m: Remove support for --args simple. This allows us to remove a now redundant argument from an exported predicate. compiler/mercury_compile.m: Remove the code for passing -DCOMPACT_ARGS to the C compiler. compiler/bytecode_gen.m: compiler/fact_table.m: compiler/follow_vars.m: compiler/live_vars.m: compiler/call_gen.m: Don't pass the unnecessary argument to arg_info. compiler/call_gen.m: compiler/unify_gen.m: Remove now unnecessary assertions. compiler/hlds_pred.m: Don't include an args_method in proc_infos; instead, include a slot that says whether the procedure's address is taken or not. (In most cases, this determined whether the args_method was simple or compact.) We will need this bool in the near future (when we generate layout structures for procedures whose address is taken). Modify the signatures of exported predicates to accommodate this change to the data structure. compiler/hlds_out.m: Print the new slot, not the args_method. compiler/lambda.m: When creating procedures from lambdas, set the address-taken slot to address_is_taken instead of setting up its args_method. compiler/make_hlds.m: Minor changes to conform to the changes in the signatures of the predicates exported from hlds_pred.m. compiler/check_typeclass.m: compiler/clause_to_proc.m: compiler/dnf.m: compiler/magic.m: compiler/magic_util.m: compiler/modecheck_call.m: compiler/pd_info.m: compiler/post_typecheck.m: compiler/unify_gen.m: Minor changes to conform to the changes in the signatures of the predicates exported from hlds_pred.m and make_hlds.m. runtime/mercury_type_info.h: Remove the conditional definition of the macros that provided an argument-method-independent way of referring to the registers holding the inputs and outputs of e.g. unification procedures. We don't need the independence anymore, and using registers instead of macros in the code ensures that maintainers are aware of register reuse issues (e.g. they copy an input from r1 before overwriting it with an output). runtime/mercury_conf_param.h: runtime/mercury_grade.h: Remove support for the args method component of the grade. runtime/mercury_ho_call.c: runtime/mercury_tabling.c: library/*.m: Conform to the changes in runtime/mercury_type_info.h by effectively applying the #defines appropriate to compact args by hand. Remove code and data structures only needed for simple args. Remove comments needed only in the presence of uncertainty about the args method. |
||
|
|
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). |
||
|
|
ca0b3b7c6b |
Add an option that causes the compiler to pass information to the
Estimated hours taken: 8 Add an option that causes the compiler to pass information to the execution tracing system in one struct, rather than four separate arguments. Two of these arguments are pointers, which each require two instructions to set up on SPARC, MIPS and other RISCs that do not use a global pool. The other two arguments are small constants. Therefore on 32-bit RISCs, replacing MR_trace/4 with MR_trace_struct/1 will probably replace six instructions with two, which saves four instructions' worth of time and 16 bytes of code, at the cost of 12 bytes of data, and possibly the cost of some instructions later loading the info from the struct into registers. However, this loading cost does not have to be paid if tracing is not enabled, and other optimizations may reduce the cost even if tracing is enabled. For example, I strongly suspect that on out-of-order machines, which means most CPUs you can buy today, the load instructions are effectively free, because they happen while the indirect jump to MR_trace_real takes place. I intend to benchmark this option on our various platforms, and have autoconfigure set it on the machines in which it is beneficial. doc/user_guide.texi: Document the new --call-trace-struct option, and say it is not for general use. compiler/options.m: Add the new option. compiler/trace.m: If the option is set, call MR_trace_struct instead of MR_trace, and create a new kind of static (in both senses) global data structure to hold the arguments. Move the definition of trace_port to llds.m, and the procedure to convert it to string to llds_out.m compiler/code_info.m: Add an extra code_info slot to hold this new kind of global data, and its access predicates. compiler/code_gen.m: Transfer this new kind of global data from code_info to the global_data part of module_info. compiler/hlds_module.m: Add a new field to the global_data data structure to hold this data. compiler/mercury_compile.m: Include the new global data in the list of things we give to llds_out. compiler/llds.m: Add a new kind of comp_gen_c_data to hold MR_trace_struct arguments. Also move the definition of trace_port from trace.m to here, since the new kind of comp_gen_c_data refers to this type. compiler/llds_out.m: Add code to print the new kind of comp_gen_c_data. Move the code to print trace_ports from trace.m to here. compiler/llds_common.m: Ignore the new kind of comp_gen_c_data, since by construction its contents are never common with anything else. runtime/mercury_trace_base.[ch]: Add a new variant of MR_trace, MR_trace_struct, that consolidates the arguments into a single MR_Trace_Call_Info struct. Fix a bad variable name: the int argument to MR_trace is a max r register number, not a max mr register number. |
||
|
|
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. |
||
|
|
0707644ab0 |
Remove the obsolete option --heap-space, which was used only with NU-Prolog.
Estimated hours taken: 0.2 Remove the obsolete option --heap-space, which was used only with NU-Prolog. compiler/options.m: Remove the option. compiler/handle_options.m: Don't set the option. doc/user_guide.texi: Don't document the option. library/io.m: Delete the code that is only invoked when the option is set. |
||
|
|
79dcbbef15 |
User-guided type specialization.
Estimated hours taken: 60 User-guided type specialization. compiler/prog_data.m: compiler/prog_io_pragma.m: compiler/modules.m: compiler/module_qual.m: compiler/mercury_to_mercury.m: Handle `:- pragma type_spec'. compiler/prog_io_pragma.m: Factor out some common code to parse predicate names with arguments. compiler/hlds_module.m: Added a field to the module_sub_info to hold information about user-requested type specializations, filled in by make_hlds.m and not used by anything after higher_order.m. compiler/make_hlds.m: For each `:- pragma type_spec' declaration, introduce a new predicate which just calls the predicate to be specialized with the specified argument types. This forces higher_order.m to produce the specialized versions. compiler/higher_order.m: Process the user-requested type specializations first to ensure that they get the correct names. Allow partial matches against user-specified versions, e.g. map__lookup(map(int, list(int)), int, list(int)) matches map__lookup(map(int, V), int, V). Perform specialization where a typeclass constraint matches a known instance, but the construction of the typeclass_info is done in the calling module. Give slightly more informative progress messages. compiler/dead_proc_elim.m: Remove specializations for dead procedures. compiler/prog_io_util.m: Change the definition of the `maybe1' and `maybe_functor' types to avoid the need for copying to convert between `maybe1' and `maybe1(generic)'. Changed the interface of `make_pred_name_with_context' to allow creation of predicate names for type specializations which describe the type substitution. compiler/make_hlds.m: compiler/prog_io_pragma.m: Make the specification of pragma declarations in error messages consistent. (There are probably some more to be fixed elsewhere for termination and tabling). compiler/intermod.m: Write type specialization pragmas for predicates declared in `.opt' files. compiler/mercury_to_mercury.m: Export `mercury_output_item' for use by intermod.m. compiler/options.m: Add an option `--user-guided-type-specialization' enabled with `-O2' or higher. compiler/handle_options.m: `--type-specialization' implies `--user-guided-type-specialization'. compiler/hlds_goal.m: Add predicates to construct constants. These are duplicated in several other places, I'll fix that as a separate change. compiler/type_util.m: Added functions `int_type/0', `string_type/0', `float_type/0' and `char_type/0' which return the builtin types. These are duplicated in several other places, I'll fix that as a separate change. library/private_builtin.m: Added `instance_constraint_from_typeclass_info/3' to extract the typeclass_infos for a constraint on an instance declaration. This is useful for specializing class method calls. Added `thread_safe' to various `:- pragma c_code's. Added `:- pragma inline' declarations for `builtin_compare_*', which are important for user-guided type specialization. (`builtin_unify_*' are simple enough to go in the `.opt' files automatically). compiler/polymorphism.m: `instance_constraint_from_typeclass_info/3' does not need type_infos. Add `instance_constraint_from_typeclass_info/3' to the list of `typeclass_info_manipulator's which higher_order.m can interpret. NEWS: doc/reference_manual.texi: doc/user_guide.texi Document the new pragma and option. tests/invalid/Mmakefile: tests/invalid/type_spec.m: tests/invalid/type_spec.err_exp: Test error reporting for invalid type specializations. tests/hard_coded/Mmakefile: tests/invalid/type_spec.m: tests/invalid/type_spec.exp: Test type specialization. |
||
|
|
c69b4e09e3 |
Rearrange and improve the documentation of the compilation model and
Estimated hours taken: 2
Rearrange and improve the documentation of the compilation model and
code generation options.
doc/user_guide.texi:
compiler/options.m:
- Move the `--max-jump-table-size' option to the code generation
options section, since this option is not a compilation model
option (it doesn't affect binary compatibility).
- Move the compilation model options that are not intended for general
use into a new subsection "developer compilation model options".
- Move the code generation options that are used for optimizing
the generated C code based on the target architecture
(these also happen to be all the ones that are not intended for
general use) into a new subsection "code generation target options".
- Add line breaks, i.e. "@*" in TexInfo, after all the
"(This option is not intended for general use.)" statements.
compiler/options.m:
- Move the `--have-delay-slot' and `--num-real-{r,f}-{regs,temps}'
options to the code generation options section, since these options
are not a compilation model option (they don't affect binary
compatibility). These options were already in the code generation
options section in user_guide.texi.
- Fix a few minor layout error in the options help message.
doc/user_guide.texi:
Document the `--no-reclaim-heap-on-failure' option. Previously
this was documented in options.m but not in user_guide.texi.
|
||
|
|
dc03496d06 |
Rewrite significant parts of minimal model tabling so that it works
Estimated hours taken: 130
Rewrite significant parts of minimal model tabling so that it works
in a much wider variety of situations, including coups. Also, clean up
the tabling implementation to make it more maintainable, and introduce
a new grade component, .mm, that enables minimal model tabling.
(Minimal model tabling requires distributed fat, and we don't want to
incur such costs unless necessary.)
compiler/options.m:
Add a new option --use-minimal-model, which for now is documented
as "not for general use". This option is a grade option, and is
required if minimal model tabling is to work.
compiler/handle_options.m:
When --use-minimal-model is given, do not allow nondet frame hijacks,
since minimal model tabling cannot cope with hijacks.
Make --use-minimal-model a grade component.
compiler/code_info.m:
When --use-minimal-model is given, insert calls to MR_commit_{mark,cut}
around goals being committed across. This is now necessary, so that we
can detect and handle sitations where a goal being committed across
starts but does not complete a tabled goal.
compiler/table_gen.m:
Rename many of the tabling helper predicates, using a naming scheme
that separates predicates used for model_non procedures from those
used to implement simpler forms of tabling, while bringing out
the parallels between these two sets of predicates.
When calls to two tabling helper predicates always occur
one after the other, merge the two into one.
Generate and use more meaningful variable names; having all of the
several variables inserted by this transformation named TableVar
was quite confusing.
library/private_builtin.m:
Reorganize this file, to separate out the different sections.
The contents of the non-tabling sections were not modified, only
moved around.
Rename the predicates referred to by table_gen.m.
Move most of the type declarations and complex code out of here,
into runtime/mercury_tabling.c. This makes it easier to debug them,
since (a) creating a new executable is quicker, since you don't have
to wait for lots of mercury compiler invocations, and (b) gdb doesn't
get confused by #line directives. It also makes it easier to write
them, since you don't have to !&(*U&( remember to double all your
double quotes and to backslash all your backslashes.
runtime/mercury_grade.h:
Include a grade component reflecting whether MR_USE_MINIMAL_MODEL
is defined.
runtime/mercury_conf_param.h:
Document MR_USE_MINIMAL_MODEL.
runtime/mercury_stacks.[ch]:
The changes to tabling require the addition of two new stacks,
the generator stack and the cut stack. This module defines the
structures of the frames of these stacks and provides the
operations on these stacks.
The header file also contains some additional macros that return
the addresses of fixed nondet stack slots, not their contents,
for use by tabling code.
runtime/mercury_context.[ch]:
runtime/mercury_memory.[ch]:
runtime/mercury_wrapper.[ch]:
Declare and set up the two new stacks, both in saved contexts and in
the active context, if MR_USE_MINIMAL_MODEL is defined.
runtime/mercury_regorder.h:
Add four new global virtual machine registers to hold pointers
to the memory areas of the two new stacks and the current offsets
within them. These are defined whether MR_USE_MINIMAL_MODEL is defined
or not, since the cost is minimal and the potential bugs we avoid
would be hard to track down.
runtime/mercury_engine.h:
runtime/mercury_wrapper.c:
Add support for a new debugging flag, -dS, which prints the contents
of the nondet stack at several points during tabling.
runtime/mercury_tabling.[ch]:
The implementation of the new tabling system. Much of the new code here
is stuff moved from library/private_builtin.m, but in a significantly
rewritten form. There is also substantial new code, e.g. to handle
the extension of saved stack segments, and to manage dependencies
between subgoals in general.
Improve the documentation considerably.
Replace lists stored as Mercury data structures with lists stored
as linked structures in the usual C fashion. This allows us to use
debuggers such as ddd on these data structures, whose complexity
requires this.
Ensure that global names start with MR_.
runtime/mercury_init.h:
Explicitly include mercury_regs.h at the start. Without this,
we get an error, because now mercury_wrappers.h, which mercury_init.h
includes, also includes mercury_regs.h, but not before functions
have been declared.
runtime/Mmakefile:
Refer to the new file mercury_stacks.c (mercury_stacks.h already
existed, but the module consisted entirely of macros.)
Fix a sorting error.
scripts/{init,parse,final}_grade_options.sh-subr:
scripts/mgnuc.in:
Handle the new grade component.
tests/tabling/*
Add several new test cases that we now pass, most of which we couldn't
pass before. Also add some new test cases that we don't pass yet,
due to interactions between tabling and negated contexts.
trace/mercury_trace_internal.c:
If MR_USE_MINIMAL_MODEL is defined, add a new command to print
the generator stack. (The new command is deliberately not documented
in doc/mdb_doc yet, since (a) it is intended for developers only,
and (b) there is no way to test MR_USE_MINIMAL_MODEL in mdb_doc.)
|
||
|
|
e28409674f |
Only emit #line directives if the option --line-numbers is given.
Estimated hours taken: 1.5 compiler/llds_out.m: Only emit #line directives if the option --line-numbers is given. compiler/option.m: Make --line-numbers the default, and remove the -n shorthand for this option (since it would have the wrong sense). Document the new use of this option, and the new default. doc/user_guide.texi: Document the new use of this option, and the new default. |
||
|
|
35807f4e92 |
Fix a bug in the help message: the short form of the
Estimated hours taken: 0.25 compiler/options.m: Fix a bug in the help message: the short form of the `--line-numbers' option is `-n', not `-l'. |
||
|
|
76ce665dfc |
Replace the reference to the "not yet written" debugging chapter
Estimated hours taken: 0.02 compiler/options.m: Replace the reference to the "not yet written" debugging chapter of the users' guide, since it has been written a while ago. |
||
|
|
1f312b45e9 |
During the writing of the RTTI paper, we decided that type_ctor_info
Estimated hours taken: 8
During the writing of the RTTI paper, we decided that type_ctor_info
was a much better name than base_type_info.
Rename base_type* as type_ctor*, except we don't rename the modules
base_type_info and base_type_layout just yet.
Most of these changes were made using the following sed patterns:
s/base_type_info/type_ctor_info/g
s/base_type_layout/type_ctor_layout/g
s/base_type_functors/type_ctor_functors/g
s/BASETYPE_INFO/TYPE_CTOR_INFO/g
s/TYPEFUNCTORS/TYPE_CTOR_FUNCTORS/g
s/TYPELAYOUT/TYPE_CTOR_LAYOUT/g
s/BASE_TYPEINFO/TYPE_CTOR_INFO/g
s/BASE_TYPE_INFO/TYPE_CTOR_INFO/g
s/BaseTypeInfo/TypeCtorInfo/g
s/BaseTypeLayout/TypeCtorLayout/g
s/base_type(/type_ctor(/g
s/:- module type_ctor_info/:- module base_type_info/g
s/:- module type_ctor_layout/:- module base_type_layout/g
s/type_ctor_info__/base_type_info__/g
s/type_ctor_layout__/base_type_layout__/g
/import_module/s/type_ctor_info/base_type_info/g
/import_module/s/type_ctor_layout/base_type_layout/g
compiler/*.m:
library/*.m:
runtime/*.{c,h}:
profiler/demangle.m:
util/mdemangle.c:
Applied the above sed commands.
runtime/mercury_bootstrap.h:
Add bootstrapping #defines so the type_ctor_* substitutions in
the library don't cause link problems.
Delete some redundant bootstrapping definitions.
|
||
|
|
4e8a28fe23 |
Accept `*_optimise_*' for the Aditi optimization options.
Estimated hours taken: 0.1 compiler/options.m: Accept `*_optimise_*' for the Aditi optimization options. |
||
|
|
18430aaef1 |
Aditi compilation.
Estimated hours taken: 1200
Aditi compilation.
compiler/options.m:
The documentation for these is commented out because the Aditi
system is not currently useful to the general public.
--aditi: enable Aditi compilation.
--dump-rl: write the intermediate RL to `<module>.rl_dump'.
--dump-rl-bytecode: write a text version of the bytecodes
to `<module>.rla'
--aditi-only: don't produce a `.c' file.
--filenames-from-stdin: accept a list of filenames to compile
from stdin. This is used by the query shell.
--optimize-rl, --optimize-rl-cse, --optimize-rl-invariants,
--optimize-rl-index, --detect-rl-streams:
Options to control RL optimization passes.
--aditi-user:
Default owner of any Aditi procedures,
defaults to $USER or "guest".
--generate-schemas:
write schemas for base relations to `<module>'.base_schema
and schemas for derived relations to `<module>'.derived_schema.
This is used by the query shell.
compiler/handle_options.m:
Handle the default for --aditi-user.
compiler/hlds_pred.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/make_hlds.m:
Add some Aditi pragma declarations - `aditi', `supp_magic', `context',
`naive', `psn' (predicate semi-naive), `aditi_memo', `aditi_no_memo',
`base_relation', `owner' and `index'.
Separate out code to parse a predicate name and arity.
compiler/hlds_pred.m:
Add predicates to identify Aditi procedures.
Added markers `generate_inline' and `aditi_interface', which
are used internally for Aditi code generation.
Add an `owner' field to pred_infos, which is used for database
security checks.
Add a field to pred_infos to hold the list of indexes for a base
relation.
compiler/make_hlds.m:
Some pragmas must be exported if the corresponding predicates
are exported, check this.
Make sure stratification of Aditi procedures is checked.
Predicates with a mode declaration but no type declaration
are no longer assumed to be local.
Set the `do_aditi_compilation' field of the module_info if there
are any local Aditi procedures or base relations.
Check that `--aditi' is set if Aditi compilation is required.
compiler/post_typecheck.m:
Check that every Aditi predicate has an `aditi__state' argument,
which is used to ensure sequencing of updates and that Aditi
procedures are only called within transactions.
compiler/dnf.m:
Changed the definition of disjunctive normal form slightly
so that a call followed by some atomic goals not including
any database calls is considered atomic. magic.m can handle
this kind of goal, and it results in more efficient RL code.
compiler/hlds_module.m:
compiler/dependency_graph.m:
Added dependency_graph__get_scc_entry_points which finds
the procedures in an SCC which could be called from outside.
Added a new field to the dependency_info, the
aditi_dependency_ordering. This contains all Aditi SCCs of
the original program, with multiple SCCs merged where
possible to improve the effectiveness of differential evaluation
and the low level RL optimizations.
compiler/hlds_module.m:
Add a field to record whether there are any local Aditi procedures
in the current module.
Added versions of module_info_pred_proc_info and
module_info_set_pred_proc_info which take a pred_proc_id,
not a separate pred_id and proc_id.
compiler/polymorphism.m:
compiler/lambda.m:
Make sure that predicates created for closures in Aditi procedures
have the correct markers.
compiler/goal_util.m:
Added goal_util__switch_to_disjunction,
goal_util__case_to_disjunct (factored out from simplify.m)
and goal_util__if_then_else_to_disjunction. These are
require because supplementary magic sets can't handle
if-then-elses or switches.
compiler/type_util.m:
Added type_is_aditi_state/1.
compiler/mode_util.m:
Added partition_args/5 which partitions a list of arguments
into inputs and others.
compiler/inlining.m:
Don't inline memoed procedures.
Don't inline Aditi procedures into non-Aditi procedures.
compiler/intermod.m:
Handle Aditi markers.
Clean up handling of markers which should not appear in `.opt' files.
compiler/simplify.m:
Export a slightly different interface for use by magic.m.
Remove explicit quantifications where possible.
Merge multiple nested quantifications.
Don't report infinite recursion warnings for Aditi procedures.
compiler/prog_out.m:
Generalised the code to output a module list to write any list.
compiler/code_gen.m:
compiler/arg_info.m:
Don't process Aditi procedures.
compiler/mercury_compile.m:
Call magic.m and rl_gen.m.
Don't perform the low-level annotation passes on Aditi procedures.
Remove calls to constraint.m - sometime soon a rewritten version
will be called directly from deforestation.
compiler/passes_aux.m:
Add predicates to process only non-Aditi procedures.
compiler/llds.m:
compiler/llds_out.m:
Added new `code_addr' enum members, do_{det,semidet,nondet}_aditi_call,
which are defined in extras/aditi/aditi.m.
compiler/call_gen.m:
Handle generation of do_*_aditi_call.
compiler/llds_out.m:
Write the RL code for the module as a constant char array
in the `.c' file.
compiler/term_errors.m:
compiler/error_util.m:
Move code to describe predicates into error_util.m
Allow the caller to explicitly add line breaks.
Added error_util:list_to_pieces to format a list of
strings.
Reordered some arguments for currying.
compiler/hlds_out.m:
Don't try to print clauses if there are none.
runtime/mercury_init.h:
util/mkinit.c:
scripts/c2init.in:
Added a function `mercury__load_aditi_rl_code()' to the generated
`<module>_init.c' file which throws all the RL code for the program
at the database. This should be called at connection time by
`aditi__connect'.
Added an option `--aditi' which controls the output
`mercury__load_aditi_rl_code()'.
compiler/notes/compiler_design.html:
Document the new files.
Mmakefile:
bindist/Mmakefile:
Don't distribute extras/aditi yet.
New files:
compiler/magic.m:
compiler/magic_util.m:
Supplementary magic sets transformation. Report errors
for constructs that Aditi can't handle.
compiler/context.m:
Supplementary context transformation.
compiler/rl_gen.m:
compiler/rl_relops.m:
Aditi code generation.
compiler/rl_info.m:
Code generator state.
compiler/rl.m:
Intermediate RL representation.
compiler/rl_util:
Predicates to collect information about RL instructions.
compiler/rl_dump.m:
Print out the representation in rl.m.
compiler/rl_opt.m:
Control low-level RL optimizations.
compiler/rl_block.m:
Break a procedure into basic blocks.
compiler/rl_analyse.m:
Generic dataflow analysis for RL procedures.
compiler/rl_liveness.m:
Make sure all relations are initialised before used, clear
references to relations that are no longer required.
compiler/rl_loop.m:
Loop invariant removal.
compiler/rl_block_opt.m:
CSE and instruction merging on basic blocks.
compiler/rl_key.m:
Detect upper/lower bounds for which a goal could succeed.
compiler/rl_sort.m:
Use indexing for joins and projections.
Optimize away unnecessary sorting and indexing.
compiler/rl_stream.m:
Detect relations which don't need to be materialised.
compiler/rl_code.m:
RL bytecode definitions. Automatically generated from the Aditi
header files.
compiler/rl_out.m:
compiler/rl_file.m:
Output the RL bytecodes in binary to <module>.rlo (for use by Aditi)
and in text to <module>.rla (for use by the RL interpreter).
Also output the schema information if --generate-schemas is set.
compiler/rl_exprn.m:
Generate bytecodes for join conditions.
extras/aditi/Mmakefile:
extras/aditi/aditi.m:
Definitions of some Aditi library predicates and the
interfacing and transaction processing code.
|
||
|
|
650fb78cd5 |
Add compiler support for Mark's declarative debugger.
Estimated hours taken: 5 Add compiler support for Mark's declarative debugger. The runtime support will come later. from Mark. compiler/options.m: Add a new option, --trace-decl, that causes the compiler to reserve two extra stack slots in every stack frame. The declarative debugger will use these slots to store pointers to the proof tree node of the current call, and the location in the parent's proof tree node where the proof tree node of this call ought to be inserted. Since there is no runtime support yet, the option is not yet included in the help message. compiler/trace.m: Generalize the code for reserving stack slots for tracing, and expand it to conditionall allocate two slots for the declarative debugger. Add a new type trace_slot_info, and use that instead of maybe(int) to describe the stack slots used by the trace system, for passing through code_info and code_gen to continuation_info. compiler/code_info.m: compiler/code_gen.m: compiler/continuation_info.m: Minor changes (mostly to variable names and comments) to refer to trace_slot_info. compiler/stack_layout.m: Include the numbers of the two stack slots used for declarative debugging in the procedure's stack layout structure. Actually, since these two stack slots are always adjacent, we only store the number of the first. runtime/mercury_stack_layout.h: Extend the MR_Stack_Layout_Entry struct to cover the new entry. doc/user_guide.texi: Add documentation of the new option, commented out for now. |
||
|
|
0cfadc82ee |
Avoid lines longer than 80 columns in the output of `mmc --help'.
Estimated hours taken: 0.25 Avoid lines longer than 80 columns in the output of `mmc --help'. compiler/options.m: Delete some unwanted tabs. compiler/handle_options.m: Wrap a long line. |
||
|
|
d6e3dbb644 |
If --c-debug' is set, then when linking, pass --no-strip' to `ml'.
Estimated hours taken: 0.25 compiler/mercury_compile.m: If `--c-debug' is set, then when linking, pass `--no-strip' to `ml'. doc/user_guide.texi: compiler/options.m: Update the documentation of the `--c-debug' option to reflect the above-mentioned change. |
||
|
|
8caba4e15d |
Make it possible to compile a module (e.g. std_util) without debugging,
Estimated hours taken: 18
Make it possible to compile a module (e.g. std_util) without debugging,
while still allowing debuggable code called from that module via higher-order
predicates (e.g. solutions) to have a proper stack trace.
compiler/options.m:
Add the new option --stack-trace-higher-order.
compiler/mercury_compile.m:
Always invoke continuation_info and stack_layout, since it is no
longer the case that either all procedures or none get layout
structures generated for them, and the other modules are in a better
position to make that decision.
compiler/continuation_info.m:
Handle the extra tests required by the change to mercury_compile.m.
When we gather info about a procedure, remember whether that
procedure must have a procedure layout that includes the procedure id
section.
compiler/stack_layout.m:
Use the flag remembered by continuation_info to help decide
whether we need procedure layout structures.
Fix an old space wastage: after generating marker saying that
the second and later groups of fields of a procedure layout are
not present, do not generate another marker saying that the
third group of fields is not present. Since it was in the wrong
position, it did not have the right meaning; it only worked because,
due to the presence of the first marker, it was never looked at anyway.
compiler/code_gen.m:
Use the new capability of continuation_info.m to require
procedure layouts including procedure id sections for any predicate
that has higher-order arguments, if --stack-trace-higher-order is set.
compiler/globals.m:
Rename want_return_layouts as want_return_var_layouts, since this
is a more accurate representation of what the predicate does.
compiler/call_gen.m:
compiler/code_info.m:
Conform to the change in globals.m.
compiler/llds_out.m:
Separate the c_modules containing compiler-generated code into two
groups, those that define labels that have stack layouts and those
that don't. In most cases one or the other category will be empty,
but with --stack-trace-higher-order, the c_modules containing
higher-order procedures will have stack layouts, while others will
not.
Reorganize the way the way the initialization functions are generated,
by putting c_modules falling into different categories into different
bunches. c_module falling into the first category always have their
initialization code included, while those in the second category
have it included only if the old flag MR_MAY_NEED_INITIALIZATION
is set.
Delete the obsolete #define of MR_STACK_TRACE_THIS_MODULE.
Improve some predicate names, in an effort to prevent confusion
about what a "file" is (since the code uses more than one meaning,
given the presence of --split-c-files).
compiler/pragma_c_gen.m:
Fix an old bug: s/NONDET_FIXED_SIZE/MR_NONDET_FIXED_SIZE/.
Required for the change to library/string.m.
doc/user_guide.texi:
Document the new option.
runtime/mercury_goto.c:
Simplify the conditions under which labels get added to the label
table with:
- The macros init_{entry,label,local}_ai always add
the label to the label table without a layout structure.
- The macros init_{entry,label,local}_sl always add it with a layout
structure.
- Whether the macros init_{entry,label,local} with no suffix
add the label to the label table depends on the values of other
configuration parameters, but they will never include a layout
structure.
The intended use is that any label that has a layout structure should
be initialized with a _sl macro. Any other label that should always
be in the label table if the label table is needed at all (labels
such as do_fail) should be initialized with _ai. Everything else
should be initialized with a suffixless macro.
runtime/mercury_conf_params.c:
Remove MR_USE_STACK_LAYOUTS and MR_STACK_TRACE_THIS_MODULE, since
due to the simplification of mercury_goto.h, they are not used anymore.
runtime/mercury_stack_layout.h:
Remove the old macros for creating layout structures with bogus
contents, and replace them with new macros for creating layout
structures with meaningful contents.
runtime/mercury_engine.c:
runtime/mercury_wrapper.c:
Remove bogus layout structures. Ensure the labels defined here
always get into the label table.
runtime/mercury_ho_call.c:
Remove bogus layout structures. Add proper ones where necessary.
runtime/mercury_bootstrap.c:
runtime/mercury_type_info.c:
Remove bogus layout structures.
runtime/mercury_boostrap.h:
Add this new file for bootstrapping purposes.
Temporarily #define NONDET_FIXED_SIZE as MR_NONDET_FIXED_SIZE, since
pragma_c_gen.m refers to the former until the update to it gets
installed.
runtime/Mmakefile:
Add a reference to mercury_boostrap.h.
library/builtin.m:
Remove bogus layout structures.
library/array.m:
library/benchmarking.m:
library/private_builtin.m:
Remove bogus layout structures. Add proper ones.
library/std_util.m:
Remove bogus layout structures. Add proper ones.
Replace references to framevar(n) with references to MR_framevar(n+1).
Fix an old bug in code under #ifndef COMPACT_ARGS: in the
implementation of mercury____Compare___std_util__univ_0_0_i1, the
succip register was not being saved across the call to
mercury__compare_3_0.
library/string.m:
Remove the need for bogus layout structures, by converting the
implementation of string__append(out, out, in) from hand-written
C module into nondet pragma C code.
|
||
|
|
2fd0c764d2 |
Changes to compile the compiler using compilers other then gcc.
Estimated hours taken: 30
Changes to compile the compiler using compilers other then gcc. Tested
on 'cc -std1', 'cc -std1 -migrate' on the alphas, 'cc' and 'lcc' on the
sparcs.
boehm_gc/linux_threads.c:
Ensure that the compilation unit isn't empty by always #including at
least on file.
compiler/llds_out.m:
Remove all remaining occurences of (const Word *).
compiler/mercury_compile.m:
Call transform_llds.
compiler/options.m:
Add the option max_jump_table_size. This option is needed because
lcc barfs when the jump_table for computed gotos size is over 128.
compiler/transform_llds.m:
Transform computed_gotos whose table size is over
max_jump_table_size to binary search down to computed gotos whose
table size is less then or equal to max_jump_table_size.
doc/user_guide.texi:
Document --max-jump-table-size.
library/benchmarking.m:
library/math.m:
library/private_builtin.m:
library/std_util.m:
s/\\n/\\\\n/g so that we don't get line breaks in string constants.
library/io.m:
Change an LVALUE_CAST to type Word as RHS of the expression gets
cast to type Word.
scripts/mgnuc.in:
lcc gets called with "-w" flag to avoid spurious warnings. Also if
--no-ansi is defined pass "-D__EXTENSIONS__" to the compiler to
ensure that all of the header files are read.
trace/mercury_trace_internal.c:
Add a cast to (Word *) because LHS of the expression has type (Word *)
|
||
|
|
d3e3b716f3 |
Fix a trivial bug: the previous change commented out --use-trail
Estimated hours taken: 0.1 compiler/options: Fix a trivial bug: the previous change commented out --use-trail instead of --stack-trace. |
||
|
|
8a0ceb49aa |
This checkin has several major purposes, set out in the sections below,
Estimated hours taken: 240
This checkin has several major purposes, set out in the sections below,
all connected with the implementation of the new debugger command set.
DOCUMENT NEW DEBUG COMMAND SET
doc/user_guide.texi:
Add a new section on the debugger. The description of the commands
is complete, but some of the background sections, and the section
about how to build debuggable executables, are not yet done.
Update the documentation of the tracing options.
doc/generate_mdb_doc:
A new shell script that automatically converts some of the new
sections of the user guide into the online documentation of the
debugger.
doc/mdb_categories:
The fixed initial part of the online documentation.
doc/Mmakefile:
Add rules for creating mdb_doc, the file that is the online
documentation of the debugger, and for installing it together
with mdbrc.
Mmake.common.in:
Define INSTALL_DOC_DIR for doc/Mmakefile.
scripts/mdbrc.in:
A debugger command script that reads in the online documentation
and then defines some standard aliases.
configure.in:
Define the variable that scripts/mdb.in and scripts/mdbrc.in use
to find the right files, and get configure to perform the
substitutions.
configure.in:
scripts/mdb:
scripts/mdb.in:
Replace mdb with mdb.in. Mdb is now created during configuration
from mdb.in, filling in the name of the file that contains the default
debugger initialization commands.
util/info_to_mdb.c:
A program that does most of the work involved in automatically
converting user guide sections into online documentation.
(This couldn't easily be written in sh, because sh's read
command has no notion of pushback.)
util/Mmakefile:
Add info_to_mdb to the list of targets.
tools/bootcheck:
Make sure that the tests in tests/debugger are executed with an
initialization setup that is equivalent to what users will see
by default.
REORGANIZE TRACING OPTIONS
compiler/globals.m:
compiler/handle_options.m:
compiler/options.m:
compiler/trace.m:
Reorganize the handling of trace levels around the new options
--trace-internal, --trace-redo, and --trace-return.
compiler/*.m:
Use the new ways of getting at trace levels.
tests/hard_coded/typeclasses/Mmakefile:
s/--trace all/--trace deep/
SUPPORT RETRY
compiler/trace.m:
After every call to MR_trace(), emit code that checks whether it
should jump away, and if yes, performs the jump. This is used to
implement retry. (The debugger cannot execute the jump itself
because it is in the wrong C stack frame.)
compiler/llds.m:
compiler/continuation_info.m:
compiler/stack_layout.m:
Modify the data structures that record information about live
value at program points, to record the identity of each variable.
This is necessary for the implementation of the restart command,
since we do not want to confuse two distinct variables just because
they have the same name. For example, a variable whose name is X
and number is 5 is now recorded in the name array as "5:X".
Clean up the data structure a bit, so that we don't have to store
dummy names for values that are not variables.
compiler/*.m:
Minor changes to conform to the data structure changes.
runtime/mercury_stack_layout.h:
Redefine an existing macro to strip away the initial number: prefix
from the "name" of a variable (keeping its original function on
changed data), and add a new one to access the raw unstripped data.
runtime/mercury_init.h:
runtime/mercury_wrapper.h:
Update the prototype of MR_trace_{fake,real}, and the type of the
global that points to them.
runtime/mercury_layout_util.h:
Add an extra function, MR_get_register_number, for use by retry.
USE FIXED STACK SLOTS FOR TRACE INFO
compiler/code_gen.m:
compiler/code_info.m:
compiler/live_vars.m:
compiler/trace.m:
If execution tracing is enabled, reserve the first few stack slots
to hold the event number of the call event, the call number, the
call depth, the redo layout structure address (if generating redo
events) and the from_full flag at the time of call (if we are doing
shallow tracing). By allocating the first four of these to fixed stack
slots, the debugger knows where to look for them without having
to be told. It finds out the location of the fifth, if needed,
from a new slot in the proc layout structure. (It is not possible
to allocate all five to fixed stack slots without wasting stack space
in some cases.)
compiler/trace.m:
Remove from the call to MR_trace the parameters that are now in fixed
stack slots, since MR_trace can now look them up itself.
compiler/continuation_info.m:
compiler/stack_layout.m:
Add an extra field to the proc_layout_info. If the module is shallow
traced, this field says which stack slot holds the saved value of
MR_from_full. If it is not shallow traced, this field says that
there is no such stack slot.
runtime/mercury_stack_layout.h:
Add macros for accessing the fixed stack slots holding the event
number of the call event, the call number, the call depth, and,
at a redo event, the redo layout structure address.
Support the new field in proc layouts that gives the location of the
from-full flag (if any).
runtime/mercury_trace_base.[ch]:
trace/mercury_trace.[ch]:
Remove the call number and call depth arguments from MR_trace
and its avatars, since this info is now in fixed stack slots
in every procedure that can call MR_trace. This should reduce
the size of the executable significantly, since there are lots
of calls to MR_trace.
runtime/mercury_init.h:
runtime/mercury_wrapper.h:
Update the prototype of MR_trace_{fake,real}, and the type of the
global that points to them.
START NUMBERING FRAMEVARS FROM ONE
compiler/code_info.m:
compiler/live_vars.m:
compiler/llds_out.m:
compiler/trace.m:
Start numbering framevars from 1 internally to the compiler;
the runtime already starts from 1. This simplifies several tasks.
ADD REDO EVENTS
compiler/trace.m:
compiler/code_gen.m:
Before the code that executes "succeed()", emit code to push a
a temp nondet frame whose redoip points to a label in the runtime
that calls MR_trace for a REDO event and then fails, provided
--trace-redo is set.
compiler/llds.m:
Add a new code address constant, do_trace_redo_fail, which stands
for the address in the trace system to which calls MR_trace for
the redo event and then fails.
compiler/trace.m:
compiler/llds_out.m:
Provided we are doing redo tracing, fill in the slot that holds
the layout information for the REDO event.
compiler/*.m:
Minor changes to conform to handle the new code address constant.
browser/debugger_interface.m:
Add redo to trace_port_type.
runtime/mercury_trace_base.[ch]:
Add a C module containing the code that calls MR_trace for REDO
events.
ENSURE THAT INPUT ARGUMENTS ARE ALWAYS VISIBLE
compiler/trace.m:
When generating the set of live variables at internal ports,
the variables that are in the pre-death set of the goal into which
we are entering may not be available. However, the variables in the
pre-death set that are also in the resume vars set will be available,
so now include info about them in the layout structure for the event.
Since with tracing the non-clobbered input args are in all resume vars
sets, this ensures that these input args will be available from all
internal events.
compiler/code_info.m:
Export a previously internal predicate (current_resume_point_vars)
to make this possible.
BUG FIX: WANT RETURN LAYOUTS
compiler/globals.m:
compiler/call_gen.m:
compiler/code_info.m:
compiler/mercury_compile.m:
Add a new pred globals__want_return_layouts, which says whether the
compiler should generate layout structures for call returns. This pred
centralizes the several previous copies of the test. One of those
copies (the one in call_gen) was faulty, leading to a bug: in the
presence of execution tracing but the absence of accurate gc,
information about the variables that are live at the call return
wasn't being gathered properly.
BUG FIX: #include mercury_trace_base.h
compiler/llds_out.m:
#include mercury_trace_base.h, not mercury_trace.h, since now
mercury_trace_base.h defines everything directly accessible from
modules compiled with tracing.
RECAST MERCURY_TRACE_UTIL AS MERCURY_LAYOUT_UTIL
runtime/mercury_trace_util.[ch]:
runtime/mercury_layout_util.[ch]:
Rename this module from trace_util to layout_util, since it is also
used by the native garbage collector. Remove "trace" from the names
of functions.
Get rid of the global variable MR_saved_regs, and instead thread
a pointer to this data structure through the relevant functions
as an extra argument.
Add a lot more documentation in the header file.
runtime/Mmakefile:
Reflect the module rename.
runtime/*.c:
Refer to the new module.
DELETE EASY-TO-MISUSE MACROS
runtime/mercury_stacks.h:
Delete the based_framevar and based_detstackvar macros, since their
continued use can lead to off-by-one errors, and the saved_framevar
and saved_detstackvar macros, since they are no longer used.
runtime/*.c
Update any references to any macros removed from mercury_stacks.h.
MISC RUNTIME CHANGES
runtime/mercury_trace_base.[ch]:
trace/mercury_trace*.[ch]:
Make typedef'd names conform to the naming convention.
Make MR_trace_call_{seqno,depth} consistently Unsigned, rather than
sometimes Word and sometimes Unsigned.
FIX BUG: MAKE THE DEBUGGER PRINT TO STDOUT, NOT THE CURRENT STREAM
library/io.m:
Export to C code the predicates that return the identities and types
of stdin, stdout and stderr, as well as io__print/[34].
library/std_util.m:
Export to C code a predicate that returns the type_info for the
type stdutil:type_info. This type_info is required if C code
wants to invoke make_permanent on any type_info structure,
as the debugger does.
runtime/mercury_init.h:
Add extern declarations for the C functions now exported from io.m.
runtime/mercury_wrapper.[ch]:
Add new global variables to hold the addresses of these C functions.
runtime/mercury_layout_util.c:
Use indirect calls through these global variables to print Mercury
values, instead of lower-level code.
util/mkinit.c:
Assign the addresses of the functions exported from io.m to the
global variables defined in mercury_wrapper.h.
BUG FIX: STACK TRACE FUNCTIONS DEPEND ON THE LABEL TABLE
runtime/mercury_stack_trace.c:
On entry to any of the functions exported from this module,
ensure that the label table is loaded by calling do_init_modules.
Without a filled-in label table, the stack trace will not be able to
find any stack layout info.
BUG FIX: REMOVE BROWSER/*.C
configure.in:
When removing .c files generated by the C compiler, remove those
in the browser directory as well as the compiler, library and
profiler directories.
IMPLEMENT NEW DEBUGGER COMMAND SET
runtime/mercury_stack_trace.[ch]:
Factor out the code that prints the id of a procedure into a function
of its own, so that it can also be used from the debugger, ensuring
appearance commonality.
Add more documentation in the header file.
trace/mercury_trace_internal.c:
Implement the proposed command set. Command names are now words,
and several commands now have options allowing the user to override
the default print level or strictness of the command, or the
invocation conditions or action of a break point. Allows control
over command echoing and the scrolling of sequences of event reports.
Supports aliases, command file sourcing etc. Implements the retry
command, using the info in the fixed stack slots.
trace/mercury_trace.[ch]:
Extend the trace controls to support the new functionalities
required by the new debugger language, which are print levels,
variable-strictness commands, a more flexible finish command,
and the retry command.
Pass the command structure to MR_trace_event_report, since
the user can now forcibly terminate the scrolling of reports.
trace/mercury_trace_alias.[ch]:
New module to manage aliases for the debugger.
trace/mercury_trace_help.[ch]:
New module to interface to browser/help.m.
trace/mercury_trace_spy.[ch]:
New module to manage break points. The test of whether an event
matches a break point is now much more efficient than before.
The new module also allows several breakpoints with different
actions and different invocation conditions (e.g. all ports,
entry port, interface ports or specific (possibly internal) port)
to be defined on the same procedure.
trace/mercury_trace_tables.[ch]:
New module to manage a table of the debuggable modules, in which
each such module is linked to the list of the layouts of all the
procedures defined in that module. This information allows the
debugger to turn the name of a predicate/function (possibly together
with its arity and mode number) into the procedure layout structure
required by the spy point module. Eventually it may also be useful
in supplying lists of identifiers for command line completion.
Modules for which no stack layout information is available will
not be included in the table, since do_init_modules will not
register any labels for them in the label table.
trace/Mmakefile:
Mention the new files.
runtime/mercury_array_macros.h:
A new file holding macros that can be useful in more than one module.
runtime/Mmakefile:
Mention the new file.
runtime/mercury_conf.h.in:
Mention a new configuration macro, MR_CANNOT_USE_STRUCTURE_ASSIGNMENT,
used by runtime/mercury_array_macros.h.
configure.in:
Find out whether we need to define MR_CANNOT_USE_STRUCTURE_ASSIGNMENT.
ADD TRACE DEPTH HISTOGRAMS
runtime/mercury_conf_param.h:
Document MR_TRACE_HISTOGRAM.
runtime/mercury_trace_base.[ch]:
Define the data structures for the histogram, and print the histogram
when a traced program exits if MR_TRACE_HISTOGRAM is set.
trace/mercury_trace.[ch]:
If MR_TRACE_HISTOGRAM is defined, record a count of the number of
events at each depth. This information can help us evaluate space-time
tradeoffs.
FACTOR OUT SHELL CODE HANDLING GRADE IMPLICATIONS
scripts/final_grade_options.sh-subr:
A new file to contain any code that implements implications between
grade flags; currently implements the implication debug -> use trail.
scripts/mgnuc.in:
scripts/ml.in:
Replace the code that is now in final_grade_options.sh-subr with
an inclusion of final_grade_options.sh-subr.
configure.in:
Handle final_grade_options.sh-subr as {init,parse}_grade_options.sh-subr
are handled.
SIMPLIFY THE MAINTAINANCE OF CONSISTENCY BETWEEN DEBUGGER CODE AND DOCUMENTATION
doc/Mmakefile:
Add rules for creating mdb_command_list, a C code fragment
that can included manually in trace/mercury_trace_internal.c
to supply the list of valid commands, and mdb_command_test.inp,
which is a list of invalid invocations of debugger commands,
which tests whether the help message for such invocations
can be located as expected.
doc/generate_mdb_command_list:
doc/generate_mdb_command_test:
Awk scripts to create mdb_command_list and mdb_command_test.inp
respectively from mdb_doc.
tools/bootcheck:
Copy mdb_command_test.inp from doc to tests/debugger.
tests/debugger/Mmakefile:
Add a new test that checks whether we get an internal error, unable
to locate the right help node, for each invalid command invocation in
mdb_command_test.inp.
UPDATE TEST CASES
tests/debugger/Mmakefile:
Reenable queens. Conform to the new set of options.
tests/debugger/*.inp:
tests/debugger/*.exp:
Update the inputs and expected outputs of the debugger test cases
to use the new command set and output formats.
|
||
|
|
e7e6b2ade1 |
Undo changes which Vanessa accidentally committed on the main branch.
Estimated hours taken: 1 Undo changes which Vanessa accidentally committed on the main branch. |
||
|
|
a10f99da9b |
Start of the termination2 branch.
Estimated hours taken: 200 Start of the termination2 branch. |
||
|
|
b18199bedb |
Make HLDS dumps easier to use.
Estimated hours taken: 3 compiler/hlds_out.m: If dump_hlds_options includes I, print even imported predicates. This is useful for e.g. debugging termination analysis, where you must have access to the termination info of all procedures, not just those defined in the current module. compiler/options.m: Rename the option verbose_hlds_dump to dump_hlds_options. Add a new option hlds_dump_alias, and make -D refer to the latter. compiler/handle_options.m: If hlds_dump_alias is set, use its string value as an alias, a meaningful shorthand for an otherwise meaningless bunch of hlds option letters. The initial set of aliases is "ALL", meaning all option letters; "all", meaning all option letters except I and U (which cause imported and unify procedures to be printed), and two others. You can add your own. compiler/intermod.m: compiler/mercury_to_c.m: Use the new name of the renamed option. doc/user_guide.texi: Update the documentation to conform to the changes to options.m and hlds_out.m, and fix some documentation rot. |
||
|
|
5fcce212a3 |
Fixed a miss-spelled option in the long_option table.
Estimated hours taken: 0.1 compiler/options.m Fixed a miss-spelled option in the long_option table. |
||
|
|
3e244090d7 |
Rework the handling of types in higher_order.m.
Estimated hours taken: 50 Rework the handling of types in higher_order.m. - Fix bugs in higher_order.m that stopped it working with --typeinfo-liveness. - Perform type and typeclass specialisation. compiler/polymorphism.m: Previously the type of typeclass_infos variables did not contain any information about the constraint about which the variable contains information. Now the type of a typeclass_info is `private_builtin:typeclass_info( private_builtin:constraint([ClassName, ConstrainedTypes]))'. This allows predicates such as type_list_subsumes to check that the class constraints match. Note that `private_builtin:constraint' has no declaration, so a lookup in the type definition map will fail. That's OK, because type_to_type_id will fail on it, so it will be treated as a type variable by any code which doesn't manipulate types directly. Added polymorphism__typeclass_info_class_constraint to get the class_constraint from a typeclass_info's type. This isn't used yet. Also, fix a bug in extract_type_info: an entry in the typeinfo_var_map was being overwritten using an entry from a dummy typevarset. Actually the optimization to overwrite the location of the type_info after extracting it from a typeclass_info was wrong because the type_info won't be in that location in other branches. compiler/higher_order.m: Rework the handling of type substitutions. Now the types of the called procedure are `inlined' into the calling procedure, rather than building up the types of the specialised version using the higher-order arguments. The advantage of this is that the code is a bit simpler and handles extra type_infos properly. The disadvantage is that the argument types for specialised versions may be more specific than they need to be, so in some cases more specialised versions will be created than before. Also, don't actually rebuild the higher-order terms in the specialised versions - just pass the terms through in case they are needed. Handle the extra typeinfos required for --typeinfo-liveness. Specialize calls to unify/2, index/2 and compare/3. Specialize class_method_calls. Specialize calls to the predicates in private_builtin.m which manipulate typeclass_infos. compiler/type_util.m: type_to_type_id now fails on the dummy `constraint' type. Remove typeinfos for non-variable types from the typeinfo_varmap after inlining and higher-order specialisation. compiler/inlining.m: Factor out some common code to handle type substitutions for use by higher_order.m. compiler/hlds_pred.m: Return the list of extra type_info variables added to the argument list. compiler/goal_util.m: Take a set of non-locals as an argument to goal_util__extra_nonlocal_typeinfos rather than extracting them from a goal. compiler/special_pred.m: Handle unmangled unify/compare/index in special_pred_get_type. compiler/base_type_layout.m: Don't generate references to the typeinfo for `private_builtin:constraint' - it doesn't exist. compiler/unused_args.m: Don't barf on specialised unification predicate names. compiler/options.m: Added options: `--type-specialization' (default off). `--higher-order-size-limit' - restrict the size of specialized versions produced by higher_order.m. `--disable-opt-for-trace' (default on) - where possible don't change the options to make the trace match the source code. compiler/handle_options.m: Don't disable higher_order.m when --typeinfo-liveness is set. Handle `--disable-opt-for-trace'. compiler/hlds_data.m: compiler/*.m: Add the instance number to `base_typeclass_info_const' cons_ids, so that higher_order.m can easily index into the list of instances for a class to find the methods. compiler/hlds_out.m: Use the correct varset when printing out the constraint proofs. Write the typeclass_info_varmap for each procedure. compiler/mercury_to_mercury.m: Print type variables with variable numbers. library/private_builtin.m: Add the argument to the typeclass_info type to hold the representation of the constraint. runtime/mercury_ho_call.c: Semidet and nondet class_method_calls where (0 < num_arg_typeclass_infos < 4) were aborting at runtime because arguments were being placed starting at r1 rather than at r(1 + num_arg_typeclass_infos). doc/user_guide.texi Document the new options. compiler/notes/compiler_design.html: Update the role of higher_order.m. tests/hard_coded/typeclasses/extra_typeinfo.m: Test case for the mercury_ho_call.c bug and the polymorphism.m extract_typeinfo bug and for updating the typeclass_info_varmap for specialised versions. |
||
|
|
960b1dc2a6 |
Disable deforestation due to a bug which has something to do with
Estimated hours taken: 0.1 compiler/options.m: Disable deforestation due to a bug which has something to do with quantification and mode information not being kept consistent. |
||
|
|
b295a275ee |
The text for the help messages in the compiler was harder than necessary
Estimated hours taken: 0.5 The text for the help messages in the compiler was harder than necessary to maintain, and certainly lead to larger code than necessary, so this change addresses that. compiler/options.m: replace the looonnnggg conjunctions of calls to io__write_string for writing the help text with single calls to write_tabbed_lines which takes a list of lines which it writes - each with a preceeding tab and a following newline. The diff is very boring, but I used diff to make sure that the output is exactly the same as before (modulo the version string at the start). |
||
|
|
b1aa225ce3 |
This change makes the parsing of GRADE/--grade strings more flexible.
Estimated hours taken: 4 This change makes the parsing of GRADE/--grade strings more flexible. The GRADE string can now have its components given in any order. The only places that depend on the order are those that use the grade as part of a pathname: ml and install_grades. There is also a new option to the compiler `--output-grade-string' which prints the grade string for the set of options given to mmc/mmake. NEWS: mention the changes. compiler/handle_options.m: Reimplement convert_grade_option to accept a grade string with its components in any order. The conversion is now table-driven, which should make it easier to add new dimensions to the grade and new values to existing ones. Reimplement compute_grade to use the same table as convert_grade_option. compiler/mercury_compile.m: If --output-grade-string option was given, just compute the grade string and print it. compiler/options.m: Add the --output-grade-string option. library/list.m: Add an extra mode to list__foldl2 (gee, it would be nice to be able to make higher order predicates polymorphic in their determinism). scripts/ml.in: Include .par in the grade string. (bugfix) scripts/parse_grade_options.sh-subr: split the grade string into . separated pieces and process them in a loop, setting the appropriate options. doc/user_guide.texi: Add documentation on --output-grade-string. Change the description of how grades are handled to match the implementation. Add a some missing bits. |
||
|
|
d1855187e5 |
Implement new methods of handling failures and the end points of branched
Estimated hours taken: 260
Implement new methods of handling failures and the end points of branched
control structures.
compiler/notes/failure.html:
Fix an omission about the handling of resume_is_known in if-then-elses.
(This omission lead to a bug in the implementation.)
Optimize cuts across multi goals when curfr is known to be equal
to maxfr.
Clarify the wording in several places.
compiler/code_info.m:
Completely rewrite the methods for handling failure.
Separate the fields of code_info into three classes: those which
do not change after initialization, those which record state that
depends on where in the HLDS goal we are, and those which contain
persistent data such as label and cell counters.
Rename grab_code_info and slap_code_info as remember_position
and reset_to_position, and add a wrapper around the remembered
code_info to make it harder to make mistakes in its use.
(Only the location-dependent fields of the remembered code_info
are used, but putting only them into a separate data structure would
result in more, not less, memory being allocated.)
Gather the predicates that deal with handling branched control
structures into a submodule.
Reorder the declarations and definitions of access predicates
to conform to the new order of fields.
Reorder the declarations and definitions of the failure handling
submodule to better reflect the separation of higher-level and
lower-level predicates.
compiler/code_gen.m:
Replace code_gen__generate_{det,semi,non}_goal_2 with a single
predicate, since for most HLDS constructs the code here is the same
anyway (the called preds check the code model when needed).
Move classification of the various kinds of unifications to unify_gen,
since that is where it belongs.
Move responsibility for initializing the code generator's trace
info to code_info.
Move the generation of code for negations to ite_gen, since the
handling of negations is a cut-down version of the handling of
negations. This should make the required double maintenance easier,
and more likely to happen.
compiler/disj_gen.m:
compiler/ite_gen.m:
These are the two modules that handle most failures; they have
undergone a significant rewrite. As part of this rewrite, factor
out the remaining common code between model_non and model_{det,semi}
goals.
compiler/unify_gen.m:
Move classification of the various kinds of unifications here from
code_gen. This allows us to keep several previously exported
predicates private.
compiler/call_gen.m:
Factor out some code that was common to ordinary calls, higher order
calls and method calls. Move the common code that checks whether
we are doing tracing to trace.m.
Replace call_gen__generate_{det,semi,nondet}_builtin with a single
predicate.
Delete the commented out call_gen__generate_complicated_unify,
since it will never be needed and in any case suffered from
significant code rot.
compiler/llds.m:
Change the mkframe instruction so that depending on one of its
arguments, it can create either ordinary frames, or the cut-down
frames used by the new failure handling algorithm (they have only
three fixed fields: prevfr, redoip and redofr).
compiler/llds_out.m:
Emit a #define MR_USE_REDOFR before including mercury_imp.h, to
tell the runtime we are using the new failure handling scheme.
This effectively changes the grade of the compiled module.
Emit MR_stackvar and MR_framevar instead of detstackvar and framevar.
This is a step towards cleaning up the name-space, and a step towards
making both start numbering at 0. For the time being, the compiler
internally still starts counting framevars at 0; the code in llds_out.m
adds a +1 offset.
compiler/trace.m:
Change the way trace info is initialized to fit in with the new
requirements of code_info.m.
Move the "are we tracing" check from the callers to the implementation
of trace__prepare_for_call.
compiler/*.m:
Minor changes in accordance with the major ones above.
compiler/options.m:
Introduce a new option, allow_hijacks, which is set to "yes" by
default. It is not used yet, but the idea is that when it is set to no,
the code generator will not generate code that hijacks the nondet
stack frame of another procedure invocation; instead, it will create
a new temporary nondet stack frame. If the current procedure is
model_non, it will have three fields: prevfr, redoip and redofr.
If the current procedure is model_det or model_semi, it will have
a fourth field that is set to the value of MR_sp. The idea is that
the runtime system, which will be able to distinguish between
ordinary frames (whose size is at least 5 words), 3-word and 4-word
temporary frames, will now be able to use the redofr slots of
all three kinds of frames and the fourth slot values of 4-word
temporary frames as the addresses relative to which framevars
and detstackvars respectively ought to be offset in stack layouts.
compiler/handle_options.m:
Turn off allow_hijacks if the gc method is accurate.
runtime/mercury_stacks.h:
Change the definitions for the nondet stack handling macros
to accommodate the new nondet stack handling discipline.
Define a new macro for creating temp nondet frames.
Define MR_based_stackvar and MR_based_framevar (both of which start
numbering slots at 1), and express other references, including
MR_stackvar and MR_framevar and backward compatible definitions of
detstackvar and framevar for hand-written C code, in terms of those
two.
runtime/mercury_stack_trace.[ch]:
Add a new function to print a dump of the fixed elements nondet stack,
for debugging my changes. (The dump does not include variable values.)
runtime/mercury_trace_internal.c:
Add a new undocumented command "D" for dumping the nondet stack
(users should not know about this command, since the output is
intelligible only to implementors).
Add a new command "toggle_echo" that can cause the debugger to echo
all commands. When the input to the debugger is redirected, this
echo causes the output of the session to be much more readable.
runtime/mercury_wrapper.c:
Save the address of the artificial bottom nondet stack frame,
so that the new function in mercury_stack_trace.c can find out
where to stop.
runtime/mercury_engine.c:
runtime/mercury_wrapper.c:
Put MR_STACK_TRACE_THIS_MODULE at the tops of these modules, so that
the labels they define (e.g. do_fail and global_success) are registered
in the label table when their module initialization functions are
called. This is necessary for a meaningful nondet stack dump.
runtime/mercury_grade.h:
Add a new component to the grade string that specifies whether
the code was compiled with the old or the new method of handling
the nondet stack. This is important, because modules compiled
with different nondet stack handling disciplines are not compatible.
This component depends on whether MR_USE_REDOFR is defined or not.
runtime/mercury_imp.h:
If MR_DISABLE_REDOFR is defined, undefine off MR_USE_REDOFR before
including mercury_grade.h. This is to allow people to continue
working on un-updated workspaces after this change is installed;
they should put "EXTRA_CFLAGS = -DMR_DISABLE_REDOFR" into
Mmake.stage.params. (This way their stage1 will use the new method
of handling failure, while their stage2 2&3 will use the old one.)
This change should be undone once all our workspaces have switched
over to the new failure handling method.
tests/hard_coded/cut_test.{m,exp}:
A new test case to tickle the various ways of handling cuts in the
new code generator.
tests/hard_coded/Mmakefile:
Enable the new test case.
|
||
|
|
803d85e1cb |
Various changes to make the `--debug' option work.
Estimated hours taken: 2 Various changes to make the `--debug' option work. compiler/options.m: Fix an omission in a previous change of mine: add a special_handler for the `--debug' option. compiler/handle_options.m: scripts/mgnuc.in: scripts/ml.in: Make the .debug grade imply --use-trail. The reason for this is to avoid unnecessary proliferation in the number of different grades. If you're using .debug, you've already taken a major performance hit, so you should be able to afford the performance hit caused by --use-trail. configure.in: Include a `.tr.debug' grade in LIBGRADES, which holds the set of library grades that get installed. scripts/mdb: NEWS: Update some obsolete documentation referring to the old `--generate-trace' option. NEWS: Update some more obsolete documentation listing the commands supported by the debugger and describing how to build programs with debugging enabled. |
||
|
|
b3b1de1172 |
Add an option --use-opt-files, which causes the compiler
Estimated hours taken: 2.5 Add an option --use-opt-files, which causes the compiler to use any `.opt' files which are available when the dependencies are made, but not make any more `.opt' files. This is useful for using just the `.opt' files for the library without building them for the compiler. compiler/modules.m: When searching for available `.opt' files, don't look for `.m' files which could be used to build the `.opt' files if --use-opt-files is set. compiler/handle_options.m: compiler/options.m: doc/user_guide.texi: Handle and document --use-opt-files. |
||
|
|
f781be28ba |
Disable duplicate call optimization, because it is buggy.
Estimated hours taken: 0.5 compiler/options.m: Disable duplicate call optimization, because it is buggy. (Also add a comment about options for internal use only.) tests/hard_coded/Mmakefile: tests/hard_coded/dupcall_types_bug.m: tests/hard_coded/dupcall_types_bug.exp: Add a regression test for the bug in duplicate call optimization. |
||
|
|
a70b59e83c |
Add a test to find the number of words needed to represent a
configure.in:
Add a test to find the number of words needed to represent a
synchronization term.
boehm_gc/gc.h:
fix a declaration by replacing the args () with (void).
boehm_gc/solaris_pthreads.c:
add a missing include
check the return values of pthread calls.
compiler/*.m:
Add handling for the new HLDS goal type par_conj.
Add handling for the four new LLDS instructions:
init_sync_term
fork
join_and_terminate
join_and_continue
compiler/code_info.m:
add a new alternative for slot_contents - sync_term.
compiler/handle_options.m:
add .par as part of the grade
compiler/hlds_goal.m:
add the new goal type par_conj.
compiler/instmap.m:
add instmap__unify which takes a list of instmaps
and abstractly unifies them.
add unify_instmap_delta which tajes two instmap deltas
and abstractly unifies them.
compiler/llds.m:
add the new llds instructions.
compiler/mode_info.m:
add par_conj as a lock reason.
library/Makefile:
work around a bug in the solaris version pthread.h
library/benchmarking.m:
reference the stack zones from the engine structure
rather than from global variables.
library/{nc,sp}_builtin.nl:
add an op declaration for &.
library/std_util.m:
change references to global variables to references inside
the engine structure.
runtime/Mmakefile:
add mercury_thread.{c,h}
add THREADLIBS to the libraries
runtime/*.{c,h}
Remove some old junk from the previous processes/shrd-mem
changes that found their way into the repository.
Add MR_ prefixes to lots of names.
runtime/mercury_context.c:
Add init_thread_stuff for creating and initializing a
context structure for the current thread.
runtime/mercury_context.h:
add a field to the mercury context which stores the thread id
of the thread where this context originated.
add various macros for implementing the new llds instructions.
runtime/mercury_engine.c:
initialize the engine structure, rather than a bunch of globals.
runtime/mercury_engine.h:
declare the mercury_engine structure.
runtime/mercury_regorder.h:
if MR_THREAD_SAFE, and there is at least one global register
then use mr0 as a pointer to the mercury engine structure.
scripts/init_grade_options.sh-subr
add thread_safe
scripts/mgnuc.in
add THREAD_OPTS
scripts/ml.in:
add THREAD_LIBS
|
||
|
|
98c2fbf51b |
Bug fixes.
Estimated hours taken: 12
Bug fixes.
tests/term/arit_exp.m still fails with --intermodule-optimization
due to a slightly different (but correct) trans_opt file being produced.
compiler/simplify.m
Don't produce singleton disjunctions, since the code generator
barfs on them. Use a `some' instead.
Test case: tests/general/partition.m compiled with --deforestation.
compiler/unused_args.m
Deconstructions where the arguments included `any' insts were
not being handled correctly, due to inst_matches_binding
failing for any->any.
Test case: extras/trailed_update/samples/vqueens.m at -O3.
Don't warn about predicates from `.opt' files having unused
arguments, because in most cases the warning will be generated
when compiling the imported module.
compiler/higher_order.m
Fix a bug that caused compiler/modules.m to be miscompiled at
-O3 --intermodule-optimization, due to curried arguments for
multiple known higher-order arguments being passed to a
specialised version in the wrong order.
Test case: tests/hard_coded/ho_order2.m
compiler/mercury_compile.m
Call intermod__update_pred_import_status when compiling to
C at the same stage of the compilation as the `.opt' file
was written to ensure that the same information is being used.
Test case: tests/hard_coded/rational_test.m compiled with
--intermodule-optimization failed because of a link error.
Make sure polymorphism has been run before doing unused argument
checking with --errorcheck-only. Otherwise the argument indices
read in from `.opt' files are incorrect.
compiler/intermod.m
Use code_util__compiler_generated to test if a called predicate
is compiler generated, rather than looking for a call_unify_context
(function calls have a call_unify_context).
Add a progress message for updating the import status of predicates
exported to `.opt' files.
Fix a bug where the unused_args pragmas read in from the current
module's `.opt' file were given an import_status of `imported' rather
than `opt_imported' resulting in an error message from make_hlds.m.
compiler/dead_proc_elim.m
Ensure that predicates used by instance declarations and
`:- pragma export's are not eliminated by the dead_pred_elim
pass before typechecking.
Test case: most of the typeclass tests compiled with
--intermodule-optimization.
compiler/hlds_goal.m
Remove obsolete comments about the modes of a higher-order
unification being incorrect after polymorphism, since that
was fixed months ago.
compiler/options.m
Reenable deforestation.
Enable --intermodule-optimization and --intermod-unused-args
at -O5 so they get tested occasionally.
compiler/handle_options.m
Disable deforestation if --typeinfo-liveness is set, since
there are bugs in the folding code if extra typeinfos are
added to a new predicate's arguments by hlds_pred__define_new_pred.
Disable higher_order.m if --typeinfo-liveness is set, since
higher_order.m currently does not pass all necessary typeinfos
to specialised versions or update the typeinfo_varmap of
specialised versions.
Test case: tests/valid/agc_ho_pred.m
tests/hard_coded/ho_order2.m
tests/hard_coded/ho_order2.exp
Test case for higher_order.m.
tools/test_mercury
Added --intermod-unused-args to the options for murlibobo.
extras/trailed_update/{samples,tests}/Mmakefile
Add "-I.." to MGNUCFLAGS so gcc can find unsafe.h which
is #included in c_header_code read from unsafe.opt.
|
||
|
|
6921e0e015 |
Add a `--debug' option for Mercury-level debugging
Estimated hours taken: 6 Add a `--debug' option for Mercury-level debugging using the trace-based debugger. scripts/init_grade_options.sh-subr: scripts/parse_grade_options.sh-subr: scripts/mgnuc.in: scripts/ml.in: compiler/options.m: compiler/handle_options.m: compiler/mercury_compile.m: Split the old `--debug' option into `--low-level-debug' (formerly the absence of -DSPEED, now handle by -DLOWLEVEL_DEBUG) and `--c-debug' (passes -g to C compiler). Delete the old `debug' grade. Add support for new options `--require-tracing' (makes --trace minimum equivalent to --trace interfaces, and passes -DMR_REQUIRE_TRACING to C compiler) `--stack-trace' (passes -DMR_STACK_TRACE to C compiler; actually this one was already supported) and `--debug' (implies previous two), with corresponding grade modifiers `.trace', `.strce', and `.debug'. Actually I think there's little point in specifying just one of `--require-tracing' and `--stack-trace' so for the moment I'm just providing `--debug': the code for the more fine-grained options and grade modifiers has been added but commented out. runtime/mercury_conf_param.h: Document the new configuration parameter MR_REQUIRE_TRACING and the existing but undocumented parameter MR_STACK_TRACE. runtime/mercury_grade.h: Include MR_REQUIRE_TRACING in the mangled grade identifier. compiler/globals.m: compiler/handle_options.m: compiler/options.m: Allow new tracing type `--trace default', and make it the default. This gets replaced with `full' if require_tracing is yes or `minimal' if require_tracing is no. Also `--trace minimum' gets replaced with `interface' if require_tracing is yes. doc/user_guide.texi: Document the new `--debug', `--low-level-debug', and `--c-debug' options. scripts/mgnuc.in: compiler/mercury_compile.m: doc/user_guide.texi: Change things so that `--c-debug' does not imply `--no-c-optimize'. configure.in: Add `-fomit-frame-pointer' to CFLAGS_FOR_GOTOS on alpha-*. Empirically, this seems to be needed, otherwise lots of the test cases fail when compiled with `--no-c-optimize'. (It might also be needed for other architectures, I don't know.) |
||
|
|
af0908e677 |
Fix a bug: the default --trace' should be --trace minimum'
Estimated hours taken: 0.25 compiler/options.m: Fix a bug: the default `--trace' should be `--trace minimum' not `--trace minimal'. compiler/handle_options.m: Unwrap some lines that didn't need to be wrapped. |
||
|
|
d10af74168 |
This change introduces interface tracing, and makes it possible to successfully
Estimated hours taken: 50
This change introduces interface tracing, and makes it possible to successfully
bootstrap the compiler with tracing (either interface or full).
compiler/options.m:
Change the bool options --generate-trace into a string option --trace
with three valid values: minimal, interface and full. The last two mean
what they say; the intention is that eventually minimal will mean
no tracing in non-tracing grades and interface tracing in tracing
grades.
compiler/globals.m:
Add a new global for the trace level.
compiler/handle_options.m:
Convert the argument of --trace to a trace level.
Use only consistent 4-space indentation in the deeply nested
if-then-else.
compiler/trace.m:
Implement interface tracing.
Rename trace__generate_depth_reset_code as trace__prepare_for_call,
since it does more than reset the depth if this module is compiled
with interface tracing.
Do not check whether tracing is enabled before calling MR_trace;
let MR_trace make the check. This trades increased non-tracing
execution time for a substantial code size reduction (which may
in turn benefit execution time).
compiler/call_gen.m:
Call trace__generate_depth_reset_code by its new name.
compiler/code_info.m:
Fix a bug in the handling of non/semi commits. When entering a commit,
we used to push a clone of whatever the top failure continuation was.
However, the resume setup for this continuation could have started
with a label that assumed that the resume vars were in their original
locations (which are often registers), whereas the method of
backtracking to that point only guarantees the survival of stack slots,
not registers.
(This bug caused two lines of incorrect code to be generated among
the approx 30 million lines of code in the stage 2 compiler when
compiled with tracing.)
Fix another bug (previously untriggered as far as I know) in the
handling of multi/det commits. This one was breaking the invariant
that the resume vars set of each entry on the failure continuation
stack included the resume vars set of every other entry below it,
which meant that the values of these resume vars were not guaranteed
to be preserved.
compiler/stack_layout.m:
Make layout structures local to their module. They are not (yet)
referred to by name from other modules, and by declaring them
to be global we caused their names to be included even in stripped
executables, adding several megabytes to the size of the binary.
(The names are not stripped because a dynamically linked library
may want to refer to them.)
Change the mercury_data__stack_layout__ prefix on the names of
generated globals vars to just mercury_data__layout__. It is now
merely too long instead of far too long.
Include the label number in the label layout structure and the number
of typeinfo variables in a var_info structure only with native gc.
Their only use is in debugging native gc.
Fix some documentation rot.
compiler/llds.m:
Add a new field to the pragma_c instruction that says whether the
compiler-generated C code fragments access any stack variables.
compiler/frameopt.m:
Use the new field in pragma_c's to avoid a bug. Because frameopt was
assuming that the pragma_c instruction that filled in the stack slots
containing the call sequence number and depth did not access the stack,
it moved the pragma_c before the incr_sp that allocates the frame
(it was trying to get it out of the loop).
compiler/*.m:
Minor changes to set or ignore the extra field in pragma_c, to refer
to layout structures via the new prefix, or to handle the --trace
option.
doc/user_guide.texi:
Update the documentation for --trace.
runtime/mercury_types.h:
Add the type Unsigned.
runtime/mercury_goto.h:
Use the shorter layout prefix.
runtime/mercury_stack_layout.h:
Use the shorter layout prefix, and include the label number only with
native gc.
runtime/mercury_trace.[ch]:
runtime/mercury_trace_internal.[ch]:
runtime/mercury_trace_external.[ch]:
runtime/mercury_trace_util.[ch]:
Divide the old mercury_trace.[ch] into several components, with one
module for the internal debugger, one for the interface to the
external debugger, one for utilities needed by both. Mercury_trace.c
now has only the top-level stuff that steers between the two
debuggers.
runtime/mercury_trace.[ch]:
Add the new global variable MR_trace_from_full. Before each call,
the calling procedure assigns TRUE to this variable if the caller
is fully traced, and FALSE otherwise. Interface traced procedures
generate trace events only if this variable is TRUE when they are
called (fully traced callee procedures ignore the initial value of
the variable).
Make MR_trace return immediately without doing anything unless
tracing is enabled and a new extra argument to MR_trace is TRUE.
This extra argument is always TRUE for trace events in fully traced
procedures, while for trace events from interface traced procedures,
its value is set from the value of MR_trace_from_full at the time
that the procedure was called (i.e. the event is ignored unless the
interface traced procedure was called from a fully traced procedure).
runtime/mercury_trace.[ch]:
runtime/mercury_trace_internal.[ch]:
For global variables that are stored in stack slots, make their type
Word rather than int.
Use a new function MR_trace_event_report instead of calling
MR_trace_event with a NULL command structure pointer to indicate
that the event is to be reported but there is to be no user
interaction.
Use %ld formats in printfs and casts to long for better portability.
runtime/mercury_trace_internal.c:
Save trace-related globals across calls to Mercury library code
in the debugger, since otherwise any trace events in this code
could screw up e.g. the event number or the call number sequence.
Create separate functions for printing port names and determinisms.
runtime/mercury_wrapper.h:
Disable the tracing of the initialization and finalization code
written in Mercury.
runtime/Mmakefile:
Update for the new source and header files.
tests/debugger/{debugger_regs,interpreter,queens}_lib.{m,inp,exp}:
One new copy of each existing test case. These ones are intended
to be used when the stage 2 library is compiled with tracing, which
affects the tests by adding events for the library procedures called
from the test programs.
The .m files are the same as before; one of the .inp files is a bit
different; the .exp files reflect the correct output when the library
is compiled with full tracing.
tests/debugger/Mmakefile:
Provide separate targets for the new set of test cases.
Use --trace full instead of --generate-trace.
tests/debugger/runtests:
Try both the new set of test cases if the old set fails, and report
failure only if both sets fail. This is simpler than trying to figure
out which set should be really tested, and the probability of a false
positive is negligible.
|
||
|
|
c95ddbceec |
Disable deforestation, since it breaks a couple of test cases.
Estimated hours taken: 0.01 compiler/options.m Disable deforestation, since it breaks a couple of test cases. |
||
|
|
75354e38bb |
Deforestation.
Estimated hours taken: 400
Deforestation.
This increases the code size of the compiler by ~80k when compiling
with --intermodule-optimization --deforestation.
The improvement from deforestation is not measurable for mmc -C make_hlds.m.
Compile time for make_hlds.m increased from 50.7 seconds to 52.2 seconds
when running deforestation.
compiler/simplify.m
compiler/common.m
Provide a nicer interface for simplifying a goal,
not an entire procedure.
Rework the interface to avoid manipulating lots of booleans.
Return an estimate of the improvement in cost from simplification.
Remove failing cases and disjuncts.
Add an option to optimize common structures even across calls.
Remove code to merge branched goals, since that is now
done by deforestation.
Fix a bug: the code to collect instmap_deltas for cases was not
including the switched-on variable in the instmap_delta,
which caused an abort in merge_instmap_delta if the switched
on variable was further instantiated in the switch.
This came up while compiling the compiler with --deforestation.
compiler/det_report.
Output duplicate call warnings even if --warn-simple-code is not set.
XXX fix the same problem with `:- pragma obsolete'.
compiler/code_aux.m
Update code_aux__cannot_loop to use termination information.
compiler/hlds_pred.m
compiler/dnf.m
Pass the type_info_varmap and typeclass_info_varmap
into hlds_pred__define_new_pred.
Restrict the variables of the new procedure onto the variables
of the goal.
Make sure all relevant type_infos are passed into the new
procedure if --typeinfo-liveness is set.
compiler/modes.m
compiler/unique_modes.m
compiler/mode_info.m
compiler/modecheck_unify.m
Put `how_to_check_goal' into the mode_info, rather
than passing it around.
Add a field to the `check_unique_modes' case which
controls whether unique modes is allowed to choose
a different procedure. For deforestation, this is
not allowed, since it could result in choosing a less
efficient procedure after generalisation.
compiler/options.m
New options:
--deforestation
--deforestation-depth-limit
Safety net for termination of the algorithm.
--deforestation-cost-factor
Fudge factor for working out whether deforestation
was worthwhile.
--deforestation-vars-threshold
Like --inline-vars-threshold.
Enable deforestation at -O3.
Removed an unnecessary mode for option_defaults_2, since it
resulted in a warning about disjuncts which cannot succeed.
compiler/handle_options.m
--no-reorder-conj implies --no-deforestation.
compiler/inlining.m
Separate code to rename goals into inlining__do_inline_call.
compiler/hlds_goal.m
Added predicates goal_list_nonlocals, goal_list_instmap_delta
and goal_list_determinism to approximate information about
conjunctions.
compiler/hlds_module.m
Added module_info_set_pred_proc_info to put an updated
pred_info and proc_info back into the module_info.
compiler/hlds_out.m
Exported hlds_out__write_instmap for debugging of deforestation.
Bracket module names on constructors where necessary.
compiler/mercury_compile.m
Call deforestation.
Use the new interface to simplify.m.
compiler/intermod.m
Put recursive predicates with a top-level branched goal
into `.opt' files.
goal_util.m
Added goal_calls_pred_id to work out if a predicate is
recursive before mode analysis.
Export goal_util__goals_goal_vars for use by deforestation.
Give a better message for a missing variable in a substitution.
compiler/instmap.m
Give a better message for inst_merge failing.
compiler/notes/compiler_design.m
Document the new modules.
library/varset.m
Add varset__select to project a varset's names and values
onto a set of variables.
doc/user_guide.texi
Document deforestation.
Remove a reference to a non-existent option, --no-specialize.
util/mdemangle.c
profiler/demangle.m
tests/misc_tests/mdemangle_test.{exp,inp}
Handle the `DeforestationIn__' predicate names introduced by
deforestation, similar to the `IntroducedFrom__' for lambda goals.
New files:
deforest.m Deforestation.
pd_cost.m Cost estimation.
pd_debug.m Debugging output.
pd_info.m State type and version control.
pd_term.m Termination checking.
pd_util.m Utility predicates
|
||
|
|
f884cee0c4 |
Finish off the centralization of the file name handling code, and
Estimated hours taken: 11 Finish off the centralization of the file name handling code, and add support for generating intermediate files in subdirectories. scripts/mmake.in: Add a new boolean option `--use-subdirs'; if enabled, it just sets the environment variable MMAKE_USE_SUBDIRS to `yes' before invoking Make. Also add negative versions of the various options (`--no-use-subdirs', `--no-verbose', `--no-save-makefile'). scripts/Mmake.rules: Add code to handle generating intermediate file names in subdirectories. If MMAKE_USE_SUBDIRS=yes, we add `--use-subdirs' to MCFLAGS, and most of the pattern rules are changed to use subdirectories. Note that getting this to work required a bit of a hack: due to what seem to be bugs in GNU Make, `mmake depend' needs to do `mmc --make-short-interface *.m' to get things started. But once the int3s are there, the dependencies seem to work OK. compiler/options.m: Add a new boolean option `--use-subdirs'. compiler/modules.m: Add new predicate `fact_table_file_name'. Add an extra argument to `module_name_to_file_name', specifying whether or not to create any directories needed for the file name. Change all the file-name-creating predicates here to go through a single new predicate `choose_file_name', and add code in that predicate to handle the `--use-subdirs' option. Also if the `--use-subdirs' option is set, don't use the compact dependencies format, since it can't work in that case. compiler/fact_table.m: Call `fact_table_file_name' rather than using `string__append'. compiler/mercury_compile.m: Change `link_module_list' and `join_module_list' so that they create file names by calling `module_name_to_file_name'. compiler/export.m: compiler/intermod.m: compiler/llds_out.m: compiler/mercury_compile.m: compiler/module_qual.m: compiler/modules.m: compiler/termination.m: compiler/trans_opt.m: compiler/unused_args.m: Change all calls to `module_name_to_file_name' to pass the extra argument specifying whether or not to make any directories needed for the file name. library/Mmakefile: Change the rule for `mmake install_ints' so that it creates a `Mercury' subdirectory with symbolic links `ints', `int2s', `int3s', `opts', and `trans_opts' which just point to `..'. This is needed for the `--use-subdirs' option to work, because Mmake currently does not support mixing libraries compiled with and without `--use-subdirs'. doc/user_guide.texi: Document the above changes. |
||
|
|
11d8161692 |
Add support for nested modules.
Estimated hours taken: 50
Add support for nested modules.
- module names may themselves be module-qualified
- modules may contain `:- include_module' declarations
which name sub-modules
- a sub-module has access to all the declarations in the
parent module (including its implementation section).
This support is not yet complete; see the BUGS and LIMITATIONS below.
LIMITATIONS
- source file names must match module names
(just as they did previously)
- mmc doesn't allow path names on the command line any more
(e.g. `mmc --make-int ../library/foo.m').
- import_module declarations must use the fully-qualified module name
- module qualifiers must use the fully-qualified module name
- no support for root-qualified module names
(e.g. `:parent:child' instead of `parent:child').
- modules may not be physically nested (only logical nesting, via
`include_module').
BUGS
- doesn't check that the parent module is imported/used before allowing
import/use of its sub-modules.
- doesn't check that there is an include_module declaration in the
parent for each module claiming to be a child of that parent
- privacy of private modules is not enforced
-------------------
NEWS:
Mention that we support nested modules.
library/ops.m:
library/nc_builtin.nl:
library/sp_builtin.nl:
compiler/mercury_to_mercury.m:
Add `include_module' as a new prefix operator.
Change the associativity of `:' from xfy to yfx
(since this made parsing module qualifiers slightly easier).
compiler/prog_data.m:
Add new `include_module' declaration.
Change the `module_name' and `module_specifier' types
from strings to sym_names, so that module names can
themselves be module qualified.
compiler/modules.m:
Add predicates module_name_to_file_name/2 and
file_name_to_module_name/2.
Lots of changes to handle parent module dependencies,
to create parent interface (`.int0') files, to read them in,
to output correct dependencies information for them to the
`.d' and `.dep' files, etc.
Rewrite a lot of the code to improve the readability
(add comments, use subroutines, better variable names).
Also fix a couple of bugs:
- generate_dependencies was using the transitive implementation
dependencies rather than the transitive interface dependencies
to compute the `.int3' dependencies when writing `.d' files
(this bug was introduced during crs's changes to support
`.trans_opt' files)
- when creating the `.int' file, it was reading in the
interfaces for modules imported in the implementation section,
not just those in the interface section.
This meant that the compiler missed a lot of errors.
library/graph.m:
library/lexer.m:
library/term.m:
library/term_io.m:
library/varset.m:
compiler/*.m:
Add `:- import_module' declarations to the interface needed
by declarations in the interface. (The previous version
of the compiler did not detect these missing interface imports,
due to the above-mentioned bug in modules.m.)
compiler/mercury_compile.m:
compiler/intermod.m:
Change mercury_compile__maybe_grab_optfiles and
intermod__grab_optfiles so that they grab the opt files for
parent modules as well as the ones for imported modules.
compiler/mercury_compile.m:
Minor changes to handle parent module dependencies.
(Also improve the wording of the warning about trans-opt
dependencies.)
compiler/make_hlds.m:
compiler/module_qual.m:
Ignore `:- include_module' declarations.
compiler/module_qual.m:
A couple of small changes to handle nested module names.
compiler/prog_out.m:
compiler/prog_util.m:
Add new predicates string_to_sym_name/3 (prog_util.m) and
sym_name_to_string/{2,3} (prog_out.m).
compiler/*.m:
Replace many occurrences of `string' with `module_name'.
Change code that prints out module names or converts
them to strings or filenames to handle the fact that
module names are now sym_names intead of strings.
Also change a few places (e.g. in intermod.m, hlds_module.m)
where the code assumed that any qualified symbol was
fully-qualified.
compiler/prog_io.m:
compiler/prog_io_goal.m:
Move sym_name_and_args/3, parse_qualified_term/4 and
parse_qualified_term/5 preds from prog_io_goal.m to prog_io.m,
since they are very similar to the parse_symbol_name/2 predicate
already in prog_io.m. Rewrite these predicates, both
to improve maintainability, and to handle the newly
allowed syntax (module-qualified module names).
Rename parse_qualified_term/5 as `parse_implicit_qualified_term'.
compiler/prog_io.m:
Rewrite the handling of `:- module' and `:- end_module'
declarations, so that it can handle nested modules.
Add code to parse `include_module' declarations.
compiler/prog_util.m:
compiler/*.m:
Add new predicates mercury_public_builtin_module/1 and
mercury_private_builtin_module/1 in prog_util.m.
Change most of the hard-coded occurrences of "mercury_builtin"
to call mercury_private_builtin_module/1 or
mercury_public_builtin_module/1 or both.
compiler/llds_out.m:
Add llds_out__sym_name_mangle/2, for mangling module names.
compiler/special_pred.m:
compiler/mode_util.m:
compiler/clause_to_proc.m:
compiler/prog_io_goal.m:
compiler/lambda.m:
compiler/polymorphism.m:
Move the predicates in_mode/1, out_mode/1, and uo_mode/1
from special_pred.m to mode_util.m, and change various
hard-coded definitions to instead call these predicates.
compiler/polymorphism.m:
Ensure that the type names `type_info' and `typeclass_info' are
module-qualified in the generated code. This avoids a problem
where the code generated by polymorphism.m was not considered
type-correct, due to the type `type_info' not matching
`mercury_builtin:type_info'.
compiler/check_typeclass.m:
Simplify the code for check_instance_pred and
get_matching_instance_pred_ids.
compiler/mercury_compile.m:
compiler/modules.m:
Disallow directory names in command-line arguments.
compiler/options.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
compiler/modules.m:
Add a `--make-private-interface' option.
The private interface file `<module>.int0' contains
all the declarations in the module; it is used for
compiling sub-modules.
scripts/Mmake.rules:
scripts/Mmake.vars.in:
Add support for creating `.int0' and `.date0' files
by invoking mmc with `--make-private-interface'.
doc/user_guide.texi:
Document `--make-private-interface' and the `.int0'
and `.date0' file extensions.
doc/reference_manual.texi:
Document nested modules.
util/mdemangle.c:
profiler/demangle.m:
Demangle names with multiple module qualifiers.
tests/general/Mmakefile:
tests/general/string_format_test.m:
tests/general/string_format_test.exp:
tests/general/string__format_test.m:
tests/general/string__format_test.exp:
tests/general/.cvsignore:
Change the `:- module string__format_test' declaration in
`string__format_test.m' to `:- module string_format_test',
because with the original declaration the `__' was taken
as a module qualifier, which lead to an error message.
Hence rename the file accordingly, to avoid the warning
about file name not matching module name.
tests/invalid/Mmakefile:
tests/invalid/missing_interface_import.m:
tests/invalid/missing_interface_import.err_exp:
Regression test to check that the compiler reports
errors for missing `import_module' in the interface section.
tests/invalid/*.err_exp:
tests/warnings/unused_args_test.exp:
tests/warnings/unused_import.exp:
Update the expected diagnostics output for the test cases to
reflect a few minor changes to the warning messages.
tests/hard_coded/Mmakefile:
tests/hard_coded/parent.m:
tests/hard_coded/parent.child.m:
tests/hard_coded/parent.exp:
tests/hard_coded/parent2.m:
tests/hard_coded/parent2.child.m:
tests/hard_coded/parent2.exp:
Two simple tests case for the use of nested modules with
separate compilation.
|
||
|
|
5ef3bb6fdc |
Use stack layout tables to transmit information to the tracer, to allow
Estimated hours taken: 20
Use stack layout tables to transmit information to the tracer, to allow
the tracer to print the names and values of variables at CALL and EXIT ports.
Extend stack layout tables to permit this.
For the time being the tables do not contain information about how to fill
in pseudo-typeinfos, so printing only works for monomorphic procedures.
compiler/llds.m:
Allow space for variable names in the information we gather about live
variables at given labels.
compiler/llds_out.m:
Print out variable names in the information we gather about live
variables at given labels in comments.
compiler/continuation_info.m:
Include variable names in the information we gather about live
variables at given labels.
Record the determinism of each procedure, not its code model.
compiler/{call_gen,code_gen,code_info}.m:
Include the names of variables in the data given to
continuation_info.m.
compiler/options.m:
Add a new developer-only option, --procid-stack-layout, whose effect
is to extend stack_layout structures with static info identifying the
procedure. This is used by execution tracing, and could (should) be
used by stack tracing and profiling.
Rename --alternate-liveness as --typeinfo-liveness. This is more
expressive. Later we should add a new option --trace-liveness, which
preserves every variable until the end of the clause for use by
the trace debugger.
compiler/handle_options.m:
Handle the option implications of --procid-stack-layout.
compiler/stack_layout.m:
Include the encoded determinism instead of the code model in stack
layout tables.
Include variable names in the live data section of stack layout tables
if they are available.
Include procedure identification information in the stack layout tables
if --procid-stack-layout is set.
compiler/trace.m:
Use the new interface to MR_trace.
compiler/*.m:
Trivial changes following from the renaming of --alternate-liveness.
runtime/mercury_accurate_gc.h:
Add macros to decode encoded determinisms.
Define structs for accessing the stack layout tables.
runtime/mercury_regs.h:
Define a macro similar to virtual_reg, except in that it can refer
to an arbitrary memory area, not just fake_reg.
runtime/{mercury_string,mercury_types}.h:
Move the typedefs of Char, UnsignedChar, String and ConstString
from mercury_string.h to mercury_types.h to avoid problems with
circular #includes.
runtime/mercury_trace.[ch]:
Revise the interface to MR_trace so that it takes the layout table
of the procedure as an argument. From the layout table, we can get
to the module name, predicate name, arity, mode number, and
determinism of the procedure, so we don't need to pass these any more,
reducing parameter passing overhead. We can also get to information
about where the input and output arguments are. We now use this
information to allow the user to print out the value of the arguments
at the CALL and EXIT ports.
Change the prompt to a less intrusive "mtrace> ".
runtime/mercury_wrapper.[ch]:
Add a new global variable, MR_library_trace_browser. We reserve space
for this variable in mercury_wrapper.c. It will be initialized by the
automatically generated xxx_init.c file to point to the procedure
that the tracer will invoke to let the user browse the values of
variables. This mechanism allows the runtime to maintain its current
ignorance about the contents of the standard library.
util/mkinit.c:
Generate additional code in the xxx_init.c files to fill in the value
of MR_library_trace_browser.
tests/misc_tests/debugger_test.{inp,exp}:
Add a few printing commands into the input for this test case, and
update the expected output.
|
||
|
|
f2c864b76a |
Move a line in the options help back up where it belongs.
Estimated hours taken: 0.05 compiler/options.m: Move a line in the options help back up where it belongs. |
||
|
|
51e8fd3d51 |
Reorganize options for accurate GC, stack tracing and execution tracing.
Estimated hours taken: 20 Reorganize options for accurate GC, stack tracing and execution tracing. The new options are: --stack-trace Turn on stack traces (incomplete, just turns on required stack layouts at the moment). --basic-stack-layout Turns on stack layouts for each procedure, and (currently) each internal label. --agc-stack-layout Turns on stack layouts for accurate gc. implies --basic-stack-layout. --trace-stack-layout Turns on stack layouts for execution tracing. Implies --basic-stack-layout. --alternate-liveness Use what was previously called the "accurate gc" liveness calculation method. Execution tracing needs this too. Add live value information (at entry and exit) for execution tracing. compiler/call_gen.m: compiler/handle_options.m: compiler/live_vars.m: compiler/liveness.m: compiler/mercury_compile.m: compiler/options.m: compiler/unused_args.m: Use new options. Handle new option dependencies. compiler/code_gen.m: Use new options. Generate live value information for entry and exit points if we are doing execution tracing. Add typeinfos to livevals(...) instruction so that value numbering doesn't move them. compiler/continuation_info.m: Add support for collecting information on live values at entry and exit. Change the data structures to accomodate the new data collection needed. compiler/stack_layout.m: Output tracing liveness information if needed. Use new options. |
||
|
|
6d7ceae344 |
Fix a couple of places where the help messages didn't line up
Estimated hours taken: 0.5 compiler/options.m: Fix a couple of places where the help messages didn't line up or didn't fit in 80 columns. Change some old comments that referred to the `mc' script to instead talk about the `mmc' script (`mc' was renamed). compiler/options.m: doc/user_guide.texi: Move the documentation of the termination analysis options from the "overall optimization options" section to a new "termination analysis options" section. (Termination analysis might have some effect on optimization, but that is not it's primary purpose, so it doesn't belong in the optimization options section at all.) In the User Guide, add a pointer to the section on termination analysis in the Language Reference Manual. |
||
|
|
803fb1c727 |
Remove the last vestiges of support for type_info representations
Estimated hours taken: 0.5 compiler/options.m: compiler/handle_options.m: compiler/globals.m: compiler/polymorphism.m: runtime/mercury_type_info.h: Remove the last vestiges of support for type_info representations other than "shared-one-or-two-cell". |
||
|
|
d9a891acc0 |
Fix the processing of .trans_opt files so that circular dependencies
Estimated hours taken: 20 Fix the processing of .trans_opt files so that circular dependencies cannot occur. This also guarantees correctness of the information in the .trans_opt file. compiler/handle_options.m: Add the fact that --transitive-intermodule-optimization implies --intermodule-optimization, and that --make-transitive-optimization-interface implies --transitive-intermodule-optimization. compiler/mercury_compile.m: Add code to read the .d file before new .d files are written. The .d file is only read if transitive intermodule optimization is enabled. Also changed the pre-hlds pass so that .d files were not written when `error-check only' or `type-check only' options were selected. compiler/modules.m: Modified so that the trans_opt dependencies were correctly created, and so they were written out to the .d files. Also added new code to read the .d files in. Removed the transitive_dependencies set of predicates as they were no longer used. compiler/options.m: Added new option 'warn-missing-trans-opt-deps', to control whether warnings are emitted when the dependency information in the .d file is lost. Also uncommented the help messages describing transitive-intermodule-optimization. compiler/trans_opt.m: Small changes to trans_opt__grab_optfiles. Also modified the comment at the beginning of the file to reflect the current set of changes. doc/user_guide.texi: Uncommented the documentation on transitive intermodule optimization. |