Estimated hours taken: 4
Branches: main
Extend foreign_type declarations with optional annotations that allow the
programmer to assert that values of the given type can be passed to and from
Mercury without boxing, via casts, which are faster.
doc/reference_manual.texi:
Document the new assertions.
compiler/prog_io_pragma.m:
Parse the new assertions in foreign_type declarations.
compiler/prog_data.m:
compiler/hlds_data.m:
Extend the foreign_type item and the foreign_type kind of HLDS type
definition with a field containing a list of assertions. Currently
the only assertion available is the one described above.
compiler/llds.m:
Extend the structures containing the input/output arguments of
foreign_procs with the list of applicable assertions.
compiler/make_hlds.m:
Transfer any assertions from foreign_type items to the HLDS type
definition.
compiler/pragma_c_gen.m:
Transfer any assertions from the HLDS type definition to the
descriptions of the inputs and outputs.
compiler/llds_out.m:
If the new assertion is present in the input/output arguments of
foreign_procs, generate casts instead of boxing/unboxing code.
compiler/foreign.m:
compiler/intermod.m:
compiler/mercury_to_mercury.m:
compiler/ml_code_gen.m:
compiler/mlds.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Minor changes to conform to the changes in data structures.
tests/hard_coded/foreign_type_assertion.{m,exp}
New test case to test the handling of the new assertion.
tests/hard_coded/Mmakefile:
Enable the new assertion in C grades.
Estimated hours taken: 0.1
Branches: main
doc/faq.texi:
doc/library.texi:
doc/reference_manual.texi:
doc/transition_guide.texi:
doc/user_guide.texi:
Change some copyright dates from 2003 to 2004 in various
places.
Estimated hours taken: 0.5
Branches: main
doc/reference_manual.texi:
Fix an XXX: document the effect of `pragma foreign_type' declarations
on the C data-passing convention.
Estimated hours taken: 19
Branches: main
Change how the termination analysis deals with foreign_procs.
Add `terminates' and `does_not_terminate' as foreign proc attributes.
Currently the termination analysis assumes that all procedures implemented
via the foreign language interface will terminate. For foreign code
that does not make calls back to Mercury this is generally the behaviour
we want but for foreign code that does make calls back to Mercury we should
not assume termination because we do not know what Mercury procedures may be
called.
This change alters the termination analysis so that in the absence of
of any user supplied information foreign_procs that do not call Mercury
are considered terminating and those that do make calls back to Mercury
are non-terminating. This new behaviour is safer than the old behaviour.
For example some of the compiler's optimization passes may rely on
information from the termination analysis about whether or not a predicate
will terminate.
The second part of this diff adds `terminates' and `does_not_terminate'
as foreign_proc attributes. This is a cleaner way of specifying termination
properties than pragma terminates/does_not_terminate and it is also
more flexible than the pragmas. For example, in cases where procedures have
both foreign and Mercury clauses, pragma terminates/does_not_terminate
declarations will apply to both. Foreign code attributes allows us to
specify the termination properties of the foreign clauses and leave the
termination analysis to work out the termination properties of the
Mercury clauses.
compiler/hlds_pred.m:
compiler/prog_data.m:
compiler/prog_io_pragma:
Handle terminates/does_not_terminate as foreign proc attributes.
compiler/term_errors.m:
compiler/term_traversal.m:
compiler/termination.m:
Handle terminates/does_not_terminate as foreign proc attributes.
Check that the foreign proc attributes do not conflict with any
termination pragmas that the user has supplied.
Modify assumptions about the termination of foreign procs.
compiler/term_util.m:
Move some utility predicates to this module.
doc/reference_manual.texi:
Document new foreign proc attributes and the new behaviour
of the termination analysis for foreign_procs.
Fix a typo.
tests/term/Mmakefile:
tests/term/foreign_valid.m:
tests/term/foreign_valid.trans_opt_exp:
tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
tests/warnings/foreign_term_invalid.m:
tests/warnings/foreign_term_invalid.exp:
Test cases for the above.
Estimated hours taken: 0.1
Branches: main.
Fix the typos in the reference manual section "Using C pointers"
reported by Peter Schachte on the Mercury developers list the other day.
doc/reference_manual.texi:
Fix some typos. s/complicated_structure/complicated_c_structure/
Add missing parenthesis.
Estimated hours taken: 1
library/parser.m:
Extended parser__parse_rest//5 to handle backquoted operators with
module qualifiers so that e.g. (A `set.union` B) will
parse successfully.
doc/reference_manual.texi:
Documented the new syntax.
tests/hard_coded/backquoted_qualified_ops.m:
tests/hard_coded/backquoted_qualified_ops.exp:
tests/hard_coded/Mmakefile:
Test case added.
Estimated hours taken: 0.75
Branches: main
doc/reference_manual.texi:
Document that entities declared in `pragma foreign_decl'
declarations scope over `pragma foreign_type' declarations.
Explain how to work around the restriction that C `pragma
foreign_type' declarations can't contain preprocessor declarations.
Estimated hours taken: 0.75
Branches: main
Document that C preprocessor directives are not permitted in C
`pragma foreign_type' declarations.
doc/reference_manual.texi:
Document that C preprocessor directives are not permitted in
C `pragma foreign_type' declarations. This is needed because we
generate uses of foreign types inside macro invocations, e.g.
MR_MAYBE_BOX_FOREIGN_TYPE(), and the ISO C standard does not
permit preprocessor directives inside macro invocations.
(It would be nicer for the compiler to generate a C typedef,
and then generate references to the typedef name inside
MR_MAYBE_BOX_FOREIGN_TYPE() rather than copying the user's type
definition directly. But it's not very important, and this
is an easier fix.)
Also, some minor clarifications to the documentation for
C and Java `foreign_type' pragmas.
Estimated hours taken: 0.1
Branches: main
doc/reference_manual.texi:
Clarify the documentation of the incompatibilities of minimal model
tabling with other grade components.
runtime/mercury_grade.h:
Catch those incompatibilities at compile time (the ones we arean't
catching so already).
Estimated hours taken: 4
Branches: main
doc/reference_manual.texi:
Document the Java foreign language interface.
A few minor changes elsewhere in the foreign language interfacing
chapter. In particular, be consistent about how the language
name is specified in foreign language interfacing pragmas.
tests/hard_coded/Mmakefile:
tests/hard_coded/java_test.m:
tests/hard_coded/java_test.exp:
Add a test of the Java foreign language interface.
tests/hard_coded/Mmakefile:
tests/hard_coded/csharp_test.m:
tests/hard_coded/csharp_test.exp:
Enable the test of the C# foreign language interface.
Estimated hours taken: 1
Branches: main
doc/reference_manual.texi:
Modify the documentation to match the behaviour of the compiler:
semidet foreign_procs implemented in MC++, C#, and IL return
their truth or falsity in a variable named "SUCCESS_INDICATOR",
not "succeeded".
Estimated hours taken: 0.25
Branches: main
doc/reference_manual.texi:
Add some missing "@noindent" directives to the documentation
of state variable syntax.
Estimated hours taken: 32
Branches: main
Move toward the proposed structures for representing type class information at
runtime by adding code for generating the structures corresponding to
base_typeclass_infos. The structures corresponding to typeclass_infos will
be added in a later change.
Register the new data structures in a table at runtime.
Add four new mdb developer commands for checking the contents of the new
type class table, as well as the contents of the existing type constructor
table: class_decl, type_ctor, all_class_decls and all_type_ctors.
compiler/rtti.m:
Add the data types required to represent the new runtime data
structures that will eventually replace base_typeclass_infos
inside the compiler.
Add the required function symbols to the data types representing both
the new RTTI data structures themselves and those representing
references to them.
Make the required changes to the predicates operating on the modified
data types, and add some required new predicates.
compiler/rtti_out.m:
Add code to write out the new data structures for the LLDS backend.
Make some changes in existing predicates to allow them to be used
in the new code.
compiler/layout_out.m:
Factor out some code that is now common with rtti_out.m.
compiler/type_class_info.m:
A new module to generate the new RTTI data structures.
compiler/backend_libs.m:
Include the new module.
compiler/options.m:
Add a new option, --new-type-class-rtti, to control whether we
invoke the top level predicate of type_class_info.m to generate
the new type class RTTI structures. We still generate and use
base_typeclass_infos regardless of the value of this option.
compiler/mercury_compile.m:
Invoke the code of the new module if --new-type-class-rtti is given.
compiler/opt_debug.m:
Add code to dump descriptions of the new rtti_ids.
compiler/mlds_to_gcc.m:
compiler/rtti_to_mlds.m:
Handle the new alternatives in the rtti data types, mostly by throwing
exceptions. The actual code should be written later by Fergus.
compiler/pseudo_type_info.m:
Module qualify the names of builtin types when generating
pseudo-typeinfos for them. This makes the naming scheme more regular.
compiler/base_typeclass_info.m:
compiler/notes/type_class_transformation.html:
Document the impending obsolescence of these files.
compiler/notes/work_in_progress.html:
List type class RTTI as work in progress.
library/list.m:
Add a utility predicate for use by compiler/rtti_out.m.
runtime/mercury_typeclass_info.h:
Make some changes in the C data types representing type class
information that I discovered to be necessary or advantageous
in the process of generating values of those types automatically.
Rename some types to make their names be better documentation.
Change some arrays of pointers to structures into arrays of structures,
where the structures at different array indexes are the same size.
Removing consts that rtti_out.m supplies automatically avoids
duplicate const errors from the C compiler.
Add #includes to make the file namespace clean.
Protect against multiple inclusion.
runtime/mercury_typeclass_info_example.c:
Remove this file. After the changes to mercury_typeclass_info.h, its
contents are no longer correct examples of the structures in
mercury_typeclass_info.h, and since the compiler can now generate
those structures automatically, hand-written examples no longer serve
any useful pupose.
runtime/mercury_types.h:
Add a new type, MR_CodePtr, for use in mercury_typeclass_info.h.
The compiler predicate tc_rtti_name_type wants single-word names
for types.
runtime/mercury_imp.h:
#include mercury_typeclass_info.h.
runtime/mercury_type_tables.[ch]:
Add functions to register and to look up type class declarations and
type class instances.
Add the functions and data structures required to look up all type
constructors and all type classes. The debugger uses these to support
the commands that let the programmer check the contents of these
tables.
Eventually, we should be able to use the type class tables to test
whether a vector of types is a member of a given type class.
runtime/mercury_wrapper.c:
runtime/mercury_type_info.[ch]:
Move the array of type_ctor_rep names from the mercury_wrapper module
to the mercury_type_info module, and make it always-defined and public;
the debugger also needs access to it now.
runtime/Mmakefile:
Add mercury_typeclass_info.h to the list of header files that other
files depend on.
trace/mercury_trace_internal.c:
Add four new mdb commands: class_decl, type_ctor, all_class_decls
and all_type_ctors.
Make some existing code follow our coding conventions.
doc/user_guide.texi:
doc/mdb_categories:
Document the four new mdb commands.
doc/reference_manual.texi:
Document (in a comment) the compiler's reliance on each type in an
instance declaration containing exactly one type constructor.
tests/debugger/class_decl.{m,inp,exp}:
A new test case to test the new mdb commands.
tests/debugger/Mmakefile:
tests/debugger/Mercury.options:
Add the new test case.
tests/debugger/completion.exp:
Expect the new commands to appear in the command name completion.
tests/debugger/mdb_command_test.inp:
Test the documentation of the new mdb commands.
Expect the new commands to appear in the command name completion.
Estimated hours taken: 5
Branches: main
Fix a bug reported by Fergus, which caused an abort when a
user-defined unification or comparison predicate was ill-typed.
compiler/intermod.m:
Don't attempt to module qualify the unification
and comparison routines for type declarations that
won't be used on the current back-end -- they won't
have been typechecked. They will be ignored when read
back in, but we put them in the `.opt' file because
it is sometimes useful to test compiling a module
against a workspace using a grade different to that
used to build the workspace.
compiler/type_util.m:
Choose the correct unification/comparison predicates for
the current back-end where there are both Mercury and
foreign definitions for a type.
compiler/make_hlds.m:
compiler/foreign.m:
Move have_foreign_type_for_backend to foreign.m, for
use by intermod.m.
doc/reference_manual.texi:
Clarify the documentation about user-defined unification and
comparison predicates for foreign types.
tests/invalid/Mmakefile:
tests/invalid/illtyped_compare.{m,err_exp}:
Add a test case.
tests/invalid/make_opt_error.{m,err_exp}:
This change caused the error in this test case to not
be reported any more (it occurred in code not used
on the back-end being compiled for). Fix the test
so an error is reported.
Estimated hours taken: 0.5
Branches: main.
Fix some mistakes in the compiler documentation. These are mainly
spelling errors and some things identified by the double script
(that I'm fairly certain are mistakes).
compiler/options.m:
Add `.profdeep' to list of grade modifiers.
Fix the formatting of a line so that it fits within 80 chars.
s/attemps/attempts/
s/auxiliarity/auxiliary/
s/whereever/wherever/
Fix some doubled words.
doc/reference_manual.texi:
Remove a few doubled words.
doc/user_guide.texi:
s/behavior/behaviour/
s/occuring/ocurring/
Estimated hours taken: 3
Branches: main
doc/Mmakefile:
Use `makeinfo --html' rather than `perl texi2html' for creating
the HTML version of the documentation. Since makeinfo outputs
the HTML to different file names than texi2html, this also required
various other changes to handle the different file names.
doc/faq.texi:
doc/library.texi:
doc/reference_manual.texi:
doc/transition_guide.texi:
doc/user_guide.texi:
Change @ifinfo to @ifnottex.
Uncomment the @dircategory commands, which were previously commented
out because they weren't supported by (our old version of) texi2html.
Update copyright dates.
Estimated hours take: 5.5
Branches: main
Fix a bug in the termination analyser that caused it to ignore
pragma terminates/does_not_terminate declarations.
BUGS:
Delete the description of the bug regarding does_not_terminate
pragmas.
compiler/error_util:
Add a predicate describe_several_pred_names/3.
compiler/term_errors:
Add an error type indicating that the cause of non-termination was
inconsistent termination pragmas.
compiler/termination:
Fix a bug that caused pragma terminates and pragma does_not_terminate
declarations to be ignored.
Check that SCCs in the call-graph have not been annotated with
termination pragmas that are inconsistent.
Remove some old style lambda expressions.
doc/reference_manual.texi:
Describe how pramga terminates/does_not_terminate interact with
mutually recursive procedures.
tests/term/Mmakefile:
tests/term/pragma_non_term.m:
tests/term/pragma_non_term.trans_opt_exp:
tests/term/pragma_term.m:
tests/term/pragam_term.trans_opt_exp:
tests/warnings/Mercury.options:
tests/warnings/Mmakefile:
tests/warnings/pragma_term_conflict.m:
tests/warnings/pragma_term_conflict.exp:
Add some test cases for the termination pragmas.
Estimated hours taken: 4
Branches: main, release
The compiler was not module qualifying the `where equality is ...'
part of type declarations in interface files. This could cause the
compiler to use the wrong predicate in importing modules if the
user-defined equality predicate was not exported.
To avoid this problem we now require user-defined equality or
comparison predicates for a type to be defined in the same module
as the type. This is the only simple way to module qualify the
unification predicates in interface files without running
typechecking.
compiler/prog_io.m:
compiler/prog_io_pragma.m:
Require user-defined equality or comparison predicates for a
type to be defined in the same module as the type.
NEWS:
doc/reference_manual.texi:
Document the change.
compiler/typecheck.m:
compiler/post_typecheck.m:
compiler/hlds_pred.m:
compiler/make_hlds.m:
compiler/*.m:
Calls in the compiler generated unification predicates are
now guaranteed to be fully qualified, so don't attempt
to search for more qualified predicates.
Add a new pred_marker 'calls_are_fully_qualifed' to
identify predicates whose bodies contain only fully
qualified calls, rather than testing the import_status.
tests/invalid/Mmakefile:
tests/invalid/exported_unify.m:
tests/invalid/exported_unify2.m:
tests/invalid/exported_unify2.err_exp:
tests/invalid/exported_unify3.m:
tests/invalid/exported_unify3.err_exp:
Test cases.
Estimated hours taken: 0.25
Branches: main
doc/reference_manual.texi:
Document the requirement that if the user supplies
both unification and comparison predicates for a type,
all [X, Y] (unifypred(X, Y) <=> comparepred((=), X, Y)).
Estimated hours taken: 9
Branches: main
Add support for two new compiler options,
`--allow-stubs' and `--no-warn-stubs',
to allow execution of programs which are incomplete.
`--allow-stubs' delays the reporting of errors for procedures with no
clauses until run-time, instead issuing only a warning at compile time.
`--no-warn-stubs' allows even that warning to be supressed.
library/private_builtin.m:
Add a new procedure no_clauses/1, for reporting the
run-time error.
compiler/options.m:
Add and document the new options.
compiler/typecheck.m:
Implement the new options. For procedures with no
clauses, if `--allow-stubs' is enabled, generate a
stub body which just calls no_clauses/1 or sorry/1.
compiler/hlds_pred.m:
Add a new marker `stub', for procedures whose body is an
automatically-generated stub.
compiler/purity.m:
compiler/det_analysis.m:
compiler/unused_args.m:
Don't issue warnings for `stub' procedures.
NEWS:
doc/user_guide.texi:
Document the new options.
doc/reference_manual.texi:
Document that there must be at least one clause for each
declared predicate or function, since as far as I can tell
this was until now not explicitly stated in the reference
manual. Also document that implementations are permitted
to provide a method of processing Mercury programs for
which this error is not reported until runtime.
tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
tests/warnings/warn_stubs.m:
tests/warnings/warn_stubs.exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/allow_stubs.m:
tests/hard_coded/allow_stubs.exp:
Test the new features.
Estimated hours taken: 0.75
Branches: main, release
doc/reference_manual.texi:
doc/user_guide.texi:
Fix some formatting errors in the use of @xref, @pxref, and @ref,
to avoid problems such as occurrences of "see see section <whatever>"
in the HTML and DVI output.
Estimated hours taken: 10
Branches: main
Allow user-defined comparison functions using the syntax
:- type t ---> t where equality is t_equal, comparison is t_compare.
.
Allow user-defined equality and comparison for foreign types using the syntax
:- pragma foreign_type(c, t, "c_t") where
equality is t_equal, comparison is t_compare.
compiler/prog_data.m:
compiler/mercury_to_mercury.m:
compiler/hlds_out.m:
compiler/*.m:
Allow comparison predicates in `type' and `pragma foreign_type'
declarations
compiler/hlds_data.m:
compiler/*.m:
Allow equality and comparison predicates to be attached
to foreign types.
compiler/prog_io.m:
compiler/prog_io_pragma.m:
Parse the new syntax.
compiler/make_hlds.m:
Don't add the types to the HLDS or do typechecking if
there are errors in the type declarations.
Test case: tests/invalid/foreign_type_visibility.m.
compiler/foreign.m:
compiler/special_pred.m:
compiler/type_util.m:
Check whether foreign types have user-defined equality.
compiler/unify_proc.m:
Generate clauses for user-defined comparison,
and clauses for unification for foreign types.
compiler/intermod.m:
Resolve overloading before writing the `.opt' files.
library/builtin.m:
Add `uo' modes for promise_only_solution, for use in
user-defined comparison predicates.
Add types and insts to allow declaration of user-defined
comparison predicates using `with_type` and `with_inst`.
We already have types and insts `builtin__comparison_pred',
but they have a different argument ordering to `compare/3'.
NEWS:
doc/reference_manual.texi:
Document the change.
tests/hard_coded/Mmakefile:
tests/hard_coded/user_compare.{m,exp}:
Test case.
tests/invalid/Mmakefile:
tests/invalid/typeclass_test_{9,10}.{m,err_exp}:
tests/invalid/purity/purity_nonsense{,2}.{m,err_exp}:
The change to error-checking in make_hlds.m meant that
the compilation stopped before some errors in
typeclass_test_9.m were detected. The code which
tests for those errors is now in typeclass_test_10.m.
Estimated hours taken: 0.5
Branches: main
doc/reference_manual.texi:
Mention the `_ ---> _ ; ...' alternative syntax
for `_ == bound(_ ; ...)' in inst definitions.
Estimated hours taken: 24
Branches: main
Support impurity declarations for higher-order code.
In particular, allow `impure' and `semipure' annotations on
higher-order types, higher-order calls, and lambda expresions.
NEWS:
doc/reference_manual.texi:
Document the new language feature.
compiler/hlds_goal.m:
compiler/hlds_pred.m:
Add `purity' field to
- the `higher_order' alternative of the hlds_goal.generic_call type
- the `higher_order' alternative of the hlds_pred.generic_call_id type
- the `lambda_goal' alternative of the hlds_goal.unify_rhs type
compiler/type_util.m:
Add a new `purity' argument to the procedures dealing with
higher-order types. Add code for parsing impure/semipure
higher-order types.
compiler/lambda.m:
compiler/make_hlds.m:
compiler/typecheck.m:
compiler/post_typecheck.m:
compiler/purity.m:
compiler/polymorphism.m:
Various minor changes to support impure/semipure higher-order lambda
expressions.
compiler/polymorphism.m:
compiler/pseudo_type_info.m:
XXX ought to change these to include purity in the RTTI for
higher-order function types.
compiler/simplify.m:
Don't try to optimize semipure/impure higher-order calls.
compiler/assertion.m:
compiler/bytecode_gen.m:
compiler/call_gen.m:
compiler/continuation_info.m:
compiler/cse_detection.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/det_analysis.m:
compiler/det_util.m:
compiler/equiv_type.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_out.m:
compiler/intermod.m:
compiler/magic.m:
compiler/magic_util.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/mode_util.m:
compiler/modecheck_call.m:
compiler/modecheck_unify.m:
compiler/modes.m:
compiler/module_qual.m:
compiler/pd_util.m:
compiler/prog_rep.m:
compiler/pseudo_type_info.m:
compiler/quantification.m:
compiler/recompilation.usage.m:
compiler/rl_gen.m:
compiler/stratify.m:
compiler/switch_detection.m:
compiler/term_traversal.m:
compiler/term_util.m:
compiler/unify_gen.m:
compiler/unique_modes.m:
Trivial changes to handle the new purity fields and/or arguments.
tests/hard_coded/purity/Mmakefile:
tests/hard_coded/purity/impure_func_t5_fixed2.m:
tests/hard_coded/purity/impure_func_t5_fixed2.exp:
tests/hard_coded/purity/impure_func_t5_fixed2.exp2:
tests/hard_coded/purity/impure_pred_t1_fixed3.m:
tests/hard_coded/purity/impure_pred_t1_fixed3.exp:
tests/invalid/purity/Mmakefile:
tests/invalid/purity/impure_func_t5_fixed.m:
tests/invalid/purity/impure_func_t5_fixed.err_exp:
tests/invalid/purity/impure_pred_t1_fixed.m:
tests/invalid/purity/impure_pred_t1_fixed.err_exp:
Add new test cases to test the new feature.
tests/invalid/purity/impure_func_t5.err_exp:
tests/invalid/purity/impure_pred_t1.err_exp:
tests/invalid/purity/impure_pred_t2.err_exp:
tests/invalid/purity/purity.err_exp:
tests/invalid/purity/purity_nonsense.err_exp:
Update the expected error messages for existing test cases.
tests/invalid/purity/.cvsignore:
New file, copied from tests/invalid/.cvsignore.
Estimated hours taken: 14
Branches: main
Change the compiler and tools so that `.' and not `:' is now used as the
module separator in all output.
Infix `.' now has associativity yfx and priority 10.
NEWS:
Report the change.
configure.in:
Amend the test for an up-to-date Mercury compiler to check whether
it recognises `.' as a module qualifier.
compiler/code_gen.m:
compiler/error_util.m:
compiler/hlds_out.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rl_exprn.m:
compiler/rl_gen.m:
compiler/source_file_map.m:
compiler/unused_args.m:
library/io.m:
library/rtti_implementation.m:
library/type_desc.m:
runtime/mercury_debug.c:
runtime/mercury_deconstruct.c:
runtime/mercury_stack_trace.c:
Change `:' to `.' as module separator for output.
compiler/mercury_to_mercury.m:
compiler/prog_io_typeclass.m:
As above.
Fixed a bug where `.' was not being recognised as a module separator.
doc/reference_manual.texi:
Report the change.
library/term_io.m:
Ensure that infix `.' is written without surrounding spaces.
tests/hard_coded/dot_separator.m:
tests/hard_coded/dot_separator.exp:
tests/hard_coded/Mmakefile:
Test case added.
Estimated hours taken: 3
Branches: main
Allow field access syntax at the top-level of func and mode declarations and
in function clause heads.
NEWS:
Report the new feature.
doc/reference_manual.texi:
Document the new feature.
compiler/prog_io.m:
Implement the new feature.
tests/hard_coded/Mmakefile:
tests/hard_coded/field_syntax.exp:
tests/hard_coded/field_syntax.m:
Added a test case.
Estimated hours taken: 6
Branches: main
Implement `:- pragma reserve_tag(<TypeName>/<Arity>).'.
This has the same effect as the `--reserve-tag' option,
except that it only applies to specified type, rather than
to all types.
doc/reference_manual.texi:
Document the new feature.
(However, the documentation is currently commented out.)
compiler/prog_data.m:
Add `reserve_tag(sym_name, arity)' to the `pragma_type' type.
compiler/hlds_data.m:
Add a new boolean field to the representation of discriminated union
type bodies to record whether or not the type has a reserved tag.
compiler/prog_io_pragma.m:
Add code to parse the new pragma.
compiler/make_hlds.m:
Add code to process the new pragma:
- check all the appropriate semantic restrictions:
- the pragma must have the same visibility as the type
- the type must be defined
- the type must be a discriminated union type
- warn if there are multiple such pragmas for the same type
- call make_tags.m to recompute the tags used for the constructor.
- record the presence of the reserve_tag pragma in the HLDS type
definition body
compiler/make_tags.m:
compiler/type_util.m:
Add an extra argument to assign_constructor_tags (in make_tags.m)
and type_constructors_should_be_no_tag (in type_util.m)
to specify whether or not there was a `reserve_tag' pragma.
Reserve a tag if either this argument or the global `reserve_tag'
option is set.
compiler/intermod.m:
Output a `:- reserve_tag' pragma whenever outputting a type
to which such a pragma applies.
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
Ignore the reserved_tag field.
XXX This means that the `reserve_tag' pragma (or the compiler
option) won't have much effect if --high-level-data is set.
compiler/code_util.m:
compiler/det_report.m:
compiler/hlds_out.m:
compiler/magic_util.m:
compiler/mercury_to_mercury.m:
compiler/mode_util.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/post_typecheck.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
compiler/special_pred.m:
compiler/stack_opt.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_util.m:
compiler/type_ctor_info.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
Trivial changes to handle the new reserved_tag field of
hlds_type_defn_body.
tests/valid/Mmakefile:
tests/valid/reserve_tag.m:
tests/invalid/Mmakefile:
tests/invalid/reserve_tag.m:
tests/invalid/reserve_tag.err_exp:
Some tests of the new feature.
Estimated hours taken: 28
Branches: main
Change `mmc --make' so that it no longer builds the external foreign
object files at the same time as it builds the target object file.
This allows one to build on the IL backend where building an external
foreign file assembly depends on having all the imported Mercury
assemblies built first.
Various fixes were also added so that `mmc --make --grade il' could make
an executable.
compiler/compile_target_code.m:
Change il_assemble so that we always build a .dll version
irrespective of whether it contains main or not, as MC++ or C#
code may refer to the dll.
Add Mercury/dlls to the search path for the C# and MC++
compilers.
s,/,\\\\,g in the C# filename as the MS C# compiler doesn't
understand / as a directory seperator.
Add the referenced dlls to the C# compilers command line.
Export maybe_pic_object_file_extension.
compiler/handle_options.m:
Fix a bug where copmute_grade incorrectly generated `hl.il'
instead of `il' as the grade name because we weren't always
considering the --target option.
compiler/make.m:
Add to the compilation_task_type type the alternatives
foreign_code_to_object_code and fact_table_foreign_code_file.
Add to the module_target_type type the alternatives
foreign_asm, foreign_object and factt_object.
compiler/make.dependencies.m:
Add code to handle the new module_target_type alternatives.
Add code to build the new alternatives to
compilation_task_type.
compiler/make.module_target.m:
Add rules to build the foreign_code_to_object_code and
fact_table_code_to_object_code.
compiler/make.program_target.m:
Determine the targets needed to be built for all the external
foreign files and add them to build target list.
compiler/make.util.m:
Add code to handle the new module_target_type alternatives.
Change write_target_file to output the correct name when
building the foreign_asm and foreign_object targets.
compiler/modules.m:
Move referenced_dlls into the interface for use by
`compile_target_code.m'.
Don't place dlls in a sub-directory because on the IL backend
the dlls are `part' of the executable file.
Add a `MkDir' argument to fact_table_file_name which
optionally creates a directory to store the generated
file_name in.
tests/hard_coded/foreign_proc_make.exp:
tests/hard_coded/foreign_proc_make.m:
tests/hard_coded/foreign_proc_make2.m:
Add a test case.
Branches: main
Estimated hours taken: 6
Clean up the documentation for the foreign language interface.
doc/reference_manual.texi:
Document the C# and MC++ interfaces.
Update the documentation for the foreign language interface
chapter to remove much of the stuff about it not being supported,
and to instead say that this interface is now the preferred one
to use for new code.
Branches: main
Estimated hours taken: 0.75
Update the documentation to address SourceForge bug #512581.
doc/reference_manual.texi:
Clarify the interaction between mode-specific clauses
and existential types.
Estimated hours taken: 0.1
Branches: main
NEWS:
Mention constrained polymorphic modes in the section on changes to the
Mercury language.
doc/reference_manual.texi:
Fix a typo in the section on constrained polymorphic modes.
Branches: main
Estimated hours taken: 0.75
doc/reference_manual.texi:
doc/user_guide.texi:
Use @samp rather than @command, and @samp rather than @option.
This is partly for consistency, but mainly because earlier
versions of TexInfo (e.g. 3.9) don't support @option or @command.
(It might be a good idea to switch to using @option and @command
later, but if so, we should do so consistently -- currently they
were only used in a couple of places. We should also add an
autoconf check to ensure that the version of TexInfo which is
installed is up-to-date.)
Estimated hours taken: 2
Typographical changes for printed output.
Very little change made to the produced info files.
Also fix a C code example in reference_manual.texi.
doc/faq.texi:
doc/library.texi:
doc/reference_manual.texi:
doc/transition_guide.texi:
doc/user_guide.texi:
Change en dashes to --, em dashes to ---, minus sign as @minus{}.
(Rendered as -,--,- respectively in info.)
Use @: after `e.g.', `i.e.', etc. to indicate word space rather than
sentence space.
Change `...' to `@dots{}'.
Change " to `` or '' (other than in code). (Rendered as " in info.)
doc/reference_manual.texi:
(Language specific bindings): Wrap `"C"', `"IL"' etc. in @code{}.
(Using pragma foreign_decl for C): Fix a C code example: append `;' to
struct definition.
Estimated hours taken: 25
Branches: main
Allow constraints on pred/func, instance and typeclass declarations to
constraint arbitrary types rather than just type variables. The only
restriction is that each constraint must contain at least one type
variable and that all type variables in the constraint must also occur
somewhere else in the declaration.
compiler/prog_io_typeclass.m:
When parsing class constraints (on pred/func, instance and
typeclass declarations) remove the restriction that the
arguments must all be variables. Instead, ensure that at least
one argument contains at least one variable.
compiler/hlds_data.m:
compiler/hlds_out.m:
compiler/make_hlds.m:
Allow superclass constraints to have arguments of arbitrary type
(rather than just variables) in the superclass table.
compiler/polymorphism.m:
compiler/typecheck.m:
Put in some checks to ensure that we don't get into an infinite
loop when processing mutually constrained intances, e.g.
:- instance c(f(T)) <= d(g(T)).
:- instance d(g(T)) <= c(f(T)).
doc/reference_manual.texi:
Document the change.
tests/hard_coded/typeclasses/Mmakefile:
tests/hard_coded/typeclasses/arbitrary_constraint_class.exp:
tests/hard_coded/typeclasses/arbitrary_constraint_class.m:
tests/hard_coded/typeclasses/arbitrary_constraint_pred_1.exp:
tests/hard_coded/typeclasses/arbitrary_constraint_pred_1.m:
tests/hard_coded/typeclasses/arbitrary_constraint_pred_2.exp:
tests/hard_coded/typeclasses/arbitrary_constraint_pred_2.m:
tests/hard_coded/typeclasses/recursive_instance_1.exp:
tests/hard_coded/typeclasses/recursive_instance_1.m:
tests/hard_coded/typeclasses/recursive_instance_2.exp:
tests/hard_coded/typeclasses/recursive_instance_2.m:
tests/invalid/Mmakefile:
tests/invalid/typeclass_constraint_extra_var.err_exp:
tests/invalid/typeclass_constraint_extra_var.m:
tests/invalid/typeclass_constraint_no_var.err_exp:
tests/invalid/typeclass_constraint_no_var.m:
Add some test cases.
Estimated hours taken: 600
Branches: main
Implemented state variable transformation.
NEWS:
Record new syntax and withdrawl of !/0 as Prolog cut.
compiler/hlds_goal.m:
compiler/hlds_out.m:
Added implicit/1 constructor to unify_main_context for cases where
variables are introduced by compiler transformations.
compiler/make_hlds.m:
Integrated the state variable transformation with the conversion to
HLDS.
Changed references to foreign_type and du_type constructors to
match recent changes to the foreign type interface.
compiler/mercury_compile.m:
Removed two unnecessary Prolog cuts left over from the Dark
Ages.
compiler/mercury_to_mercury.m:
Added code to output the new goal_expr constructors for state
variable quantifiers (some_state_vars and all_state_vars.)
Adapted to handle changes to if_then and if_then_else
goal_expr constructors which now include lists of state
variables that scope over the condition- and then-goals.
compiler/module_qual.m:
compiler/prog_util.m:
Changes to handle some_state_vars, all_state_vars, and changes
to if_then and if_then_else goal_expr constructors.
compiler/prog_data.m:
Added some_state_vars, all_state_vars constructors and changed
if_then and if_then_else constructors in type goal_expr.
compiler/prog_io_dcg.m:
Changes to handle quantified state variables.
compiler/prog_io_goal.m:
parse_some_vars_goal now also separates out quantified state
variables.
compiler/prog_io_util.m:
Added pred parse_quantifier_vars/3 which also detects state
variables.
compiler/typecheck.m:
Added case to report_error_undef_cons to handle any uncaught
uses of !/1.
doc/reference_manual.texi:
Documented the transformation.
library/builtin.m:
library/prolog.m:
Deleted code for `!' as fake Prolog cut.
library/lexer.m:
Made `!' a graphic token rather char than a special token.
library/ops.m:
Added `!', `!.' and `!:' as prefix ops.
library/term.m:
Added func var_id/1 which returns an int associated with its
var argument which is unique in the context of the given var
and the varset it belongs to.
library/varset.m:
Added pred new_uniquely_named_var/4 which creates a named
variable with a unique (w.r.t. the varset) number suffix.
tests/general/Mmakefile:
tests/general/state_vars_tests.exp:
tests/general/state_vars_tests.m:
tests/general/state_vars_typeclasses.exp:
tests/general/state_vars_typeclasses.m:
tests/invalid/Mmakefile:
tests/invalid/state_vars_test1.err_exp:
tests/invalid/state_vars_test1.m:
tests/invalid/state_vars_test2.err_exp:
tests/invalid/state_vars_test2.m:
tests/invalid/state_vars_test3.err_exp:
tests/invalid/state_vars_test3.m:
tests/invalid/state_vars_test4.err_exp:
tests/invalid/state_vars_test4.m:
tests/invalid/state_vars_test5.err_exp:
tests/invalid/state_vars_test5.m:
Added.
Estimated hours taken: 10
Branches: main
Improvements for `:- pragma foreign_type'.
- Allow default Mercury definitions. The Mercury definition must define
a discriminated union type. The constructors of the Mercury type are
only visible in predicates which have implementations for all the
foreign languages the type has implementations for. In all other
predicates the type is treated as an abstract type (the check for
this isn't quite right).
- Allow polymorphic foreign types.
- Don't require the `:- pragma foreign_type' for exported foreign types
to be in the interface. We now only require that all definitions
have the same visibility.
compiler/prog_data.m:
compiler/prog_io_pragma.m:
Allow polymorphic foreign types.
compiler/prog_io.m:
Export code to parse the type name in a type definition for
use by prog_io_pragma.m.
compiler/make_hlds.m:
Handle Mercury definitions for foreign types.
Separate out the code to add constructors and special predicates
to the HLDS into a separate pass. For foreign types, we don't know
what to add until all type definitions have been seen.
Use the C definition for foreign types with `--target asm'.
compiler/modules.m:
Distinguish properly between `exported' and `exported_to_submodules'.
Previously, if a module had sub-modules, all declarations,
including those in the interface, had import_status
`exported_to_submodules'. Now, the declarations in the
interface have status `exported' or `abstract_exported'.
This is needed to check that the visibility of all the
definitions of a type is the same.
compiler/hlds_pred.m:
Add a predicate status_is_exported_to_non_submodules, which
fails if an item is local to the module and its sub-modules.
compiler/hlds_data.m:
compiler/*.m:
Record whether a du type has foreign definitions as well.
Also record whether uses of the type or its constructors
need to be qualified (this is needed now that adding
the constructors to the HLDS is a separate pass).
compiler/typecheck.m:
Check that a predicate or function has foreign clauses before
allowing the use of a constructor of a type which also has
foreign definitions.
compiler/hlds_pred.m:
compiler/make_hlds.m:
Simplify the code to work out the goal_type for a predicate.
compiler/hlds_out.m:
Don't abort on foreign types.
Print the goal type for each predicate.
compiler/error_util.m:
Handle the case where the message being written is a
continuation of an existing message, so the first line
should be indented.
compiler/module_qual.m:
Remove unnecessary processing of foreign types.
doc/reference_manual.tex:
Document the change.
Update the documentation for mixing Mercury and foreign clauses.
The Mercury clauses no longer need to be mode-specific.
tests/hard_coded/Mmakefile:
tests/hard_coded/foreign_type2.{m,exp}:
tests/hard_coded/foreign_type.m:
tests/hard_coded/intermod_foreign_type.{m,exp}:
tests/hard_coded/intermod_foreign_type2.m:
tests/invalid/Mmakefile:
tests/invalid/foreign_type_2.{m,err_exp}:
tests/invalid/foreign_type_visibility.{m,err_exp}:
Test cases.
tests/invalid/record_syntax.err_exp:
Update expected output.
Estimated hours taken: 16
Branches: main
Implement C `pragma foreign_type' properly.
compiler/mlds.m:
Allow C `pragma foreign_type' on the `--target asm' back-end.
compiler/mlds_to_c.m:
Output foreign types as MR_Box internally (i.e. for the ordinary
code that we generate), for compatibility with the `--target asm'
back-end. But output foreign types as the C type name for
`pragma foreign_proc' and `pragma export'.
runtime/mercury_heap.h:
Add macros MR_MAYBE_(UN)BOX_FOREIGN_TYPE,
for boxing/unboxing foreign_type values.
compiler/export.m:
compiler/ml_code_gen.m:
Change the LLDS/MLDS (respectively) back-end code for
`pragma export' to call the above macros when required.
compiler/llds_out.m:
compiler/mlds_to_c.m:
Change the LLDS/MLDS (respectively) back-end code for
C `pragma foreign_proc' to call the above macros when required.
compiler/mlds_to_c.m:
Don't output #line directives for target_code_components
other than user_target_code. This is nedded because #line
directives are not permitted inside invocations of macros
(such as MR_MAYBE_(UN)BOX_FOREIGN_TYPE).
compiler/foreign.m:
- Add a new boolean function foreign__is_foreign_type,
which tests whether an exported_type is a foreign_type or not.
- Delete the predicate llds_exported_type_string
(I changed the callers to use foreign__to_type_string instead).
compiler/ml_code_gen.m:
compiler/mlds_to_c.m:
compiler/pragma_c_gen.m:
Add an explicit module qualifier to calls to foreign__to_type_string.
doc/reference_manual.texi:
Update the documentation to reflect the changes:
- various unnecessary restrictions have been removed
- foreign_type now works properly with `pragma export'
Estimated hours taken: 1
Branches: main
Fix a problem where the library wasn't building in grade `hlc.agc'
anymore after petdr's change to make io_stream a foreign_type.
compiler/ml_code_util.m:
Don't abort for foreign_types if accurate GC is enabled; instead,
just don't generate any GC code for them. In other words, assume
that foreign_types are not allowed to point to the Mercury heap.
doc/reference_manual.texi:
Document that C foreign_types must not point to the Mercury heap.
But leave this documentation commented out for now, since
`--gc accurate' is not yet fully implemented or officially supported.
library/io.m:
Add code to mercury_fclose() to explicitly deallocate the
MercuryFile structure pointed to by the io_stream C foreign_type,
when not using conservative GC.
This avoids a potential memory leak in those grades.
Estimated hours taken: 16
Branches: main
Get pragma foreign_type working for the C backend.
doc/reference_manual.texi:
Document C pragma foreign_types.
compiler/prog_data.m:
Add il_foreign_type and c_foreign_type which contain all the
necessary data to output a foreign_type on the respective backends.
Change foreign_language_type to refer to these new types.
compiler/prog_io_pragma.m:
Handle the changes to foreign_language_type, and parse C
foreign_type declarations.
compiler/hlds_data.m:
Change the hlds_data__foreign_type type so that it records both the
C and IL foreign types. This will allow one to output both foreign
type declarations when doing intermodule optimization.
compiler/make_hlds.m:
Changes so that we store both the IL and C foreign types in
hlds_data__foreign_type.
Also add an error checking pass where we check that there is a
foreign type for the back-end we are currently compiling to.
compiler/foreign.m:
Change to_exported_type so that it works for both the C and IL
backends by getting either the C or IL foreign_type definition.
compiler/llds.m:
compiler/pragma_c_gen.m:
Change pragma_c_input and pragma_c_output so that they record
whether or not a type is a foreign_type and if so what is the string
which represents that foreign_type.
compiler/llds_out.m:
When outputting pragma c_code variables that represent foreign_types
get the casts correct. Note that this adds the constraint on C
foreign types that they are word sized, as all we are doing is
casts, not boxing and unboxing.
compiler/mlds.m:
Change mlds__foreign_type so that we store whether a type is an IL
type or a C type. It is the responsibility of the code generator
that we never create a reference to a IL foreign type when on the C
back-end, and vice versa.
compiler/mercury_to_mercury.m:
Handle changes to prog_data__foreign_type.
compiler/hlds_out.m:
compiler/intermod.m:
compiler/magic_util.m:
compiler/ml_code_gen.m:
compiler/ml_type_gen.m:
compiler/recompilation_usage.m:
compiler/term_util.m:
compiler/type_ctor_info.m:
compiler/unify_proc.m:
Handle changes to hlds_data__foreign_type.
compiler/exprn_aux.m:
compiler/livemap.m:
compiler/middle_rec.m:
compiler/opt_util.m:
Handle changes to the pragma_c_input and pragma_c_output types.
compiler/ml_code_util.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/mlds_to_c.m:
Handle changes to mlds__foreign_type.
Estimated hours taken: 2
Branches: main
doc/reference_manual.texi:
Improve the documentation regarding purity.
Make it clear that impure goals cannot change the declarative
semantics of pure goals (only the operational semantics).
Also make it clear that users should be careful around
promise_pure declarations, as both pure and impure predicates
can be in scope, so that the impure predicates may accidentally
modify the the declarative semantics of pure predicates.
Estimated hours taken: 40
Branches: main
Allow declarations of the form
:- pred p `with_type` higher_order_type `with_inst` higher_order_inst.
XXX We should allow `with_inst` annotations on higher-order terms.
compiler/prog_data.m:
Add fields to `pred_or_func' and `pred_or_func_mode'
items to hold the `with_type` and `with_inst` annotations.
compiler/prog_io.m:
compiler/prog_io_typeclass.m:
Parse the annotations.
compiler/module_qual.m:
Module qualify the annotations.
compiler/equiv_type.m:
Expand away `with_type` and `with_inst`. Report errors.
Strip items containing errors from the item list.
Record smart recompilation dependencies on the types and
modes expanded. Also record a dependency on the arity of
predicate and function declarations before expansion.
Use error_util for error messages.
compiler/mercury_to_mercury.m:
Write `with_type` and `with_inst` annotations to interface files.
compiler/make_hlds.m:
Ignore `with_type` and `with_inst` fields in predicate and
function declarations.
compiler/recompilation.m:
Changes to allow equiv_type.m to record dependencies on
arbitrary items, not just types.
compiler/recompilation_usage.m:
compiler/recompilation_check.m:
Allow searches in the sets of used predicates and functions using
name, not name and arity, as the key. This is needed because
the actual arity of a predicate defined using `with_type` is
not known when writing the interface files.
compiler/recompilation_version.m:
Handle `with_inst` and `with_type`.
Pragmas now need to be recorded in the version_numbers even
if there is no matching `:- pred' or `:- func' declaration --
the pragma may apply to a predicate or function declared using
`with_type`.
compiler/mode_util.m:
Export inst_subsitute_arg_list for use by equiv_type.m.
compiler/error_util.m:
Add predicate `pred_or_func_to_string'.
library/std_util.m:
Add std_util__map_foldl_maybe and std_util__map_foldl2_maybe,
which are like list__map_foldl and list__map_foldl2, but
apply to the item stored in a value of type std_util__maybe.
NEWS:
doc/reference_manual.texi:
Document the new syntax and library predicates.
tests/invalid/Mmakefile:
tests/invalid/with_type.m:
tests/invalid/with_type.err_exp:
tests/invalid/constrained_poly_insts.err_exp:
tests/recompilation/TESTS:
tests/recompilation/unchanged_with_type_nr*:
tests/recompilation/with_type_re*:
Test cases.
tests/invalid/errors1.err_exp:
tests/invalid/type_loop.err_exp:
tests/invalid/vars_in_wrong_places.err_exp:
Update expected output.
Estimated hours taken: 80
Branches: main
Extend constrained polymorphic modes to allow inst parameters to be
constrained to insts other than `ground'. The main motivation for this
is that for HAL we want inst parameters constrained to `any', however
this change is more general and allows inst parameters to be constrained
to any valid inst.
Introduce the syntax `InstParam =< Inst' to constrain an inst parameter
`InstParam' to an inst `Inst' in a predicate or function mode
declaration.
compiler/inst.m:
Add a new alternative `constrained_inst_var(inst_var, inst)' to
the `inst' type.
Remove `constrained_inst_var(inst_var)' alternative from the
`ground_inst_info' type.
compiler/inst_match.m:
compiler/inst_util.m:
compiler/modecheck_unify.m:
Make changes required to the core mode checking algorithms to
handle the change.
compiler/prog_io.m:
compiler/prog_io_util.m:
compiler/prog_io_goal.m:
compiler/prog_io_pragma.m:
compiler/prog_io_typeclass.m:
compiler/make_hlds.m:
Add support for `=<'/2 insts, but only when parsing predicate
and function mode declarations, lambda argument modes, and
pragmas.
Also add support for specifying inst constraints in the constraints list
for a declaration.
Make sure any unconstrained inst parameters in these
declarations are constrained to be `ground'.
Check that all constraints for a declaration are consistent,
i.e. the same constraint for every occurrence of an inst
parameter.
compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
Support printing of `=<'/2 insts.
compiler/mode_util.m:
compiler/module_qual.m:
compiler/pd_util.m:
compiler/recompilation_usage.m:
Handle the changes to the definition of the `inst' type.
doc/reference_manual.texi:
Document the change.
tests/valid/Mmakefile:
tests/valid/constrained_poly_insts.m:
tests/invalid/Mmakefile:
tests/invalid/constrained_poly_insts.m:
Add some test cases.