Estimated hours taken: 10
Fix the remaining bugs with the handling of partial qualifiers
for nested modules.
compiler/module_qual.m:
Define a new abstract type partial_qualifier_info, and a predicate
mq_info_get_partial_qualifier_info to get this type from the mq_info.
Define a new predicate get_partial_qualifiers/3 in module_qual.m
which is like the old get_partial_qualifiers/2 predicate from
modules.m except that it takes a partial_qualifier_info and
uses the information in this to return only the partial qualifiers
for modules which are visible, rather than returning all partial
qualifier regardless of whether the modules that they refer to
are in scope or not.
compiler/prog_util.m:
Export the `insert_module_qualifier' predicate, for use in the
definition of get_partial_qualifiers/3.
compiler/hlds_module.m:
compiler/make_hlds.m:
Change the code for make_hlds__ctors_add and
hlds_module__pred_table_insert/5 so that they handles partial
qualifiers properly, computing the partial qualifiers by
calling get_partial_qualifiers/3 rather than by checking the
NeedQual variable and calling get_partial_qualifiers/2.
compiler/modules.m:
Delete the old get_partial_qualifiers/2 predicate.
compiler/hlds_module.m:
Add a new field to the HLDS containing the partial_qualifier_info.
Add a partial_qualifier_info parameter to pred_table_insert/5.
compiler/check_typeclass.m:
compiler/make_hlds.m:
When calling pred_table_insert/5, get the partial_qualifier_info
from the HLDS and pass it as an extra argument.
tests/hard_coded/sub-modules/nested.m:
tests/hard_coded/sub-modules/nested3.m:
tests/hard_coded/sub-modules/parent.m:
tests/hard_coded/sub-modules/nested.exp:
tests/hard_coded/sub-modules/nested3.exp:
tests/hard_coded/sub-modules/parent.exp:
Uncomment parts of these test cases which were previously
commented out because they were not yet supported.
doc/reference_manual.texi:
Delete the description of this bug.
Estimated hours taken: 0.25
compiler/unique_modes.m:
The argument offset for higher-order calls was being set
to 0, not 1 (the higher-order term is not included in
the argument list). This resulted in the argument numbers
in error messages for higher-order calls being one less
than expected.
tests/invalid/Mmakefile:
tests/invalid/ho_unique_error.m:
tests/invalid/ho_unique_error.err_exp:
Test case.
Estimated hours taken: 0.1
compiler/post_typecheck.m:
Fix a cut and paste error - `aditi_modify' goals were
being transformed into `aditi_delete' goals.
tests/invalid/aditi_update_mode_errors.m:
Fix the expected output.
Estimated hours taken: 8
Record in which predicate an assertion is used.
compiler/accumulator.m:
compiler/lambda.m:
compiler/magic.m:
Initialise the assertions field in the new pred_info.
compiler/assertion.m:
An abstract interface to the assertion table (hopefully).
compiler/hlds_data.m:
Modify assertion_table_add_assertion to return the assert_id of the
inserted assertion.
compiler/hlds_pred.m:
Record in the pred_info the set of assertions that mention the pred.
compiler/post_typecheck.m:
Now record which predicates are used in assertions.
compiler/notes/compiler_design.html:
Document assertion.m
Estimated hours taken: 8
Record in which predicate an assertion is used.
compiler/accumulator.m:
compiler/lambda.m:
compiler/magic.m:
Initialise the assertions field in the new pred_info.
compiler/assertion.m:
An abstract interface to the assertion table (hopefully).
compiler/hlds_data.m:
Modify assertion_table_add_assertion to return the assert_id of the
inserted assertion.
compiler/hlds_pred.m:
Record in the pred_info the set of assertions that mention the pred.
compiler/post_typecheck.m:
Now record which predicates are used in assertions.
compiler/notes/compiler_design.html:
Document assertion.m
Estimated hours taken: 220
Aditi update syntax, type and mode checking.
Change the hlds_goal for constructions in preparation for
structure reuse to avoid making multiple conflicting changes.
compiler/hlds_goal.m:
Merge `higher_order_call' and `class_method_call' into a single
`generic_call' goal type. This also has alternatives for the
various Aditi builtins for which type declarations can't
be written.
Remove the argument types field from higher-order/class method calls.
It wasn't used often, and wasn't updated by optimizations
such as inlining. The types can be obtained from the vartypes
field of the proc_info.
Add a `lambda_eval_method' field to lambda_goals.
Add a field to constructions to identify which RL code fragment should
be used for an top-down Aditi closure.
Add fields to constructions to hold structure reuse information.
This is currently ignored -- the changes to implement structure
reuse will be committed to the alias branch.
This is included here to avoid lots of CVS conflicts caused by
changing the definition of `hlds_goal' twice.
Add a field to `some' goals to specify whether the quantification
can be removed. This is used to make it easier to ensure that
indexes are used for updates.
Add a field to lambda_goals to describe whether the modes were
guessed by the compiler and may need fixing up after typechecking
works out the argument types.
Add predicate `hlds_goal__generic_call_id' to work out a call_id
for a generic call for use in error messages.
compiler/purity.m:
compiler/post_typecheck.m:
Fill in the modes of Aditi builtin calls and closure constructions.
This needs to know which are the `aditi__state' arguments, so
it must be done after typechecking.
compiler/prog_data.m:
Added `:- type sym_name_and_arity ---> sym_name/arity'.
Add a type `lambda_eval_method', which describes how a closure
is to be executed. The alternatives are normal Mercury execution,
bottom-up execution by Aditi and top-down execution by Aditi.
compiler/prog_out.m:
Add predicate `prog_out__write_sym_name_and_arity', which
replaces duplicated inline code in a few places.
compiler/hlds_data.m:
Add a `lambda_eval_method' field to `pred_const' cons_ids and
`pred_closure_tag' cons_tags.
compiler/hlds_pred.m:
Remove type `pred_call_id', replace it with type `simple_call_id',
which combines a `pred_or_func' and a `sym_name_and_arity'.
Add a type `call_id' which describes all the different types of call,
including normal calls, higher-order and class-method calls
and Aditi builtins.
Add `aditi_top_down' to the type `marker'.
Remove `aditi_interface' from type `marker'. Interfacing to
Aditi predicates is now handled by `generic_call' hlds_goals.
Add a type `rl_exprn_id' which identifies a predicate to
be executed top-down by Aditi.
Add a `maybe(rl_exprn_id)' field to type `proc_info'.
Add predicate `adjust_func_arity' to convert between the arity
of a function to its arity as a predicate.
Add predicates `get_state_args' and `get_state_args_det' to
extract the DCG state arguments from an argument list.
Add predicate `pred_info_get_call_id' to get a `simple_call_id'
for a predicate for use in error messages.
compiler/hlds_out.m:
Write the new representation for call_ids.
Add a predicate `hlds_out__write_call_arg_id' which
replaces similar code in mode_errors.m and typecheck.m.
compiler/prog_io_goal.m:
Add support for `aditi_bottom_up' and `aditi_top_down' annotations
on pred expressions.
compiler/prog_io_util.m:
compiler/prog_io_pragma.m:
Add predicates
- `prog_io_util:parse_name_and_arity' to parse `SymName/Arity'
(moved from prog_io_pragma.m).
- `prog_io_util:parse_pred_or_func_name_and_arity to parse
`pred SymName/Arity' or `func SymName/Arity'.
- `prog_io_util:parse_pred_or_func_and_args' to parse terms resembling
a clause head (moved from prog_io_pragma.m).
compiler/type_util.m:
Add support for `aditi_bottom_up' and `aditi_top_down' annotations
on higher-order types.
Add predicates `construct_higher_order_type',
`construct_higher_order_pred_type' and
`construct_higher_order_func_type' to avoid some code duplication.
compiler/mode_util.m:
Add predicate `unused_mode/1', which returns `builtin:unused'.
Add functions `aditi_di_mode/0', `aditi_ui_mode/0' and
`aditi_uo_mode/0' which return `in', `in', and `out', but will
be changed to return `di', `ui' and `uo' when alias tracking
is implemented.
compiler/goal_util.m:
Add predicate `goal_util__generic_call_vars' which returns
any arguments to a generic_call which are not in the argument list,
for example the closure passed to a higher-order call or
the typeclass_info for a class method call.
compiler/llds.m:
compiler/exprn_aux.m:
compiler/dupelim.m:
compiler/llds_out.m:
compiler/opt_debug.m:
Add builtin labels for the Aditi update operations.
compiler/hlds_module.m:
Add predicate predicate_table_search_pf_sym, used for finding
possible matches for a call with the wrong number of arguments.
compiler/intermod.m:
Don't write predicates which build `aditi_top_down' goals,
because there is currently no way to tell importing modules
which RL code fragment to use.
compiler/simplify.m:
Obey the `cannot_remove' field of explicit quantification goals.
compiler/make_hlds.m:
Parse Aditi updates.
Don't typecheck clauses for which syntax errors in Aditi updates
are found - this avoids spurious "undefined predicate `aditi_insert/3'"
errors.
Factor out some common code to handle terms of the form `Head :- Body'.
Factor out common code in the handling of pred and func expressions.
compiler/typecheck.m:
Typecheck Aditi builtins.
Allow the argument types of matching predicates to be adjusted
when typechecking the higher-order arguments of Aditi builtins.
Change `typecheck__resolve_pred_overloading' to take a list of
argument types rather than a `map(var, type)' and a list of
arguments to allow a transformation to be performed on the
argument types before passing them.
compiler/error_util.m:
Move the part of `report_error_num_args' which writes
"wrong number of arguments (<x>; expected <y>)" from
typecheck.m for use by make_hlds.m when reporting errors
for Aditi builtins.
compiler/modes.m:
compiler/unique_modes.m:
compiler/modecheck_call.m:
Modecheck Aditi builtins.
compiler/lambda.m:
Handle the markers for predicates introduced for
`aditi_top_down' and `aditi_bottom_up' lambda expressions.
compiler/polymorphism.m:
Add extra type_infos to `aditi_insert' calls
describing the tuple to insert.
compiler/call_gen.m:
Generate code for Aditi builtins.
compiler/unify_gen.m:
compiler/bytecode_gen.m:
Abort on `aditi_top_down' and `aditi_bottom_up' lambda
expressions - code generation for them is not yet implemented.
compiler/magic.m:
Use the `aditi_call' generic_call rather than create
a new procedure for each Aditi predicate called from C.
compiler/rl_out.pp:
compiler/rl_gen.m:
compiler/rl.m:
Move some utility code used by magic.m and call_gen.m into rl.m.
Remove an XXX comment about reference counting being not yet
implemented - Evan has fixed that.
library/ops.m:
compiler/mercury_to_mercury.m:
doc/transition_guide.texi:
Add unary prefix operators `aditi_bottom_up' and `aditi_top_down',
used as qualifiers on lambda expressions.
Add infix operator `==>' to separate the tuples in an
`aditi_modify' call.
compiler/follow_vars.m:
Thread a `map(prog_var, type)' through, needed because
type information is no longer held in higher-order call goals.
compiler/table_gen.m:
Use the `make_*_construction' predicates in hlds_goal.m
to construct constants.
compiler/*.m:
Trivial changes to add extra fields to hlds_goal structures.
doc/reference_manual.texi:
Document Aditi updates.
Use @samp{pragma base_relation} instead of
@samp{:- pragma base_relation} throughout the Aditi documentation
to be consistent with other parts of the reference manual.
tests/valid/Mmakefile:
tests/valid/aditi_update.m:
tests/valid/aditi.m:
Test case.
tests/valid/Mmakefile:
Remove some hard-coded --intermodule-optimization rules which are
no longer needed because `mmake depend' is now run in this directory.
tests/invalid/*.err_exp:
Fix expected output for changes in reporting of call_ids
in typecheck.m.
tests/invalid/Mmakefile
tests/invalid/aditi_update_errors.{m,err_exp}:
tests/invalid/aditi_update_mode_errors.{m,err_exp}:
Test error messages for Aditi updates.
tests/valid/aditi.m:
tests/invalid/aditi.m:
Cut down version of extras/aditi/aditi.m to provide basic declarations
for Aditi compilation such as `aditi__state' and the modes
`aditi_di', `aditi_uo' and `aditi_ui'. Installing extras/aditi/aditi.m
somewhere would remove the need for these.
Estimated hours taken: 0.1
compiler/passes_aux.m:
Add a version of process_all_nonimported_nonaditi_procs
which takes and returns a piece of user data. This will
be used in the pass to perform optimization of updates.
Estimated hours taken: 0.2
compiler/rl_code.m:
compiler/bytecode_data.m:
Move code to convert a string to a list of bytes from
rl_code.m to be near similar code for ints and floats
in bytecode_data.m.
Remove some unnecessary module imports.
Estimated hours taken: 4
Fix some of the bugs with the handling of partial qualifiers
for nested modules. With this change, we now handle partial
qualifiers correctly for types, insts, modes, and type classes,
which are handled by module_qual.m. We still don't get it quite
right for constructors, functions, and predicates, for which
module qualification is handled by other modules (make_hlds.m,
hlds_module.m, typecheck.m, post_typecheck.m, and modecheck_unify.m).
compiler/module_qual.m:
Keep track of which modules are visible.
When looking up a qualified symbol, check that the specified module
is visible.
tests/hard_coded/sub-modules/nested.m:
tests/hard_coded/sub-modules/nested3.m:
tests/hard_coded/sub-modules/parent.m:
Uncomment parts of these test cases which were previously
commented out because they were not yet supported.
Estimated hours taken: 2
More changes to reduce the complexity of the intermodule dependencies.
compiler/module_qual.m:
Some minor changes to avoid the need to import hlds*.m.
This module acts on the parse tree, not the HLDS, so we
shouldn't import hlds*.m here.
compiler/modules.m:
compiler/prog_io.m:
compiler/det_analysis.m:
Delete some unnecessary imports.
compiler/equiv_type.m:
compiler/dependency_graph.m:
Add some XXX comments about unwanted intermodule dependencies.
Estimated hours taken: 4
Some more changes to minimize the complexity of the intermodule dependencies.
In particular, ensure that hlds_module.m does not need to import llds.m.
compiler/hlds_module.m:
compiler/llds.m:
Move the definition of the c_interface_info type (and the types
used for all its fields) from llds.m into hlds_module.m, since
this type contains high-level information about the user-level
C interface stuff that is not directly related to the LLDS and
is needed by other back-ends.
compiler/hlds_module.m:
compiler/llds.m:
compiler/mercury_compile.m:
compiler/code_gen.m:
compiler/stack_layout.m:
compiler/table_gen.m:
Move the `global_data' type from hlds_module.m into llds.m,
since this type contains low-level stuff that is dependent on
the LLDS. Delete the `global_data' field of the module_info,
instead passing it around as a separate argument where needed.
Move the code for inserting llds__tabling_pointer_vars into the
global_data from table_gen.m to code_gen.m, since this is
dependent on the LLDS and table_gen.m should be a pure
HLDS->HLDS transformation, so that it can work with other
back-ends.
compiler/continuation_info.m:
Update some comments which this change makes obsolete.
compiler/optimize.m:
Delete the import of module hlds_data, since it is no longer needed.
Estimated hours taken: 2
compiler/mlds.m:
Eliminate dependencies on llds.m, by duplicating the definitions
of a few types (`tag', `base_data', and `reset_trail_reason').
Rename the instruction for doing memory allocation from
`incr_hp' to `new_object', and rework its argument types
(the original definition was cut-and-paste from llds.m
that had not had much thought invested in it).
Delete the `create' rval -- the code generator should use
`new_object' instead.
Estimated hours taken: 0.25
Fix some compilation errors that were introduced in my last change.
The errors were ambiguities in mercury_compile.m caused by names defined
in mlds.m being the same as those defined in other modules.
compiler/mercury_compile.m:
s/label/llds__label/
compiler/mlds.m:
s/mlds__module_name/mlds_module_name/g
Estimated hours taken: 0.1
compiler/mlds.m:
Add import of module `builtin_ops'. (This should have been
part of my recent change which added `builtin_ops.m', but I
forgot to modify this file as part of that change.)
compiler/mercury_compile.m:
Add import of mlds.m, to ensure that it will get compiled,
so as to avoid problems like the one above in future.
Estimated hours taken: 2.5
Some more changes to minimize the complexity of the intermodule dependencies.
In particular, ensure that bytecode.m does not need to import llds.m.
compiler/llds.m:
compiler/builtin_ops.m:
Move the definitions of the unary_op and binary_op types into
a new module `builtin_ops'. These types are used by three of the
different back-ends (bytecode, llds, and mlds) and therefore deserve
to be in their own module.
compiler/bytecode.m:
Define a type `byte_reg_type' and use that instead of llds__reg_type.
Delete the import of module llds.
compiler/notes/compiler_design.html:
Document the new module builtin_ops.
compiler/rl_exprn.m:
Add a comment explaining why we need to import llds (and builtin_ops).
compiler/base_type_layout.m:
compiler/bytecode.m:
compiler/code_util.m:
compiler/dense_switch.m:
compiler/ite_gen.m:
compiler/jumpopt.m:
compiler/llds_out.m:
compiler/lookup_switch.m:
compiler/middle_rec.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/rl_exprn.m:
compiler/string_switch.m:
compiler/tag_switch.m:
compiler/transform_llds.m:
compiler/unify_gen.m:
compiler/value_number.m:
compiler/vn_block.m:
compiler/vn_cost.m:
compiler/vn_flush.m:
compiler/vn_type.m:
compiler/vn_util.m:
compiler/vn_verify.m:
Add imports of module builtin_ops to lots of modules that
imported llds.
Estimated hours taken: 2
compiler/typecheck.m:
Set the head_type_params field of class methods properly. (ie. add
the existentially quantified tvars as well).
compiler/hard_coded/typeclasses/typeclass_exist_method.m:
A test case for this.
compiler/hard_coded/typeclasses/Mmakefile:
Turn this test case on.
Estimated hours taken: 1
Add two new mmake targets, clean_local and realclean_local, which
are the same as clean and realclean except that the former retain their
original meanings if rules are added to the latter. This is useful
if users want to add rules for a recursive mmake clean.
compiler/modules.m:
Output `clean_local: module.clean' to generated .dep files
instead of `clean: module.clean'. Same for `realclean'.
scripts/Mmake.rules:
Add dependencies to implement the original targets in terms of
the new targets.
Estimated hours taken: 0.25
Add the infrastructure for assertions into the compiler.
compiler/notes/compiler_design.html:
Update documentation about exactly where quantification is done.
compiler/notes/glossary.html:
Define what an assertion is.
Estimated hours taken: 50
Add the infrastructure for assertions into the compiler.
compiler/error_util.m:
Output the correct pred name for assertions.
compiler/hlds_data.m:
Add the assertion_table structure.
compiler/hlds_module.m:
Get/set the assertion_table from the module_info.
compiler/hlds_out.m:
Modify hlds_out__write_pred_id to identify assertions.
compiler/hlds_pred.m:
Add the goal_type assertion.
compiler/make_hlds.m:
Transform the assertion to a HLDS data structure that can be
typechecked.
compiler/mercury_to_goedel.m:
compiler/module_qual.m:
Handle the assertion structure.
compiler/mercury_to_mercury.m:
Output assertions.
compiler/post_typecheck.m:
Add a predicate which must be called after typechecking of
assertions has been finished. Also document some possible problems
with typechecking assertions.
compiler/prog_data.m:
Add assertion to the type item.
compiler/prog_io.m:
Add the ability to parse assertions.
compiler/purity.m:
After finished typechecking assertions call
post_typecheck__finish_assertion.
compiler/typecheck.m:
Don't output inference messages for assertions.
compiler/notes/compiler_design.html:
Update documentation about exactly where quantification is done.
compiler/notes/glossary.html:
Define what an assertion is.
Estimated hours taken: 0.25
compiler/typecheck.m:
Do special error-handling for if-then-else in DCGs in the same
way that we currently do for ordinary (non-DCG) if-then-elses.
Estimated hours taken: 24
compiler/mlds.m:
New module -- the "Medium Level Data Structure".
This module will eventually be used as the basis of a
new back-end for the Mercury compiler that generates
code at a higher lever than the current back-end.
Currently nothing uses this module, but I'm committing
it now so that Tyson can start playing with it.
Estimated hours taken: 6
Allow construction unifications for existentially typed functors,
using the syntax "X = 'new foo'(Y)" rather than the usual "X = foo(Y)".
We need to use a special syntax for exisentially typed constructions
because type analysis and polymorphism need to know which occurrences
of existentially typed functors are constructors and which are deconstructors.
Note that we still don't yet support RTTI for existentially typed data types.
compiler/typecheck.m:
For existentially typed functors, allow the functor to have
a "new " prefix, and if so, make the quantifiers and constraints
universal rather than existential.
compiler/polymorphism.m:
For unifications with existentially typed functors,
check for a "new " prefix on the functor.
If the functor has such a prefix, strip off the prefix,
and treat the unification as a construction rather than
treating it as a deconstruction.
compiler/type_util.m:
Define a new predicate `remove_new_prefix', for use by typecheck.m
and polymorphism.m.
compiler/modecheck_unify.m:
For construction unifications, check that all the type_info
and typeclass_info arguments introduced by polymorphism.m
are ground.
tests/hard_coded/typeclasses/existential_data_types.m:
Change the test case to use this new feature,
rather than hacking it using the C interface.
doc/reference_manual.texi:
Document the new features.
Estimated hours taken: 0.1
compiler/det_analysis.m:
Import module prog_data in the interface rather than in the
implementation. This is necessary now that the `determinism'
type is defined in prog_data.m rather than hlds_data.m.
(This change is part of my previous set of changes to move some
declarations around in order to reduce the number and complexity
of the intermodule dependencies. I accidentally forgot to commit
this one with the other changes.)
Estimated hours taken: 4
Move some declarations around and make some other minor changes in order
to reduce the number and complexity of the intermodule dependencies.
In particular, ensure that prog_data.m does not need to import
hlds*.m, purity.m, rl.m, or term_util.m.
Since we expect to have only one input language, but potentially many
different target languages, the general design principle that we have adopted
in order to minimize the number of dependencies, particularly cyclic ones,
is that modules which belong to an earlier stage of compilation should
not depend on modules which belong to a later stage of compilation.
However, that design principle has not been adhered to in many cases.
This change reduces the number of such cases.
compiler/prog_data.m:
compiler/hlds_pred.m:
Move definition of the types `eval_method' and `pred_or_func'
from hlds_pred.m to prog_data.m.
Add new type `mode_num' to prog_data.m, defined by
`type mode_num == int', and change the proc_id argument of
the `unused_args' pragma to instead use this type instead of proc_id.
Delete the import of module hlds_pred from prog_data.m.
compiler/prog_data.m:
compiler/hlds_data.m:
Move the definition of the type `determinism' from hlds_data.m to
prog_data.m. Delete the import of module hlds_data from prog_data.m.
compiler/prog_data.m:
compiler/purity.m:
Move the definition of the type `purity' from purity.m to prog_data.m.
Add import of module prog_data to purity.m.
Delete the import of module purity from prog_data.m.
This is needed because purity.m imports hlds*.m and so by
importing purity.m, prog_data.m was indirectly importing hlds*.m.
(An possible alternative here would be to split purity.m into two
parts, called say purity.m and check_purity.m; of these, only the
second would import hlds*.m. But that would be a significantly
more complicated change.)
compiler/prog_data.m:
compiler/rl.m:
Move the definition of the `index_spec' and `index_type' types from
rl.m to prog_data.m. Delete the import of module rl from prog_data.m.
compiler/prog_data.m:
Add new types `pragma_arg_size_info' and `pragma_termination_info'
to prog_data.m. These are similar to the existing types
`arg_size_info' and `termination_info' defined in term_util.m,
except that they correspond more directly to what is actually
used in `pragma termination_info' declarations.
compiler/term_util.m:
Add new predicates `add_context_to_arg_size_info' and
`add_context_to_pragma_termination_info' for converting
the prog_data types to their corresponding term_util types.
compiler/make_hlds.m:
compiler/mercury_to_mercury.m:
compiler/prog_io_pragma.m:
compiler/unused_args.m:
Minor modifications to handle the change in the type of the
mode number argument in `unused_args' pragmas, and in the types
of the arg_size_info and termination_info arguments in
`termination_info' pragmas.
compiler/mercury_to_mercury.m:
compiler/prog_io_pragma.m:
compiler/inst.m:
compiler/make_hlds.m:
compiler/call_gen.m:
compiler/common.m:
compiler/continuation_info.m:
compiler/det_report.m:
compiler/hlds_pred.m:
compiler/lambda.m:
compiler/magic_util.m:
compiler/modecheck_call.m:
compiler/prog_io_goal.m:
compiler/prog_io_util.m:
compiler/prog_util.m:
compiler/termination.m:
Delete imports of modules purity, rl, and hlds_pred, or
move them from the interface section to the implementation section.
compiler/inst.m:
compiler/prog_io_util.m:
Add an XXX comment explaining why we need to import hlds_data.m.
Estimated hours taken: 30 (including debugging)
Add MR_TYPECTOR_REP_* to the type_ctor_info to describe the
representation of this type.
We want to do this because it allows us to check quickly to see
what kind of data representation is being used. Previously this
information was spread throughout the type_ctor_layout and
type_ctor_functors data structures. It was complex to interpret
and contained a lot of unnecessary duplication.
We can now omit data structures such as the type_ctor_layout in many
cases (it is only necessary for discriminated unions). Because we rule
out some of the possible alternatives, the encodings used in the
type_ctor_layout can be simplified. Also, the functors indicator in
type_ctor_functors can be removed, as it subsumed by this data
structure.
Use this representation in code that uses RTTI.
compiler/base_type_info.m:
Add a missing alternative to the type_ctor_rep (this was a
bug).
library/array.m:
library/builtin.m:
library/private_builtin.m:
runtime/mercury_bootstrap.c:
Use MR_TYPECTOR_REP_* in the type_ctor_infos for builtin types.
library/std_util.m:
runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
Use MR_TYPECTOR_REP_* and MR_DISCUNION_TAG_* to dispatch on
data representations.
Also, fix a bug in deep_copy when copying floating point values.
I'm not sure when this stopped working, or if this is exactly
the right fix, but it is more correct than the previous code.
runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
Update code to use MR_TYPECTOR_REP_*.
Use a struct for type_ctor_info.
tests/hard_coded/Mmakefile:
tests/hard_coded/deep_copy.m:
tests/hard_coded/deep_copy.exp:
Add a test case for deep_copy.
Estimated hours taken: 0.25
compiler/mercury_compile.m:
When invoking `c2init', pass the name of the `.c' file rather than
the `.m' file, since `mkinit' no longer supports passing the `.m' file.
Estimated hours taken: 4
Merge in the changes from the existential_types_2 branch.
This change adds support for mode re-ordering of code involving
existential types. The change required modifying the order of the
compiler passes so that polymorphism comes before mode analysis,
so that mode analysis can check the modes of the `type_info' or
`typeclass_info' variables that polymorphism introduces, so that
it can thus re-order the code accordingly.
This change also includes some more steps towards making existential data
types work. In particular, you should be able to declare existentially
typed data types, the compiler will generate appropriate unification
and compare/3 routines for them, and deconstruction unifications for them
should work OK. However, currently there's no way to construct them
except via `pragam c_code', and we don't generate correct RTTI for them,
so you can't use `io__write' etc. on them.
library/private_builtin.m:
compiler/accumulator.m:
compiler/bytecode_gen.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/code_util.m:
compiler/common.m:
compiler/dead_proc_elim.m:
compiler/dependency_graph.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/follow_code.m:
compiler/follow_vars.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_goal.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
compiler/intermod.m:
compiler/lambda.m:
compiler/live_vars.m:
compiler/magic.m:
compiler/make_hlds.m:
compiler/mercury_compile.m:
compiler/mercury_to_c.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/mode_util.m:
compiler/modecheck_call.m:
compiler/modecheck_unify.m:
compiler/modes.m:
compiler/pd_cost.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/purity.m:
compiler/quantification.m:
compiler/rl_exprn.m:
compiler/rl_key.m:
compiler/simplify.m:
compiler/table_gen.m:
compiler/term_traversal.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
compiler/unused_args.m:
compiler/notes/compiler_design.html:
doc/reference_manual.texi:
tests/hard_coded/typeclasses/Mmakefile:
tests/hard_coded/typeclasses/existential_data_types.m:
tests/hard_coded/typeclasses/existential_data_types.exp:
tests/warnings/simple_code.exp:
tests/hard_coded/Mmakefile:
tests/term/arit_exp.trans_opt_exp:
tests/term/associative.trans_opt_exp:
tests/term/pl5_2_2.trans_opt_exp:
tests/term/vangelder.trans_opt_exp:
tests/term/arit_exp.trans_opt_exp:
tests/term/associative.trans_opt_exp:
tests/term/pl5_2_2.trans_opt_exp:
tests/term/vangelder.trans_opt_exp:
tests/invalid/errors2.err_exp2:
tests/invalid/prog_io_erroneous.err_exp2:
tests/invalid/type_inf_loop.err_exp2:
tests/invalid/types.err_exp2:
tests/invalid/polymorphic_unification.err_exp:
tests/invalid/Mmakefile:
tests/warnings/simple_code.exp:
tests/debugger/queens.exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/existential_reordering.m:
tests/hard_coded/existential_reordering.exp:
Merge in the changes from the existential_types_2 branch.
Estimated hours taken: 4
Merge in the changes from the existential_types_2 branch.
This change adds support for mode re-ordering of code involving
existential types. The change required modifying the order of the
compiler passes so that polymorphism comes before mode analysis,
so that mode analysis can check the modes of the `type_info' or
`typeclass_info' variables that polymorphism introduces, so that
it can thus re-order the code accordingly.
This change also includes some more steps towards making existential data
types work. In particular, you should be able to declare existentially
typed data types, the compiler will generate appropriate unification
and compare/3 routines for them, and deconstruction unifications for them
should work OK. However, currently there's no way to construct them
except via `pragam c_code', and we don't generate correct RTTI for them,
so you can't use `io__write' etc. on them.
library/private_builtin.m:
compiler/accumulator.m:
compiler/bytecode_gen.m:
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/code_util.m:
compiler/common.m:
compiler/dead_proc_elim.m:
compiler/dependency_graph.m:
compiler/det_analysis.m:
compiler/follow_vars.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_goal.m:
compiler/live_vars.m:
compiler/make_hlds.m:
compiler/mercury_to_c.m:
compiler/modecheck_unify.m:
compiler/pd_cost.m:
compiler/polymorphism.m:
compiler/rl_exprn.m:
compiler/rl_key.m:
compiler/simplify.m:
compiler/term_traversal.m:
compiler/unify_gen.m:
compiler/unused_args.m:
Trivial changes to handle the new field of complicated_unifies.
compiler/hlds_pred.m:
Define and use typedefs `type_info_varmap', `type_class_info_varmap',
and `constraint_proof_map', rather than duplicating complicated
map(...) types everywhere.
Add two new fields to the clauses_info data structure:
a type_info_varmap and a type_class_info_varmap.
Define access predicates for the clauses_info data structure.
Add type_info_varmap and type_class_info_varmap as extra
arguments to proc_info_set_body.
compiler/check_typeclass.m:
compiler/clause_to_proc.m:
compiler/dead_proc_elim.m:
compiler/higher_order.m:
compiler/hlds_out.m:
compiler/hlds_pred.m:
compiler/intermod.m:
compiler/make_hlds.m:
compiler/mercury_to_c.m:
compiler/modes.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/purity.m:
compiler/typecheck.m:
compiler/unify_proc.m:
Trivial changes to handle the two new fields of clauses_info.
Change many places to use the the access predicates to access
fields of the clauses_info rather than accessing them directly.
compiler/purity.m:
Fix some non-standard layout to match our usual coding conventions.
XXX TODO:
- termination analysis doesn't work; probably some mixup
regarding whether or not the pragmas in the .opt and
.trans_opt files are supposed to have the type_infos
included or not.
- fixup error messages (argument numbers offset)
- quite a few test cases are failing
Estimated hours taken: 0.5
c_pointer needs to be a hand defined type -- up until now everything but
the type_ctor_info is hand defined. We need to be able to change the
contents of the type_ctor_info, however.
compiler/type_util.m:
library/builtin.m:
runtime/mercury_bootstrap.c:
Make builtin:c_pointer a hand-defined type, doing the usual
bootstrapping trick.
Estimated hours taken: 5
compiler/rl_out.pp:
Use the `one_reference' bytecode to avoid unnecessary copying.
Use the `has_index' bytecode to avoid adding indexes multiple times.
compiler/rl_sort.m:
Fix bugs in the rules describing how required and available
sorting and indexing are affected by the `make_unique' instruction.
compiler/rl.m:
Remove an obsolete comment.
Estimated hours taken: 0.25
compiler/rl_dump.m:
Change the output for `union_diff' and `insert' instructions
to make it clearer which relation is being updated.
Estimated hours taken: 0.5
compiler/rl_liveness.m:
Don't keep unnecessary references to the relation
updated by a `union_diff' or `insert' instruction.
Estimated hours taken: 5
Fix bug where unification of two variables with identical bound inst
lists were incorrectly being inferred det.
tests/warnings/Mmakefile:
tests/warnings/det_infer_warning.exp:
tests/warnings/det_infer_warning.m:
Test case to exercise the bug.
mercury/compiler/inst_util.m:
Handle bound inst lists of length > 1 correctly.
Estimated hours taken: 1
Mmake.common.in:
Document that `mmake depend' needs to be run
in the compiler directory if the setting
of `INCLUDE_ADITI_OUTPUT' is changed.
compiler/Mmakefile:
Change the action of `mmake depend' so that it always
regenerates the `.m' files for which `.pp' files exist.
Don't update the timestamp on a `.m' file if regenerating
it does not change it.
tools/bootcheck:
Link rather than copy `.pp' files now that reprocessing
them is handled by `mmake depend'.
Estimated hours taken: 0.5
compiler/rl_exprn.m:
Fix bugs in an earlier change - the declarations
were written twice and some expressions were
missing an `rl_PROC_expr_end' bytecode.
Estimated hours taken: 1
compiler/hlds_goal.m:
Added `set_goal_contexts', which sets all the contexts
of the goal_infos of the sub-goals of a goal.
compiler/unify_proc.m:
Use `set_goal_contexts' to ensure that error messages
for automatically generated procedures have a useful context.
tests/invalid/partial_implied_mode.err_exp:
Update the expected output.
Estimated hours taken: 0.5
compiler/error_util.m:
compiler/term_errors.m:
Change code to output predicate names and pragma declarations
to be consistent with other error messages.
Fix some tense inconsistencies and grammar errors in the
termination error messages.
Estimated hours taken: 3
compiler/rl_exprn.m:
Fix a bug which caused missing constant declarations in the
RL generated for aggregate goals.
Remove some code duplication for generation of constant
and constructor declarations.
For consistency, return the list of variable types for
key range expressions, even though it should currently
always be empty.
compiler/rl_out.pp:
Handle the variable types returned for key range expressions.