Estimated hours taken: 1
Branches: main
Remove support for the reserve tag (.rt) grades.
These were only ever needed to support the implementation of Herbrand
variables in (older versions of) HAL.
NOTE: this change removes the .rt grade, the undocumented
reserve_tag pragma is unchanged.
runtime/mercury_grade.h:
Do not handle the .rt component. Rather than renumbering the
grade parts here I have documented that grade part 8 (formerly .rt)
is unused.
runtime/mercury_tags.h:
runtime/mercury_type_info.h:
runtime/mercury_conf_param.h:
Conform to the above change.
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/options.m:
compiler/make_tags.m:
compiler/prog_type.m:
Remove the `--reserve-tag' option and modify any code
that relied upon it. Such code is largely unchanged
since it is still required for the implementation of the
reserve_tag pragma.
doc/user_guide.texi:
Delete documentation for `--reserve-tag'.
scripts/canonical_grade.sh-subr:
scripts/init_grade_otpions.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
Remove support for the `.rt' grade component.
NEWS:
Announce that .rt grades are no longer supported.
extras/trailed_update/var.m:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/tests/Mmakefile:
Update some documentation.
tests/debugger/Mmakefile:
tests/tabling/Mmakefile:
Delete special handling for .rt grades.
Estimated hours taken: 3
Branches: main
Removed support for Managed C++ as a foreign language for the IL backend.
This is being removed for the following reasons:
* It is only supported by Microsoft, making it harder to use code
using it with other CIL platforms (e.g. Mono).
* It is not used in any of the standard library (only C# and IL are used).
* Removing it will simplify the dependencies and the build process.
* Microsoft have deprecated it in favour of C++/CLI.
NEWS:
Mentioned the change.
aclocal.m4:
Remove checks for the Microsoft.NET C++ compiler.
compiler/globals.m:
Delete Managed C++ from the set of supported languages.
compiler/mlds_to_managed.m:
Remove support for Managed C++ code generation.
compiler/*.m:
Remove all references to Managed C++.
runtime/Mmakefile:
runtime/mercury_mcpp.h:
Remove the Managed C++ part of the Mercury runtime.
runtime/mercury_il.il:
runtime/mercury_typeclass_info.h:
runtime/mercury_type_info.h:
Remove all references to Managed C++, including instructions to keep
certain parts in sync with Managed C++ part of the runtime.
doc/reference_manual.texi:
Remove the Managed C++ sections in the Foreign Language Interface
chapter.
doc/user_guide.texi:
Remove the documentation of Managed C++ related flags.
library/Mmakefile:
Remove Managed C++ flag settings.
library/io.m:
Remove commented out Managed C++ code.
library/list.m:
Change a comment referring to Managed C++ to refer to C# instead.
scripts/Mmake.rules:
scripts/Mmake.vars.in:
Remove all rules and variables for Managed C++ from mmake.
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_proc_make.m:
tests/hard_coded/redoip_clobber.m:
Replace Managed C++ code with C# code in the relevant tests.
Estimated hours taken: 4
Branches: main
Add support for header files to the Erlang back-end. These have the extension
.hrl. Code from :- pragma foreign_decls are put into the modules's .hrl file,
unless it has the `local' attribute. Header files of imported modules
are automatically included in the generated Erlang source files.
compiler/elds.m:
compiler/erl_code_gen.m:
Record imported modules in the ELDS structure.
compiler/elds_to_erlang.m:
Generate .hrl files when generating .erl files.
Add -include("<module>.erl"). directives in generated .erl files,
for each imported module.
compiler/options.m:
Add option --erlang-include-directory <dir> which specifies
where to search for .hrl files.
compiler/handle_options.m:
Add --erlang-include-directory <dir>/lib/<grade>/inc
to search for .hrl files for installed libraries.
Add --erlang-include-directory <pwd>/Mercury/hrls
or <pwd>/Mercury/<grade>/Mercury/hrls
to search for .hrl files for the current directory.
compiler/compile_target_code.m:
Pass -I<dir> options to the Erlang compiler for each
--erlang-include-directory <dir> option.
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/modules.m:
Update `mmc --make' to build, install and clean .hrl files.
Unrelated fix: mark _init.erl and _init.beam files as grade dependent.
doc/user_guide.texi:
Document --erlang-include-directory and --erlang-native-code (which was
missed previously).
library/io.m:
Add `local' attributes to foreign_decls which shouldn't be exported.
library/erlang_rtti_implementation.m:
Add "ML_" prefixes to macros which will be exported now.
Estimated hours taken: 1
Branches: main
compiler/options.m:
doc/user_guide.texi:
Add an option `--erlang-native-code'.
Document Erlang-related options.
compiler/compile_target_code.m:
Pass +native to the Erlang compiler if --erlang-native-code is enabled.
Estimated hours taken: 4
Branches: main
Windows has a limit on the command line length. Allow mkinit
to be passed a list of files to be processed in a file via
-f to avoid this limit.
compiler/compile_target_code.m:
Use the -f option to avoid overflowing the windows
command line.
util/mkinit.c:
Add code to handle the -f option.
Estimated hours taken: 3
Branches: main
When compiling using a Mercury compiler built on top of MSVC,
we use the windows command shell to invoke commands.
The windows command shell limits the length of command lines,
this change works around that limit when building the command line
to build an archive.
compiler/compile_target_code.m:
When linking using the windows lib tool, place the list of
files into a temp file and use that temp file as the method
to pass the set of files to link to lib.
Estimated hours taken: 1
Branches: main
Add a new grade component for use with region-based memory management.
runtime/mercury_conf_param.h:
runtime/mercury_grade.h:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/options.m:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
doc/user_guide.texi:
Add the grade component `.rbmm' for use with region-based memory
management.
Estimated hours taken: 12
Branches: main
Support :- initialise and :- finalise predicates in the Erlang backend.
compiler/compile_target_code.m:
Refactor the code relating to running mkinit to generate .init and
_init.c files, and compiling _init.c files.
Generalise the code so that it can call mkinit_erl with the right
options.
compiler/dead_proc_elim.m:
Add initialisation and finalisation predicates to the queue at the
start of the pass so that they won't be eliminated. For the C
backends we implicitly :- foreign_export init and final preds so they
would never be eliminated, but we don't do that in the Erlang
backend.
compiler/elds.m:
Extend the ELDS to hold pred_proc_ids of init/final preds.
compiler/erl_code_gen.m:
compiler/mercury_compile.m:
Conform to change in ELDS.
compiler/elds_to_erlang.m:
Output mercury__required_init and mercury__required_final functions
which call user initialisation and finalisation predicates, if any.
Write out -export annotations for those functions.
Write out REQUIRED_INIT and REQUIRED_FINAL directives for those
functions.
compiler/hlds_module.m:
compiler/make_hlds_passes.m:
Remember the arity of init/final preds in the HLDS, not just the
sym_name.
Add predicates to return the pred_proc_ids of init/final preds.
Delete module_info_user_init_pred_c_name and
module_info_user_final_pred_c_name as they are unused.
compiler/make.program_target.m:
Call make_erlang_program_init_file and make_erlang_library_init_file
when building an Erlang executable or library, respectively.
Install a .init file when installing an Erlang library.
Conform to changes in compile_target_code.m.
compiler/modules.m:
In module_name_to_file_name, treat extensions specially if they end
".erl" and ".beam", not only if they are exactly those strings. This
is because we may pass "_init.erl" or "_init.beam" as the extension.
compiler/options.m:
Add an option `--mkinit-erl-command'.
util/Mmakefile:
util/.cvsignore:
util/mkinit_erl.c:
Add `mkinit_erl' program which is a modified version of `mkinit'.
util/mkinit.c:
util/mkinit_common.c:
util/mkinit_common.h:
Factor out code common to mkinit and mkinit_erl into mkinit_common.c
and mkinit_common.h.
tests/hard_coded/Mmakefile:
Fix misspellings of "MERCURY_SUPPRESS_STACK_TRACE".
tests/hard_coded/impure_init_and_final.m:
Add Erlang foreign proc.
Estimated hours taken: 25
Branches: main
Add support for :- external procedures to the Erlang backend.
Add Erlang support to mmc --make.
compiler/elds.m:
Extend the ELDS for definitions of external procedures.
compiler/elds_to_erlang.m:
Move the logic for mapping a module name to a file name into
module_name_to_file_name, as it is needed for mmc --make as well.
Similarly move erlang_module_name to modules.m.
Output export annotations for :- external procedures which are
exported.
Conform to changes in the ELDS.
compiler/erl_call_gen.m:
Don't generate assignment statements between variables of dummy types.
compiler/erl_code_gen.m:
Generate skeleton ELDS definitions for external procedures.
Fix more cases where success expressions could be inserted after
`erroneous' goals. The Erlang compiler would complain about unbound
variables appearing in success expressions following erroneous goals,
because it doesn't know that the erroneous goal would throw an
exception.
Handle some special cases with `erroneous' and `failure' goals where we
used to generate code that the Erlang compiler would complain about
references to unbound variables, or variables being bound in one branch
of a conditional statement but not another, etc.
- handle a special case where the goal inside a commit scope has
determinism `failure', i.e. it would never actually commit;
- handle a special case where the condition of an if-then-else is
`erroneous', so the Then branch can't be reached;
- handle a special case where a disjunct has determinism `failure',
so later disjuncts will always be evaluated.
Generate code for promise_solutions and exist_quant scopes.
Wrap large success expressions in closures instead of duplicating them
into each disjunct, in the same way that we do for switches.
Disable duplicating of small success expressions into branches of
switches and disjunctions for now, as the implmentation is buggy.
compiler/handle_options.m:
Remove the LLDS and MLDS options from the grade_component_table entry
for the "erlang" grade. They caused compute_grade to return "none" if
only --target erlang was used (because --target erlang didn't imply the
same set of meaningless options).
compiler/hlds_pred.m:
Fix the implementations of `status_is_exported' and
`status_defined_in_this_module' for external procedures.
compiler/compile_target_code.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/modules.m:
Add Erlang support to mmc --make. It can build "libraries" (we just
use directories called libFOO.beams containing Erlang .beam bytecode
files), install them and executables (which are just shell scripts
which invoke the Erlang runtime system).
Refactor some code and fix a few assumptions in places that we were
building for the C backends.
Replace some calls to io.remove_file by io.remove_file_recursively as
our Erlang "libraries" are actually directories.
Unrelated bugfix: for mmc --make --use-grade-subdirs foo.realclean,
remove the symlink created for foo.init in the current directory.
Delete module_name_to_file_name_sep as it is no longer used.
compiler/options.m:
Add options --erlang-interpreter, --erlang-object-file-extension
adn --install-command-dir-option.
doc/user_guide.texi:
Document --install-command-dir-option.
tests/mmc_make/Mmakefile:
Generate TEST_FLAGS *after* start_runtests_local as
start_runtests_local runs make realclean_local, which deletes
TEST_FLAGS.
library/io.m:
Add io.remove_file_recursively which can remove non-empty directories.
Fix the fallback implmentation io.buffer_to_string which was calling a
non-existent `from_char_list_semidet' predicate.
NEWS:
Mention io.remove_file_recursively.
Estimated hours take: 4
Branches: main
Add some preliminary infrastructure for an HLDS->Erlang code generator.
compiler/globals.m:
compiler/options.m:
Recognise "erlang" as a valid compilation target.
Add new options: `--erlang' and `--erlang-only' as synonyms
for `--target erlang' and `--target erlang --target-code-only'.
XXX the new options are currently undocumented.
compiler/hlds_data.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
Recognise "Erlang" as a valid language for foreign code.
compiler/handle_options.m:
For erlang targets, set the gc_method to automatic and disable
optimize_constructor_last_call.
compiler/add_pragma.m:
compiler/add_type.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/export.m:
compiler/foreign.m:
compiler/granularity.m:
compiler/intermod.m:
compiler/llds_out.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/mercury_to_mercury.m:
compiler/ml_code_gen.m:
compiler/ml_optimize.m:
compiler/ml_switch_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_java.m:
compiler/modules.m:
compiler/pragma_c_gen.m:
compiler/prog_foreign.m:
compiler/simplify.m:
Conform to the above changes.
Branches: main
When using mmc --make --use-grade-subdirs, don't make a symlink or copy of
the target file to the user directory if the file in the user directory is
already up to date. This avoids bumping the timestamp unnecessarily.
compiler/compile_target_code.m:
Make post_link_make_symlink_or_copy check the timestamp of the file
in the user directory and do nothing if it is the same as the
timestamp of the file to be linked/copied.
Add an output argument to post_link_make_symlink_or_copy to indicate
if the symlink/copy was made.
compiler/make.program_target.m:
Make build_linked_target_2 only write a "Made symlink/copy of ..."
message if the symlink/copy is actually made by
post_link_make_symlink_or_copy.
Also make it warn in the case that there is nothing for mmc --make to
do. This was previously the case only for --no-use-grade-subdirs.
compiler/make.util.m:
Change maybe_symlink_or_copy_linked_target_message to write "Made
symlink/copy ..." rather than "Making symlink/copy ..." as the
message is now written after the fact.
Estimated hours taken: 5
Branches: main
Make it easy for the user to select single-precision floats instead of the
default double-precision floats. This can be done by using the `.spf' grade
component, or the option `--single-prec-float'. Code using unboxed floats is
incompatible with code using boxed doubles, so we should have a grade for this.
NEWS:
Mention the changes.
compiler/options.m:
Add the `--single-prec-float' option (also `--single-precision-float').
Comment out the documentation for `--unboxed-float'. It shouldn't be
necessary for users to use it directly any more.
compiler/handle_options.m:
Handle the `.spf' grade component.
Make `--single-prec-float' imply `--unboxed-float'.
compiler/compile_target_code.m:
Pass `-DMR_USE_SINGLE_PREC_FLOAT' to the C compiler when
single-precision floats are enabled.
doc/reference_manual.texi:
doc/user_guide.texi:
Document `.spf' and `--single-prec-float'.
runtime/mercury_conf_param.h:
Document `MR_USE_SINGLE_PREC_FLOAT' differently now that it is
documented in the mmc help and manual.
runtime/mercury_float.h:
Undefine `MR_BOXED_FLOAT' if `MR_USE_SINGLE_PREC_FLOAT' is defined.
runtime/mercury_grade.h:
Update the macros that define the MR_GRADE macro to include "_spf"
if `MR_USE_SINGLE_PREC_FLOAT' is defined.
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
Update these scripts to support the `.spf' grade component and
`--single-prec-float' command-line option.
Estimated hours taken: 20
Branches: main
Improve support for calling procedures in Mercury libraries from
applications written in foreign languages, i.e where the program entry point
is not the Mercury predicate main/2. The main trick is to ensure that the
necessary runtime initialisation is done before any Mercury procedures are
called (or at least to provide the mechanism to do such initialisation,
ensuring that it is done is the programmer's responsibility.)
We currently support this sort of thing via the compiler's `--no-main'
option. This diff adds a more user friendly mechanism (at least on the
Mercury side.) In particular, we no longer require that one of the Mercury
libraries define a main/2 predicate. (Note: the existing behaviour of
--no-main is unchanged.)
For the set of Mercury libraries that we wish to use from a foreign
application we create a standalone interface. A standalone interface is a
cut-down version of the _init.c file that would be created for a Mercury
executable that uses the same set of libraries. (Which libraries to include
in the interface can be specified via the usual mechanisms, e.g. the --ml
option.)
The standalone interface has two parts: an object file that contains the
cut-down version of the _init.c file, and a header file that contains the
declarations for the functions that initialise and shut down the Mercury
runtime. This header file is compatible with both C and C++.
compiler/options.m:
Add a new option `--generate-standalone-interface' that causes the
compiler to generate a header/object pair that can be used to
intialise/shut down the Mercury runtime from a foreign application.
The basename of the header/object pair is given as an argument to this
option.
compiler/mercury_compile.m:
Create the standalone interface if invoked with
`--generate-standalone-interface'.
Emit an error message if `--generate-standalone-interface' is
specified with `--target java' or `--target il'. We don't
currently support that.
compiler/compile_target_code.m:
Add code to implement the `--generate-standalone-interface' option.
Fix a typo: s/Serarator/Separator/.
Fix an overlong line.
compiler/handle_options.m:
Emit an error message if `--generate-standalone-interface' and
`--extra-inits' are specified together.
compiler/passes_aux.m:
Fix some broken indentation.
util/mkinit.c:
Add a new mode of operation that generates standalone interfaces.
The principle differences between a standalone interface and a
_init.c file are that the former sets the program entry point to
MR_dummy_main and does not create a main function.
The new `-s' option tells mkinit to create a standalone interface.
(Note that `-s' implies `-l'.)
Add a comment pointing to various places that may need to updated if
mkinit.c is changed.
runtime/mercury_wrapper.{h,c}:
Add a new procedure MR_dummy_main for use with standalone
interfaces. Any attempt to call main/2 through the usual entry
point when operating in standalone mode will cause a runtime abort.
Estimated hours taken: 2
Branches: main
Add some preliminary infrastructure for the LLDS->x86_64 assembler
code generator that Fransiska is working on.
compiler/globals.m:
compiler/options.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
Recognise "x86_64" as a valid compilation target.
Add new options: `--x86_64' and `--x86_64-only' as synonyms
for `--target x86_64' and `--target x86_64 --target-code-only'.
In the backend passes for the lowlevel backend branch
appropriately depending on whether we are generating C or
x86_64 assembler.
compiler/foreign.m:
compiler/prog_foreign.m:
When compiling to x86_64 assembler use C as the preferred foreign
language.
compiler/mlds.m:
compiler/ml_code_gen.m:
compiler/ml_optimize.m:
compiler/ml_switch_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds_to_c.m:
Handle "x86_64" as a target in the MLDS backend. This does
(and should) cause a compiler abort since "x86_64" is intended
to be an MLDS target language.
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/modules.m:
Add placeholders for --target x86_64 in the build systems.
compiler/make_hlds_passes.m.
We don't currently support mutables with --target x86_64.
compiler/simplify.m:
We don't currently support runtime conditions on trace goals
with --target x86_64.
compiler/add_type.m:
compiler/compile_target_code.m:
compiler/granularity.m:
compiler/intermod.m:
Conform to the above changes.
Estimated hours taken: 0.1
Branches: main
Fix a problem that was breaking the test cases for mmc --make on
x86 machines.
compiler/compile_target_code.m:
Don't include .picreg components in the grade specific .init
file installation directories when constructing the argument
list passed to mkinit.
Estimated hours taken: 0.1
Branches: main
Fix static linking against libmer_eventspec with mmc --make.
compiler/compile_target_code.m:
Fix a typo: s/libmer_event_spec/libmer_eventspec/
Estimated hours taken: 4
Branches: main
When building with mmc --make use the grade specific versions of the
.init files.
Support grade specific .init files with --use-grade-subdirs.
compiler/compile_target_code.m:
Use the grade specific version of the .init files for the Mercury
standard libraries, i.e. rt, stdlib, browser, trace.
If --use-grade-subdirs is enabled them symlink/copy .init files
into the user's directory.
compiler/options.m:
Delay handling the init file directories until after the grade
has been computed.
compiler/handle_options.m:
Append the grade to each init file directory, so that we get
the grade specific version of the .init files.
Unrelated changes: replace an if-then-else with a switch.
minor formatting changes.
compiler/modules.m:
.init files are now grade dependent.
scripts/c2init.in:
Use the grade specific version of the .init files for the
standard Mercury libraries.
Estimated hours taken: 32
Branches: main
The objective of this diff is to switch from a table of solver events built
into the compiler (and eventually the debugger) into a table of events
defined by a file provided by the user to the compiler, which the compiler
then records in the executable for use by the debugger.
The current design, for speed of implementation, uses temporary files parsed
by a bison-generated parser. Since the compiler needs to be able to invoke
the parser even if it is compiled in a non-debug grade, the parser is in
a new library, the eventspec library, that is always linked into the Mercury
compiler and is always linked into any Mercury program with debugging enabled
(but is of course linked only once into a Mercury compiler which has debugging
enabled).
Modify the debugger to give it the ability to print the attributes of
user-defined events (for now, only the non-synthesized attributes).
Implement a new debugger command, "user", which goes to the next user-defined
event.
configure.in:
Require flex and and bison to be available.
doc/user_guide.texi:
Document user defined events and the new debugger capabilities.
doc/mdb_categories:
Include "user" in the list of forward movement commands.
Fix some earlier omissions in that list.
runtime/mercury_stack_layout.h:
Include an event number in the user-defined event structure.
Include a string representing an event set specification in module
layout structures.
runtime/mercury_stack_layout.h:
runtime/mercury_trace_base.[ch]:
runtime/mercury_types.h
Switch from solver events to user events in names.
runtime/mercury_trace_term.[ch]:
Provide a representation of flat terms, for use in representing
the calls that generate synthesized attributes.
Ensure that exported field names have an MR_ prefix.
browser/cterm.m:
Conform to the change to runtime/mercury_trace_term.h.
scripts/c2init.in:
scripts/ml.in:
Include the eventspec library in programs compiled with debugging
enabled.
compiler/Mmakefile:
Include the eventspec library in the compiler.
compiler/options.m:
Add a new option, --event-spec-file-name, that allows the user to
specify the set of user-defined events the program may use.
compiler/handle_options.m:
Set this optimization from an environment variable (which may be
set by the mmc script) if the new option is not explicitly given.
compiler/prog_data.m:
Define the data structures for the compiler's representation of the
event set specification.
Move some definitions around to group them more logically.
compiler/hlds_module.m:
Include the event set specification as a new field in the module_info.
compiler/prog_event.m:
Add the code for invoking the parser in the eventspec library,
and for converting the simple term output by the parser to the
compiler own representation, which contains more information
(to wit, the types of the function attributes) and which has had
a whole bunch of semantic checks done on it (e.g. whether synthesized
attributes depend on themselves or on nonexistent attributes).
Provide a function to generate a canonicalized version of the event
specification file.
compiler/module_qual.m:
compiler/equiv_type.m:
Process event spec specifications as well as items, to module qualify
the names of the types of event arguments, and expanding out
equivalence types.
In equiv_type.m, rename some variables to make clear what kind of info
they represent.
compiler/mercury_compile.m:
Process the event set specification file if one has been selected:
read it in, module qualify it, expand its equivalence types, and add
to the module_info.
compiler/compile_target_code.m:
Include the event_spec library when linking debuggable executables.
compiler/call_gen.m:
compiler/continuation_info.m:
compiler/trace_gen.m:
compiler/trace_params.m:
mdbcomp/prim_data.m:
mdbcomp/trace_counts.m:
runtime/mercury_goto.h:
Generate user-defined events instead of solver events.
compiler/layout.m:
compiler/layout_out.m:
compiler/stack_layout.m:
Include a canonicalized version of the event specification file
in the module layout if the module has any user-defined events.
compiler/code_info.m:
compiler/llds_out.m:
compiler/modes.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/typecheck.m:
Conform to the changes above.
compiler/passes_aux.m:
Rename a predicate to avoid an ambiguity.
trace/Mmakefile:
Add the definition and rules required to build the eventspec library.
trace/mercury_event_scanner.l:
trace/mercury_event_parser.y:
A scanner and a parser for reading in event spec specifications.
trace/mercury_event_spec_missing.h:
Provide the declarations that should be (but aren't) provided by
flex and bison.
trace/mercury_event_spec.[ch]:
The main module of the eventspec library. Provides functions to read
in event set specifications from a file, and to write them out as a
Mercury term in the form needed by the compiler.
trace/mercury_trace_tables.c:
If the module layouts being registered include event set
specifications, then check their consistency. Make the specification
and the consistency indication available to other modules.
trace/mercury_trace_internal.c:
During initialization, if the modules contain a consistent set of event
set specifications, then read that specification into the debugger.
(We don't yet make use of this information.)
Add an extra mdb command, "user", which goes forward to the next
user-defined event.
trace/mercury_trace.[ch]:
trace/mercury_trace_cmd_forward.[ch]:
Implement the new mdb command.
trace/mercury_trace_vars.[ch]:
For user-defined events, include the attributes' values among the
values that can be printed or browsed.
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_declarative.c:
Minor changes.
scripts/scripts/prepare_tmp_dir_grade_part:
Copy the .y and .l files to the tmp dir we use for installs.
tools/bootcheck:
Copy the .y and .l files of the trace directory to stage 2.
tools/lmc.in:
Include the eventspec library when linking debuggable executables.
tests/debugger/user_event.{m,inp,exp}:
tests/debugger/user_event_spec:
New test case to test the new functionality.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
Enable the new test case.
tests/debugger/completion.exp:
Expect the new "user" mdb command in the completion output.
Estimated hours taken: 0.2
Branches: main
Fix compilation in .ll_debug grades with mmc --make.
The MR_GRADE macro was not being computed correctly be cause the
C compiler was not being invoked with -DMR_LL_DEBUG.
compiler/compile_target_code.m:
Fix a typo: s/MR_LOW_LEVEL_DEBUG/MR_LL_DEBUG/
compiler/handle_options.m:
The grade component .ll_debug also needs to imply
that --low-level-debug is enabled.
runtime/mercury_grade.h:
Fix a typo: s/mercury_grades.h/mercury_grade.h/
Estimated hours taken: 20
Branches: main
Add a mechanism for growing the stacks on demand by adding new segments
to them. You can ask for the new mechanism via a new grade component, stseg
(short for "stack segments").
The mechanism works by adding a test to each increment of a stack pointer (sp
or maxfr). If the test indicates that we are about to run out of stack, we
allocate a new stack segment, allocate a placeholder frame on the new segment,
and then allocate the frame we wanted in the first place on top of the
placeholder. We also override succip to make it point code that will (1)
release the new segment when the newly created stack frame returns, and then
(2) go to the place indicated by the original, overridden succip.
For leaf procedures on the det stack, we optimize away the check of the stack
pointer. We can do this because we reserve some space on each stack for the
use of such stack frames.
My intention is that doc/user_guide.texi and NEWS will be updated once we have
used the feature ourselves for a while and it seems to be stable.
runtime/mercury_grade.h:
Add the new grade component.
runtime/mercury_conf_param.h:
Document the new grade component, and the option used to debug stack
segments.
runtime/mercury_context.[ch]:
Add new fields to contexts to hold the list of previous segments of the
det and nondet stacks.
runtime/mercury_memory_zones.[ch]:
Include a threshold in all zones, for use in stack segments.
Set it when a zone is allocated.
Restore the previous #ifdef'd out function MR_unget_zone, for use
when freeing stack segments execution has fallen out of.
runtime/mercury_debug.[ch]:
When printing the offsets of pointers into the det and nondet stacks,
print the number of the segment the pointer points into (unless it is
the first, in which case we suppress this in the interest of brevity
and simplicity).
Make all the functions in this module take a FILE * as an input
argument; don't print to stdout by default.
runtime/mercury_stacks.[ch]:
Modify the macros that allocate stack frames to invoke the code for
adding new stack segments when we are about to run out of stack.
Standardize on "nondet" over "nond" as the abbreviation referring to
the nondet stack.
Conform to the changes in mercury_debug.c.
runtime/mercury_stack_trace.c:
When traversing the stack, step over the placeholder stack frames
at the bottoms of stack segments.
Conform to the changes in mercury_debug.c.
runtime/mercury_wrapper.[ch]:
Make the default stack size small in grades that support stack
segments.
Standardize on "nondet" over "nond" as the abbreviation referring to
the nondet stack.
Conform to the changes in mercury_debug.c.
runtime/mercury_memory.c:
Standardize on "nondet" over "nond" as the abbreviation referring to
the nondet stack.
runtime/mercury_engine.[ch]:
runtime/mercury_overflow.h:
Standardize on "nondet" over "nond" as the abbreviation referring to
the nondet stack.
Convert these files to four-space indentation.
runtime/mercury_minimal_model.c:
trace/mercury_trace.c:
trace/mercury_trace_util.c:
Conform to the changes in mercury_debug.c.
compiler/options.m:
Add the new grade option for stack segments.
compiler/compile_target_code.m:
compiler/handle_options.m:
Add the new grade component, and handle its exclusions with other grade
components and optimizations.
compiler/llds.m:
Extend the incr_sp instruction to record whether the stack frame
is for a leaf procedure.
compiler/llds_out.m:
Output the extended incr_sp instruction.
compiler/proc_gen.m:
Fill in the extra slot in incr_sp instructions.
compiler/goal_util.m:
Provide a predicate for testing whether a procedure body is a leaf.
compiler/delay_slot.m:
compiler/dupelim.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/frameopt.m:
compiler/global_data.m:
compiler/jumpopt.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/peephole.m:
compiler/reassign.m:
compiler/use_local_vars.m:
Conform to the change in llds.m.
scripts/canonicate_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
scripts/mgnuc.in:
Handle the new grade component.
Convert parse_grade_options.sh-subr to four-space indentation.
Mmake.workspace:
Fix an old bug that prevented bootcheck from working in the new grade:
when computing the gc grade, use the workspace's version of ml (which
in this case understands the new grade components), rather than the
installed ml (which does not).
(This was a devil to track down, because neither make --debug nor
strace on make revealed how the installed ml was being invoked,
and there was no explicit invocation in the Makefile either; the error
message appeared to come out of thin air just before the completion
of the stage 2 library. It turned out the invocation happened
implicitly, as a result of expanding a make variable.)
Estimated hours taken: 0.1
Branches: main
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/ml_code_gen.m:
compiler/modules.m:
compiler/simplify.m:
Switch on the linked_target_type and target_lang types wherever
we can.
compiler/mlds_to_c.m:
As above and add a sanity check: we shouldn't output IL or Java
to C header files.
Estimated hours taken: 4
Branches: main
Enable the new grade specifiers, ll_debug and gcd.
ll_debug means compile with -O0 and -g.
gcd means compile the boehm_gc with #defines that
allow memory leaks to be debugged.
boehm_gc/Makefile:
Use findstring to see which grade specifiers are available.
Only add BOEHM_CFLAGS_FOR_THREADS if par in GRADE.
Only define NO_DEBUGGING if we are not in gcd.
compiler/compile_target_code.m:
compiler/globals.m:
compiler/handle_options.m:
Handle the gc_boehm_debug.
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Handle the new grade specifiers.
scripts/mgnuc.in:
Set the #defines implied by the new grade specifiers.
scripts/ml.in:
Calculate the name of the boehm_gc library.
Estimated hours taken: 6
Branches: main
Document my recent change implementing coverage testing. At the same time,
eliminate the old hack that allowed a file containing a list of file names to
be considered a trace count file. We haven't needed it since the addition of
mtc_union, and it can lead to incomprensible error messages. (The presence
of the old hack made documenting coverage testing harder.)
In the process, fix the tools code for rerunning failed test cases only.
doc/user_guide.texi:
Document my recent change implementing coverage testing, and the
elimination of the old hack.
mdbcomp/trace_counts.m:
Modify the predicates for reading in trace count files along the lines
above.
mdbcomp/slice_and_dice.m:
Modify the predicates for reading in slices and dices along the lines
above.
Rename some function symbols to avoid ambiguities.
compiler/tupling.m:
slice/mcov.m:
slice/mtc_diff.m:
slice/mtc_union.m:
trace/mercury_trace_declarative.c:
Conform to the changes above.
slice/mcov.m:
Fix the usage message, which referred to this program by its old name
mct.
Allow the output to be restricted to a set of named modules only.
This is to make testing easier.
slice/mtc_diff.m:
Rename the long form of the -o option from --out to --output-file,
to make it consistent with the other programs.
tests/run_one_test:
tools/bootcheck:
Modify the algorithm we use to gather trace counts for the Mercury
compiler from both passed and failed test cases to run mtc_union
periodically instead of gathering all the trace counts file and keeping
them to the end (which takes far too much disk space).
Fix an old bug: gather trace counts from executions of the Mercury
compiler only.
tests/debugger/Mmakefile:
tests/debugger/dice.passes:
Modify the dice test case to compute the union of the trace counts for
the passed versions of this test case to use mtc_union to create
dice.passes, instead of having dice.passes statically contain the list
of the names of the passed trace count files (since that capability
is deleted by this diff).
tools/bootcheck:
tests/Mmake.common:
Fix the code for rerunning failed tests only.
mdbcomp/prim_data.m:
Eliminate some ambiguities in predicate names.
compiler/*.m:
Conform to the change to prim_data.m.
compiler/error_util.m:
Add reading files as a phase in error messages.
compiler/mercury_compile.m:
Use the new facilities in error_util for printing an error message.
Estimated hours taken: 6
Branches: main
This diff contains no algorithmic changes. It merely renames apart a bunch more
function symbols to reduce ambiguity.
After this diff, the summary line from the mdb command "ambiguity -f" is
Total: 351 names used 975 times, maximum 31, average: 2.78
browser/*.m:
compiler/*.m:
Rename function symbols to eliminate ambiguities.
tests/debugger/declarative/dependency.exp:
tests/debugger/declarative/dependency2.exp:
Update the expected out where some internal function symbol names
appear in the output of the debugger. (This output is meant for
implementors only.)
Estimated hours taken: 8
Branches: main
This diff contains no algorithmic changes. It merely renames apart a bunch of
function symbols to reduce ambiguity. Basically I went through prog_data.m,
prog_item.m, hlds_data.m, hlds_goal.m and hlds_pred.m looking for type
definitions containing function symbol names that were either language
"keywords" (e.g. "terminates", which is an annotation on foreign_procs),
used with slightly different meanings in several types (e.g. "sym"),
or both (e.g. "call"). When I found such type definitions, I changed the
names of the function symbols, usually by adding a prefix or suffix
indicating the type to all function symbols of the type. For example,
the old function symbol "foreign_proc" in type "pragma_type" is now named
"pragma_foreign_proc", and the names of all other function symbols in that
type also start with "pragma_".
All of this should yield simpler compiler error messages when we make mistakes,
and will make it more likely that looking up a function symbol using a tags
file will take you to the actual definition of the relevant instance of that
function symbol. However, the most important benefit is the increase in
the readability of unfamiliar code; the reader won't have to emulate the
compiler's type ambiguity resolution algorithm (which in many cases used to
require distinguishing between f/14 and f/15 by counting the arguments,
e.g. for "pred_or_func").
compiler/prog_data.m:
compiler/prog_item.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/hlds_pred.m:
Rename function symbols as explained above.
compiler/*.m:
Conform to the function symbol renames.
In some cases, rename other function symbols as well.
Minor style fixes, e.g. replace if-then-elses with switches,
or simple det predicates with functions.
Estimated hours taken: 5
Branches: main
Upgrade to version 7.0 alpha 6 (CVS 2006-08-14) of the Boehm garbage
collector. The main reason is that thread-local allocation is not
supported on Solaris in version 6.x of the collector.
boehm_gc/*:
Merge in changes from the vendor branch.
.README.in:
Update Boehm GC version number and copyright notice.
Mmake.common.in:
configure.in:
runtime/RESERVED_MACRO_NAMES:
scripts/mgnuc.in:
Don't define `THREAD_LOCAL_ALLOC' nor `GC_REDIRECT_TO_LOCAL' as
thread-local allocation is automatically enabled in gc 7.0.
Consistently use `GC_WIN32_THREADS' and `GC_LINUX_THREADS' as the
non-prefixed versions of those symbols are deprecated.
Don't define `NO_SIGNALS' as it is no longer necessary.
Add librt to the list of thread libraries on Solaris. This is
needed for the POSIX semaphore functions now used on Solaris.
runtime/mercury_prof_mem.c:
runtime/mercury_prof_mem.h:
Update comments mentioning `NO_SIGNALS'.
compiler/compile_target_code.m:
Make `--inline-alloc' do nothing as inline allocation is currently
broken in gc 7.0.
runtime/mercury.h:
runtime/mercury_heap.h:
Include `gc_inline.h' instead of `gc_inl.h' as the latter no longer
exists.
extras/concurrency/semaphore.m:
library/par_builtin.m:
robdd/bryant.c:
Replace instances of `GC_PTR' by `void *' as the former no longer
exists.
runtime/mercury_wrapper.c:
Remove references to `GC_quiet' which no longer exists.
Replace uses of `GC_quiet' for the MPS collector by a new variable
`MR_mps_quiet'.
tools/bootcheck:
Copy libatomic_ops-related files and directories when copying
boehm_gc.
Estimated hours taken: 60
Branches: main
Provide a mechanism for collecting statistics about tabling operations,
and provide a much more convenient mechanism for resetting tables.
Since it would too complex to do this while preserving the capability
of setting --tabling-via-extra-args to no, eliminate that capability
and the option. That option was useful only for measurements of the
performance boost from setting --tabling-via-extra-args to yes in any case,
so users lose no functionality.
Previously, the only way to debug the low level details of the tabling
mechanism was to build a runtime with a specific C macro (MR_TABLE_DEBUG)
and link with that runtime; this was cumbersome. Change that so that
every one of the debuggable tabling macros has a bool argument that says
whether debugging is enabled or not. The compiler can then set this to
MR_TRUE if the new option --table-debug is given, and to MR_FALSE otherwise.
If set to MR_FALSE, the C compiler should optimize away the debug code,
with zero impact on program size or speed.
Since these changes to macros require nontrivial bootstrapping, which we don't
want to do unnecessarily, modify the interface of the tabling macros as
required to support size limits on tables. This diff also implements the
parsing of size limit specifications on tables, but does not implement them
yet; that is for a future change.
To make the syntax simpler, this diff deletes the free-standing fast_loose_memo
pragma. The same functionality is now available with a fast_loose annotation
on an ordinary memo pragma.
Make a bunch of changes to improve readability and maintainability
in the process. These mostly take the form of renaming ambiguous and/or
not sufficiently expressive function symbols.
runtime/mercury_stack_layout.h:
runtime/mercury_tabling.h:
Move the description of structure of tables from mercury_stack_layout.h
to mercury_tabling.h, since we now need it for statistics even if
execution tracing is not enabled.
Modify those data structures to have room for the statistics.
Don't distinguish "strict", "fast_loose" and "specified" memoing
as separate eval methods; treat them as just different kinds
of the same eval method: "memo".
Remove underscores from the names of some types that the style guide
says shouldn't be there.
runtime/mercury_tabling_preds.h:
runtime/mercury_tabling_macros.h:
Modify the approach we use for macros that implement the predicates
of library/table_builtin.m. Instead of selecting between debug and
nondebug based on whether MR_TABLE_DEBUG is defined or not, add
an explicit argument controlling this to each debuggable macro.
The advantage of the new arrangement is that it scales. Another
argument controls whether we are computing statistics (and if yes,
where do we put it), and a third argument controls whether we maintain
back links in the tries and hash tables (this last argument is present
but is ignored for now).
Since the values of the arguments will be known when the .c files
containing calls to these macros are compiled, we pay the space and
time cost of debugging, statistics gathering and the maintenance of
back links if and only we need the revelant functionality.
Provide macros for limited backward compatibility with the old set
of macros; these allow workspaces created by old compilers to work
with the new macros in the runtime. The old macros followed the
naming scheme MR_table_*, the new ones are named MR_tbl_*.
runtime/mercury_table_int_fix_index_body.h:
runtime/mercury_table_int_start_index_body.h:
runtime/mercury_table_type_body.h:
New files containing parts of the old mercury_tabling.c. Each of these
files contains the body of the functions that used to be in
mercury_tabling.c. The new mercury_tabling.c #includes each of these
files more than once, to provide more than one variant of the old
function. These variants differ in aspects such as whether debugging
is enabled or statistics is being collected. Each variant therefore
incurs only the time costs it needs to. (We pay the space cost of
having all these variants all the time of course, but this cost
is negligible.)
runtime/mercury_tabling_stats_defs.h:
runtime/mercury_tabling_stats_nodefs.h:
runtime/mercury_tabling_stats_undefs.h:
New files that serve as wrappers around the newly #included files,
controlling how they handle statistics.
runtime/mercury_tabling.c:
Delete functions now in the new files, and #include them instead.
Delete the data structures that used to contain summary statistics;
the new approach keeps statistics in compiler-generated,
procedure-specific data structures.
runtime/mercury_trace_base.c:
Use the new versions of the tabling macros to access the I/O table.
runtime/mercury_type_info.h:
Update some documentation for the movement of code out of
mercury_tabling.c.
runtime/mercury_types.h:
Provide forward declarations of the identifiers denoting the new types
in mercury_tabling.h.
runtime/mercury_grade.h:
Increment the exec trace version number, since we have changed
a part of the exec trace structure.
runtime/mercury_bootstrap.h:
Fix some temporary issues that arise from some renames above.
runtime/mercury_hash_lookup_or_add_body.h:
Fix comment.
runtime/Mmakefile:
Mention the new files and the dependencies that involve them.
library/table_builtin.m:
Provide a type for representing statistics and a predicate for
printing statistics.
Use the updated versions of the macros in
runtime/mercury_tabling_preds.h.
compiler/prog_item.m:
Change representation of tabling pragmas to allow room for the new
attributes.
Allow an item to be marked as being generated by the compiler
as a result of a pragma memo attribute. We use this for the reset
and statistics predicates.
compiler/mercury_to_mercury.m:
Write out the new attributes of the tabling pragma.
compiler/prog_data.m:
compiler/hlds_data.m:
Change the cons_id that used to refer to a procedure's call table root
to refer to the entirety of the new data structure now containing it.
The compiler now needs a way to refer to the other components of this
new data structure, since it contains the statistics.
As in the runtime, don't distinguish "strict", "fast_loose" and
"specified" memoing as separate eval methods; treat them as just
different kinds of the same eval method: "memo".
Rename some of the uses of the function symbols "c", "java", "il".
compiler/hlds_pred.m:
Add an extra field in proc_infos for storing any tabling attributes.
Change the existing proc_info field that records information about
the kinds of arguments of tabled procedures to record the information
needed by the debugger too. This was needed to allow us to shift all
the RTTI for procedure-specific tables (as opposed to the RTTI for
the global I/O table) from mercury_stack_layout.h to mercury_tabling.h
without duplicating the data (which would be a maintenance problem).
Reformat some comments to make them easier to read.
compiler/layout.m:
compiler/layout_out.m:
Delete the part of the exec trace information that used to record
RTTI for tables, since this information is not generated only as
part of the debugger data structures anymore.
compiler/prog_io_pragma.m:
Recognize the updated syntax for tabling pragmas.
compiler/add_pragma.m:
When processing tabling pragmas for inclusion in the HLDS, create
any reset and statistics predicates they ask for.
compiler/make_hlds_passes.m:
Export a predicate now needed by add_pragma.m.
Handle the new attributes on tabling pragmas
compiler/globals.m:
Change the function symbols of the types describing backends and
foreign languages to say what they are. Previously, both types (as well
as several others) included the function symbol "c"; now, they are
target_c and lang_c respectively.
compiler/table_gen.m:
Implement the changes described at the top.
When passing around varsets and vartypes, pass the arguments in the
standard order.
compiler/goal_util.m:
compiler/hlds_goal.m:
When passing around varsets and vartypes, pass the arguments in the
standard order.
compiler/rtti.m:
Provide types for representing the runtime's data structures for
tabling (which are now significantly more complex than a single word)
and predicates for manipulating them, for use by both the ml and ll
backends.
compiler/llds.m:
Replace the comp_gen_c_var type with the tabling_info_struct type,
which contains the information needed to create the per-procedure
tabling data structures.
Replace references to call tables with references to the various
components of the new tabling data structures.
compiler/llds_out.m:
Add code to write out tabling_info_structs.
Delete the code required for the old, hacky way of resetting tables.
Reorder some code more logically.
compiler/proc_gen.m:
Generate tabling_info_structs.
compiler/stack_layout.m:
Don't generate the information now generated in proc_gen.m.
compiler/mlds.m:
Give mlds_proc_labels their own function symbols, instead of using
a pair. Rename some other function symbols to avoid ambiguity and add
expressiveness.
Provide for the representation of references to the various components
of the new tabling data structures, and for the representation of their
types.
compiler/ml_code_gen.m:
When generating code for a tabled procedure, generate also the data
structures required for its table.
compiler/rtti_to_mlds.m:
compiler/ml_util.m:
Move some predicates from rtti_to_mlds.m to ml_util.m, since we
now also want to call them from ml_code_gen.m.
compiler/name_mangle.m:
Add some utility predicates.
compiler/options.m:
Delete the old --allow-table-reset option.
Add the new --table-debug option.
Comment out an implementor-only option.
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_trail_ops.m:
compiler/add_type.m:
compiler/bytecode_gen.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/dependency_graph.m:
compiler/det_report.m:
compiler/export.m:
compiler/fact_table.m:
compiler/foreign.m:
compiler/global_data.m:
compiler/globals.m:
compiler/handle_options.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/hlds_out.m:
compiler/inlining.m:
compiler/intermod.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_elim_nested.m:
compiler/ml_optimize.m:
compiler/ml_switch_gen.m:
compiler/ml_tailcall.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/modes.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/proc_label.m:
compiler/prog_data.m:
compiler/prog_foreign.m:
compiler/prog_item.m:
compiler/prog_mutable.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_util.m:
compiler/recompilation.version.m:
compiler/size_prof.m:
compiler/special_pred.m:
compiler/switch_util.m:
compiler/transform_llds.m:
compiler/tupling.m:
compiler/type_ctor_info.m:
compiler/unify_gen.m:
Conform to the changes above, and/or improve some comments.
mdbcomp/prim_data.m:
Make the names of the function symbols of the proc_label type more
expressive and less ambiguous.
mdbcomp/prim_data.m:
mdbcomp/mdbcomp.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/trace_counts.m:
Use . instead of __ as module qualifier.
Conform to the change to prim_data.m.
browser/declarative_execution.m:
browser/declarative_oracle.m:
browser/declarative_tree.m:
Conform the change to mdbcomp/prim_data.m.
tests/debugger/Mercury.options:
Don't specify --allow-table-reset for fib.m, since that option
doesn't exist anymore.
tests/debugger/fib.m:
Use the new mechanism for resetting the table.
tests/debugger/print_table.m:
Use the new syntax for pragma memo attributes.
tests/invalid/specified.{m,err_exp}:
Use to the new syntax and reset method for pragma memo attributes.
Test the handling of errors in the new attribute syntax.
tests/tabling/Mercury.options:
Don't specify --allow-table-reset for specified.m, since that option
doesn't exist anymore.
tests/tabling/specified.m:
Use the new syntax for pragma memo attributes, and use the new
mechanism for resetting tables. We could also use this test case
for testing the printing of statistics, but the format of that
output is still not final.
tests/tabling/fast_loose.m:
Use the new syntax for pragma memo attributes, and use the new
mechanism for resetting tables.
trace/mercury_trace.c:
trace/mercury_trace_cmd_developer.c:
Conform to the changes in the RTTI data structures regarding tabling.
Remove underscores from the names of some types that the style guide
says shouldn't be there.
library/robdd.m:
Comment out the tabling pragma until this change is bootstrapped.
Without this, the conflict between the old calls to macros generated
by the existing compiler and the new definition of those macros
in the runtime would cause errors from the C compiler.
Estimated hours taken: 7
Branches: main, release
Fix the bug with initialisers/finalisers in libraries not being called ( and
as consequence also fixes the bug with mutables not being given their correct
initial value). The problem was that the directives necessary to call them
were not being included in the libraries' .init file.
The fix is to add a new mode of operation to mkinit that given a list of
.c files that make up some Mercury library, constructs the .init file for
that library. In particular, it now constructs the .init file so that
it contains any REQUIRED_{INIT,FINAL} directives needed by the library.
The new mode of operation is invoked when mkinit is given the `-k' option.
Modify the build systems (i.e. mmake and mmc --make) to conform to the
above change.
compiler/modules.m:
Change the rule mmake uses to build .init files so that it calls
mkinit -k on all the .c files generated for the library.
scripts/Mmake.vars.in:
Add a new mmake variable MKLIBINIT. This is the program used to
create .init files. (It will nearly always be mkinit.)
compiler/compile_target_code.m:
Change how .init files are built. We now have to call mkinit -k to
scan all of the .c files to write out the correct set of INIT,
REQUIRED_INIT and REQUIRED_FINAL directives. The code here is
that used by mmc --make for creating the .init files.
compiler/make.program_target.m:
Build the .init file after building the .c files, since building
it before will no longer work.
Estimated hours taken: 18
Branches: main
Move the univ, maybe, pair and unit types from std_util into their own
modules. std_util still contains the general purpose higher-order programming
constructs.
library/std_util.m:
Move univ, maybe, pair and unit (plus any other related types
and procedures) into their own modules.
library/maybe.m:
New module. This contains the maybe and maybe_error types and
the associated procedures.
library/pair.m:
New module. This contains the pair type and associated procedures.
library/unit.m:
New module. This contains the types unit/0 and unit/1.
library/univ.m:
New module. This contains the univ type and associated procedures.
library/library.m:
Add the new modules.
library/private_builtin.m:
Update the declaration of the type_ctor_info struct for univ.
runtime/mercury.h:
Update the declaration for the type_ctor_info struct for univ.
runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
Update the definition of MR_Univ.
runtime/mercury_init.h:
Fix a comment: ML_type_name is now exported from type_desc.m.
compiler/mlds_to_il.m:
Update the the name of the module that defines univs (which are
handled specially by the il code generator.)
library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
Conform to the above changes. Import the new modules where they
are needed; don't import std_util where it isn't needed.
Fix formatting in lots of modules. Delete duplicate module
imports.
tests/*:
Update the test suite to confrom to the above changes.
Estimated hours taken: 6
Branches: main
compiler/*.m:
Convert almost all the compiler modules to use . instead of __ as
the module qualifier.
In some cases, change the names of predicates and types to make them
meaningful without the module qualifier. In particular, most of the
types that used to be referred to with an "mlds__" prefix have been
changed to have a "mlds_" prefix instead of changing the prefix to
"mlds.".
There are no algorithmic changes.
Estimated hours taken: 1.5
Branches: main
Remove residual parts of the Aditi backend that weren't deleted the other day.
configure.in:
Mmake.common.in:
Remove support for enabling the Aditi backend.
runtime/mercury_aditi.h:
Remove this file.
runtime/Mmakefile:
runtime/mercury.h:
runtime/mercury_imp.h:
runtime/mercury_ho_call.[ch]:
runtime/mercury_wrapper.[ch]:
Delete support for Aditi in the runtime.
scripts/Mmake.rules:
scripts/Mmake.vars.in:
scripts/c2init.in:
scripts/parse_ml_options.sh-subr.in:
Remove mmake support for building .rlo files, etc.
util/mkinit.c:
Remove Aditi specific code.
compiler/bytecode_data.m:
compiler/closure_analysis.m:
compiler/code_model.m:
compiler/compile_target_code.m:
compiler/det_analysis.m:
compiler/handle_options.m:
compiler/hlds_goal.m:
compiler/hlds_module.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_error.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/mlds_to_gcc.m:
compiler/modecheck_call.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/options.m:
compiler/prog_data.m:
compiler/prog_foreign.m:
compiler/prog_mode.m:
compiler/prog_type.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/term_errors.m:
compiler/unify_proc.m:
mdbcomp/prim_data.m:
Remove residual support for Aditi.
library/ops.m:
Remove the 'aditi_bottom_up' and 'aditi_top_down' operators from the
ops table.
doc/reference_manual.texi:
doc/user_guide.texi:
Delete the sections on the Aditi interface.
extras/aditi/*:
Delete this.
Estimated hours taken: 2
Branches: main
`mmc --make --use-grade-subdirs <linked-target>' makes symlinks/copies of the
linked target into the current directory, but doesn't do so if the linked
target is already up to date. This patch makes it always make the
symlink/copy, so that it is easy to switch between two or more grades even if
no source files were modified.
compiler/compile_target_code.m:
Separate out the code to make symlinks/copies of linked targets from
the `link' predicate into a predicate `post_link_make_symlink_or_copy'.
Move `shared_libraries_supported' from make.program_target.m into
compile_target_code.m.
compiler/make.program_target.m:
Call `post_link_make_symlink_or_copy' if `--use-grade-subdirs' is
enabled, and the linked target is otherwise up-to-date.
Write out a message in `--verbose-make' mode.
Conform to the move of `shared_libraries_supported'.
compiler/make.util.m:
Add a predicate `maybe_symlink_or_copy_linked_target_message'.
Estimated hours taken: 4
Branches: main
Fix a bug with mmc --make and shared libraries on Darwin. The problem was
that the install_name for the library was being incorrectly set.
compiler/modules.m:
Set the value of the install-name path correctly. If the user doesn't
specify a value then generate one based on the current value of
INSTALL_PREFIX.
compiler/options.m:
Delete the bogus default value for the shlib-linker-install-name-path
option.
compiler/compile_target_code.m:
When linking a shared library on Darwin set the install-name path
correctly, in particular we need to set it to the directory we
are going to install the library in, *not* where the library is
being built.
compiler/make.program_target.m:
Mention that any changes to modules.get_install_name_option need to
be reflected here.
Estimated hours taken: 1
Branches: main
Fix a bug reported by Samrith, which is that some of the files in
benchmarks/progs/icfp2000, e.g. eval.m, got a compiler abort when compiled
with -O0 --optimize-repeat=0 --optimize-saved-vars. This was because
--optimize-saved-vars relied on jump optimization being done, but
--optimize-repeat=0 disables jump optimization.
compiler/handle_options.m:
Make --optimize-repeat at least one if some other optimization
requires the optimizations controlled by --optimize-repeat.
compiler/optimize.m:
compiler/use_local_vars.m:
Rename some predicates to make their unqualified names more meaningful.
Delete unnecessary module qualifications. Switch to using . instead of
__ as module qualifier.
compiler/mercury_compile.m:
Conform to the change to optimize.m.
compiler/modules.m:
Rename a predicate to avoid a confusing overloading.
compiler/compile_target_code.m:
Conform to the change to modules.m.
tests/valid/eval.m:
New test case to check the fix.
tests/valid/Mmakefile:
Enable the new test case.
Estimated hours taken: 8
Branches: main
Fix some problems with `mmc --make'.
compiler/compile_target_code.m:
In `link' predicate, after the file has been created in a grade
subdirectory it would try to symlink or copy the file into the user
directory. This would fail if a file of the same name already existed
there, so remove it before attempting the symlink/copy.
compiler/make.program_target.m:
Prevent `mmc --make libFOO' from trying to produce a shared library
if they are unsupported on the current architecture.
Disable the logic to conditionally generate `.mh' files so as to avoid
trouble with Mmake, which expects them to always exist.
Fix a typo that tried to install `.mih' files into `int' directories
instead of `ints'.
compiler/modules.m:
Make `make_symlink_or_copy_file' write a newline after errors.
Estimated hours taken: 1
Branches: main
Remove support for the --split-c-files option, since it hasn't worked in a
while, we haven't wanted to use it in a while, and the tradeoff of greatly
increased compilation time for a ~10% space gain is an increasingly bad one.
compiler/options.m:
doc/user_guide.texi:
Remove the option.
NEWS:
Mention the removal of the option.
compiler/modules.m:
Remove the references to .split executables and archives from the
generated .d files.
compiler/*.m:
Delete the code for handling --split-c-files=yes, and make whatever
simplifications this makes possible.
scripts/Mmake.*:
Remove the references to .split executables and archives.
scripts/mgnuc.in:
scripts/mgnuc_file_opts.sh-subr:
Remove the references to the --split-c-files option.
tests/hard_coded/split_c_files.{m,split.exp}:
tests/hard_coded/mapped_module.split.exp:
Delete the test cases testing the deleted functionality.
tests/hard_coded/Mmakefile:
Don't test split C files.
Estimated hours taken: 3
Branches: main and 0.12
compiler/compile_target_code.m:
Quote include directories passed to gcc, in case they contain
spaces.
compiler/options.m:
Change the way arguments are quoted on Windows. Using `\' to escape
whitespace doesn't work because `\' is a directory separator on
Windows, instead enclose the argument in quotation marks if it
contains whitespace.
library/io.m:
Fix a comment that had the wrong predicate name.
Estimated hours taken: 4
Branches: main
Various cleanups for the modules in the compiler directory. The are
no changes to algorithms except the replacement of some if-then-elses
that would naturally be switches with switches and the replacement of
most of the calls to error/1.
compiler/*.m:
Convert calls to error/1 to calls to unexpected/2 or sorry/2 as
appropriate throughout most or the compiler.
Fix inaccurate assertion failure messages, e.g. identifying the
assertion failure as taking place in the wrong module.
Add :- end_module declarations.
Fix formatting problems and bring the positioning of comments
into line with our current coding standards.
Fix some overlong lines.
Convert some more modules to 4-space indentation. Fix some spots
where previous conversions to 4-space indentation have stuffed
the formatting of the code up.
Fix a bunch of typos in comments.
Use state variables in more places; use library predicates
from the sv* modules where appropriate.
Delete unnecessary and duplicate module imports.
Misc. other small cleanups.
Estimated hours taken: 8
Branches: main
Improve the error messages generated for determinism errors involving committed
choice contexts. Previously, we printed a message to the effect that e.g.
a cc pred is called in context that requires all solutions, but we didn't say
*why* the context requires all solutions. We now keep track of all the goals
to the right that could fail, since it is these goals that may reject the first
solution of a committed choice goal.
The motivation for this diff was the fact that I found that locating the
failing goal can be very difficult if the conjunction to the right is
a couple of hundred lines long. This would have been a nontrivial problem,
since (a) unifications involving values of user-defined types are committed
choice goals, and (b) we can expect uses of user-defined types to increase.
compiler/det_analysis.m:
Keep track of goals to the right of the current goal that could fail,
and include them in the error representation if required.
compiler/det_report.m:
Include the list of failing goals to the right in the representations
of determinism errors involving committed committed choice goals.
Convert the last part of this module that wasn't using error_util
to use error_util. Make most parts of this module just construct
error message specifications; print those specifications (using
error_util) in only a few places.
compiler/hlds_out.m:
Add a function for use by the new code in det_report.m.
compiler/error_util.m:
Add a function for use by the new code in det_report.m.
compiler/error_util.m:
compiler/compiler_util.m:
Error_util is still changing reasonably often, and yet it is
included in lots of modules, most of which need only a few simple
non-parse-tree-related predicates from it (e.g. unexpected).
Move those predicates to a new module, compiler_util.m. This also
eliminates some undesirable dependencies from libs to parse_tree.
compiler/libs.m:
Include compiler_util.m.
compiler/notes/compiler_design.html:
Document compiler_util.m, and fix the documentation of some other
modules.
compiler/*.m:
Import compiler_util instead of or in addition to error_util.
To make this easier, consistently use . instead of __ for module
qualifying module names.
tests/invalid/det_errors_cc.{m,err_exp}:
Add this new test case to test the error messages for cc contexts.
tests/invalid/det_errors_deet.{m,err_exp}:
Add this new test case to test the error messages for unifications
inside function symbols.
tests/invalid/Mmakefile:
Add the new test cases.
tests/invalid/det_errors.err_exp:
tests/invalid/magicbox.err_exp:
Change the expected output to conform to the change in det_report.m,
which is now more consistent.
Estimated hours taken: 1
Branches: main and 0.12
Remove the architecture string from the installed directory structure
and put the executables in $PREFIX/bin, instead of
$PREFIX/lib/mercury/bin/$FULLARCH.
The reason for this change is to reduce the need for unix shell scripts in
the top-level bin directory that call the actual programs in the
lib/mercury/bin/FULLARCH directory. The unix scripts can't be run on Windows
without a unix emulation environment like Cygwin.
Because the executables are now in the top-level bin directory, we cannot
install multiple architectures under the same directory structure. However
this is not a real loss, since the binaries for different architectures can
just be installed to different locations, as we currently do anyway on
mundula.cs.mu.oz.au.
The plan is to rename mercury_compile to mmc and do away with the mmc unix
script. This will allow mmc to be run on Windows without Cygwin or MSYS.
This proposal replaces a previous proposal to implement a C version of the
mmc script. That solution turned out to be quite complicated and
unreliable.
This diff will also mean mdice, mslice and mtc_union will be in the same
directory as mmc, so will be in the PATH as long as mmc is in the PATH.
configure.in:
bindist/Mmakefile:
bindist/bindist.Makefile.in:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/make.program_target.m:
debian/rules:
library/Mmakefile:
scripts/Mmake.vars.in:
scripts/mdprof.in:
scripts/mercury.bat.in:
scripts/mgnuc.in:
scripts/ml.in:
scripts/mmc.in:
scripts/mprof.in:
tools/run_all_tests_from_cron:
tools/test_mercury:
Remove FULLARCH from the installed directory structure.
Install executables to the top-level bin directory.
Estimated hours taken: 8
Branches: main
compiler/*.m:
Rename the types 'type', 'inst' and 'mode' to 'mer_type', 'mer_inst'
and 'mer_mode'. This is to avoid the need to parenthesize these type
names in some contexts, and to prepare for the possibility of a parser
that considers those words to be reserved words.
Rename some other uses of those names (e.g. as item types in
recompilation.m).
Delete some redundant synonyms (prog_type, mercury_type) for mer_type.
Change some type names (e.g. mlds__type) and predicate names (e.g.
deforest__goal) to make them unique even without module qualification.
Rename the function symbols (e.g. pure, &) that need to be renamed
to avoid the need to parenthesize them. Make their replacement names
more expressive.
Convert some more modules to four space indentation.
Avoid excessively long lines, such as those resulting from the
automatic substitution of 'mer_type' for 'type'.
Estimated hours taken: 4
Branches: main
compiler/*.m:
Convert a bunch of modules to four-space indentation.
In the process, fix departures from our coding standards.
In some cases, do minor other cleanups such as changing argument orders
to be friendly to state variables.
There are no algorithmic changes.
Estimated hours taken: 24
Branches: main
Introduce a mechanism for extending the det and nondet stacks when needed.
The mechanism takes the form of a new grade component, .exts ("extend stacks").
While the new mechanism may be useful in its own right, it is intended mainly
to support a new implementation of minimal model tabling, which will use a
separate Mercury context for each distinct subgoal. Each context has its own
det and nondet stack. Clearly, we can't have hundreds of contexts each with
megabyte sized det stacks. The intention is that the stacks of the subgoals
will start small, and be expanded when needed.
The runtime expansion of stacks doesn't work yet, but it is unnecessarily
hard to debug without an installed compiler that understands the new grade
component, which is why this diff will be committed before that is fixed.
compiler/handle_options.m:
compiler/options.m:
runtime/mercury_grade.h:
scripts/canonical_grade.sh-subr
scripts/init_grade_options.sh-subr
scripts/parse_grade_options.sh-subr
scripts/mgnuc.in
Handle the new grade component.
runtime/mercury_memory_zones.h:
Add MR_ prefixes to the names of the fields of the zone structure.
Record not just the actual size of each zone, which includes various
kinds of buffers, but also the desired size of the zone exclusive of
buffers.
Format the documentation of the zone structure fields more
comprehensibly.
runtime/mercury_memory_zones.c:
Instead of implementing memalign if it is not provided by the operating
system, implement a function that allows us to reallocate the returned
area of memory.
Provide a prototype implementation of memory zone extension. It doesn't
work yet.
Factor out the code for setting up redzones, since it is now needed
in more than place.
Convert to four space indentation.
Make the debugging functions a bit more flexible.
runtime/mercury_wrapper.c:
Conform to the improved interface of the debugging functions.
runtime/mercury_overflow.h:
runtime/mercury_std.h:
Move a generally useful macro from mercury_overflow.h to mercury_std.h.
runtime/mercury_stacks.c:
Add functions to extend the stacks.
runtime/mercury_stacks.h:
Add the tests required to invoke the functions that extend the stacks.
Add the macros needed by the change to compiler/llds.m.
Convert to four space indentation.
runtime/mercury_conf.h.in:
Prepare for the use of the posix_memalign function, which is the
current replacement of the obsolete memalign library function.
We don't yet use it.
runtime/mercury_context.h:
Format the documentation of the context structure fields more
comprehensibly.
Put MR_ prefixes on the names of the fields of some structures
that didn't previously have them.
Conform to the new names of the fields of the zone structure.
runtime/mercury_context.c:
runtime/mercury_debug.c:
runtime/mercury_deep_copy.c:
runtime/mercury_engine.c:
runtime/mercury_memory_handlers.c:
library/benchmarking.m:
library/exception.m:
Conform to the new names of the fields of the zone structure.
In some cases, add missing MR_ prefixes to function names
and/or convert to four space indentation.
runtime/mercury_engine.h:
Add a new low level debug flag for debugging stack extensions.
Format the documentation of the engine structure fields more
comprehensibly.
Convert to four space indentation.
runtime/mercury_conf_param.h:
Document a new low level debug flag for debugging stack extensions.
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/options.m:
Handle the new grade component.
compiler/llds.m:
Add two new kinds of LLDS instructions, save_maxfr and restore_maxfr.
These are needed because the nondet stack may be relocated between
saving and the restoring of maxfr, and the saved maxfr may point to
the old stack. In .exts grades, these instructions will save not a
pointer but the offset of maxfr from the start of the nondet stack,
since offsets are not affected by the movement of the nondet stack.
compiler/code_info.m:
Use the new instructions where relevant. (Some more work may be
needed on this score; the relevant places are marked with XXX.)
compiler/dupelim.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/jumpopt.m:
compiler/livemap.m:
compiler/llds_out.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/reassign.m:
compiler/use_local_vars.m:
Handle the new LLDS instructions.
tools/bootcheck:
Provide a mechanism for setting the initial stack sizes for a
bootcheck.
Estimated hours taken: 1
Branches: main and 0.12
Work around an incompatibility between the C code generated by the Mercury
compiler which uses global registers and the -floop-optimize gcc option on
Darwin PowerPC architectures.
compiler/compile_target_code.m:
scripts/mgnuc.in:
Disable the -floop-optimize optimization when using global registers
in an LLDS grade on Darwin PowerPC.
Estimated hours taken: 3
Branches: main
compiler/*.m:
Import only one module per line in the modules of the compiler
where my previous diff did not already do so.
Misc other cleanups.
Where relevant, use the new mechanism in tree.m.
compiler/tree.m:
Fix a performance problem I noticed while update :- import_module
items. Instead of supplying a function to convert lists of trees
to a tree, make the tree data structure able to hold a list of
subtrees directly. This reduces the number of times where we have to
convert list of trees to trees that are sticks just to stay within
the old definition of what a tree is.
Estimated hours taken: 3.5
Branches: main
Simplify the structure of the compiler by removing the cycle
parse_tree -> backend_libs -> check_hlds -> parse_tree
from the package dependency graph.
I've done this by factoring out the code in backend_libs.foreign
and backend_libs.name_mangle that is needed by the frontend of
the compiler and putting it in a new module, parse_tree.prog_foreign.
This removes the dependency between the parse_tree and backend_libs
packages.
The obvious downside to this is that the name mangler is now
split in two, although such a division was always in implicit
in the predicates of the name_mangle module anyway, ie. between
those bits that operate on the HLDS/MLDS/LLDS level data structures
and those that don't.
compiler/name_mangle.m:
compiler/foreign.m:
compiler/prog_foreign.m:
Move code for dealing with foreign language procedures that
is required by the parse_tree package into a new module,
prog_foreign.
Update the formatting in some of these modules so that
they match our current coding standard.
compiler/*.m:
Update to reflect the above change.
compiler/notes/compiler_design.html:
Include the new module.
Fix some spelling errors.