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: 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
Branches: main, version-0_12-branch
library/array.m:
library/array2d.m:
library/assoc_list.m:
library/bag.m:
library/benchmarking.m:
library/bimap.m:
library/bintree_set.m:
library/bitmap.m:
library/bool.m:
library/builtin.m:
library/cord.m:
library/float.m:
library/graph.m:
library/group.m:
library/hash_table.m:
library/int.m:
library/lexer.m:
library/list.m:
library/map.m:
library/math.m:
library/multi_map.m:
library/ops.m:
library/parser.m:
library/rbtree.m:
library/set.m:
library/stack.m:
library/store.m:
library/string.m:
library/time.m:
Minor reformatting; added some renamed preds and funcs to improve
consistency of naming in the library; removed some preds and types that
have been marked obsolete since 0.11.
Estimated hours taken: 200
Branches: main
Allow Aditi to call Mercury. At the moment, this involves Aditi
loading a shared library containing the user's code.
runtime/mercury_aditi.h:
Define a structure MR_Aditi_Proc_Info used to describe
a procedure called by Aditi. Aditi will use dlsym() to
look up these structures in the shared library supplied
by the user.
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/ml_code_util.m:
compiler/mlds_to_gcc.m:
compiler/opt_debug.m:
Add an aditi_proc_info alternative to the rtti_data type,
which corresponds to an MR_AditiProcInfo structure in
the generated code.
In the rtti_proc_label type, record the determinism rather
than the code_model for use by Aditi.
compiler/options.m:
doc/user_guide.texi:
Add an option `--aditi-calls-mercury'.
This is needed for the Aditi tests, which currently don't
handle loading the shared libraries for user defined code.
Move `--aditi' into the compilation model options section.
compiler/rl.m:
Sort the constructors for d.u. types when creating an Aditi
type declaration to make it easier to find a particular
constructor.
compiler/code_model.m:
compiler/stack_layout.m:
Move represent_determinism into code_model.m, for use
by rtti_to_mlds.m.
compiler/rl_exprn.m:
compiler/rl_file.pp:
compiler/rl_out.pp:
compiler/hlds_module.m:
compiler/mercury_compile.m:
Create the procedures for each top-down Mercury goal which
needs to be called from Aditi.
Each created procedure has one input and one output argument,
both of which will have a `{}/N' type.
Allow nondet join conditions.
compiler/rl_exprn.m:
Use record syntax.
compiler/rl_out.pp:
Minor changes to the support for memoing.
runtime/Mmakefile:
runtime/mercury_imp.h:
runtime/mercury.h:
Add mercury_aditi.h.
runtime/mercury_stack_layout.m:
Add a comment about the duplication between MR_DETISM_*
and code_model.represent_determinism.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/aditi_calls_mercury.m:
Test case.
Also, enable the Aditi tests in hlc grades.
Estimated hours taken: 4
Branches: main
This diff contains no changes in algorithms whatsoever.
browser/*.m:
compiler/*.m:
library/*.m:
Replace old-style lambdas with new-style lambdas or with named
procedures.
Estimated hours taken: 0.25
Branches: main
compiler/fact_table.m:
compiler/mercury_to_mercury.m:
compiler/rl_file.pp:
Add some more XXX comments about places which may be assuming
8-bit characters.
The main aim of this change is to make the overall, high-level structure
of the compiler clearer, and to encourage better encapsulation of the
major components.
compiler/libs.m:
compiler/backend_libs.m:
compiler/parse_tree.m:
compiler/hlds.m:
compiler/check_hlds.m:
compiler/transform_hlds.m:
compiler/bytecode_backend.m:
compiler/aditi_backend.m:
compiler/ml_backend.m:
compiler/ll_backend.m:
compiler/top_level.m:
New files. One module for each of the major components of the
Mercury compiler. These modules contain (as separate sub-modules)
all the other modules in the Mercury compiler, except gcc.m and
mlds_to_gcc.m.
Mmakefile:
compiler/Mmakefile:
Handle the fact that the top-level module is now `top_level',
not `mercury_compile' (since `mercury_compile' is a sub-module
of `top_level').
compiler/Mmakefile:
Update settings of *FLAGS-<modulename> to use the appropriate
nested module names.
compiler/recompilation_check.m:
compiler/recompilation_version.m:
compiler/recompilation_usage.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/recompilation.version.m:
Convert the `recompilation_*' modules into sub-modules of the
`recompilation' module.
compiler/*.m:
compiler/*.pp:
Module-qualify the module names in `:- module', `:- import_module',
and `:- use_module' declarations.
compiler/base_type_info.m:
compiler/base_type_layout.m:
Deleted these unused empty modules.
compiler/prog_data.m:
compiler/globals.m:
Move the `foreign_language' type from prog_data to globals.
compiler/mlds.m:
compiler/ml_util.m:
compiler/mlds_to_il.m:
Import `globals', for `foreign_language'.
Mmake.common.in:
trace/Mmakefile:
runtime/Mmakefile:
Rename the %.check.c targets as %.check_hdr.c,
to avoid conflicts with compiler/recompilation.check.c.
Estimated hours taken: 0.1
Improve the readability of the compiler-generated `.rla' files,
which contain a human-readable version of the Aditi-RL bytecode
for a module.
compiler/rl_file.pp:
Make control flow and materialise instructions stand
out in `.rla' files by indenting them less than the
other instructions.
Estimated hours taken: 3
Preprocess mercury_compile.m and rl_file.m to remove dependencies
on rl_code.m. This is done to avoid major mode analysis efficiency
problems on the alias branch.
Mmake.common.in:
Include the Aditi support by default.
compiler/Mmakefile:
Add rules to process `.pp' files.
compiler/rl_out.pp:
compiler/rl_file.pp:
Add preprocessing to remove dependencies on rl_code.m.
compiler/rl_out.m:
compiler/rl_file.m:
Removed.
compiler/rl_out.m:
compiler/rl.m:
compiler/rl_gen.m:
compiler/magic.m:
Move the code to convert schemas to strings into rl.m,
since these are not just used for RL output.