mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 14:57:03 +00:00
Estimated hours taken: 0.25 compiler/notes/COMPILER_DESIGN Updated now that common.m and excess.m are no longer separate passes. compiler/notes/TODO Remove duplicate call warning.
219 lines
6.3 KiB
Plaintext
219 lines
6.3 KiB
Plaintext
*******************************************************************************
|
|
|
|
TODO LIST:
|
|
----------
|
|
|
|
For more information on any of these issues, contact mercury@cs.mu.oz.au.
|
|
|
|
type system
|
|
-----------
|
|
|
|
- allow a module exporting an abstract type to specify that other modules
|
|
should not be allowed to test two values of that type for equality (similar
|
|
to Ada's limited private types). This would be useful for e.g. sets
|
|
represented as unordered lists with possible duplicates.
|
|
|
|
mode analysis
|
|
-------------
|
|
|
|
- extend the mode system to allow known aliasing.
|
|
This is needed to make partially instantiated modes and unique modes work.
|
|
[will be done by fjh]
|
|
|
|
- report an error if two mode declarations for a predicate
|
|
specify identical modes
|
|
|
|
- detect incorrect usage of `bound(...)' insts.
|
|
That is, make sure that all of the functors in a bound(...) inst
|
|
are valid functors for the type.
|
|
|
|
- split construct/deconstruct unifications into their atomic
|
|
"micro-unification" pieces when necessary.
|
|
(When is it necessary?)
|
|
|
|
determinism analysis
|
|
--------------------
|
|
|
|
- allow overloading of nondet/multidet and cc_nondet/cc_multidet
|
|
determinism for the same mode of a predicate.
|
|
|
|
unique modes
|
|
------------
|
|
|
|
- handle unique mode overloading better -
|
|
don't depend on the order of the mode declarations.
|
|
|
|
- handle overloading of unique and mostly_unique modes.
|
|
Currently in modes.m we always pick the unique version, and then in
|
|
unique_modes.m, if it turns out out to be mostly_unique, we report an
|
|
error. We should changed unique_modes.m to also look for a
|
|
mostly_unique version before reporting an error.
|
|
|
|
code generation
|
|
---------------
|
|
|
|
- take advantage of unique modes to do compile-time garbage collection
|
|
and structure reuse.
|
|
|
|
module system
|
|
-------------
|
|
|
|
- check that the interface for a module is type-correct
|
|
independently of any declarations or imports in the implementation
|
|
section
|
|
|
|
- implement a use_module directive
|
|
(like import_module, except that everything must be explicitly
|
|
module qualified).
|
|
|
|
- imports should not be transitive
|
|
(currently we get this right for predicates, constants, and functors,
|
|
but wrong for types, insts, and modes).
|
|
|
|
- produce warnings for imports that are not needed
|
|
[done by stayl]
|
|
|
|
- produce warnings for imports that are in the wrong place
|
|
(in the interface instead of the implementation, and vice versa)
|
|
[done by stayl]
|
|
|
|
C interface
|
|
-----------
|
|
|
|
- make C interface bidirectional: allow C programs to call Mercury programs
|
|
[is being done by dgj]
|
|
|
|
- support functions (currently c_code pragmas are only allowed for predicates,
|
|
not functions)
|
|
|
|
*******************************************************************************
|
|
|
|
WISH LIST
|
|
---------
|
|
|
|
typechecking
|
|
------------
|
|
|
|
- allow explicit type qualifications `X : Type'
|
|
[being done by stayl]
|
|
|
|
mode analysis:
|
|
--------------
|
|
|
|
- implement mode inference
|
|
[being worked on by pets]
|
|
|
|
- handle polymorphic modes (some research issues?)
|
|
|
|
- handle abstract insts in the same way abstract types are handled
|
|
(a research issue - is this possible at all?)
|
|
|
|
- implement `willbe(Inst)' insts?
|
|
[will be done by conway]
|
|
|
|
- mode segments & high-level transformation of circularly moded programs.
|
|
|
|
|
|
higher-order preds:
|
|
-------------------
|
|
|
|
- implement single-use higher-order predicate modes.
|
|
Single-use higher-order predicates would be allowed to bind curried
|
|
arguments, and to have unique modes for curried arguments.
|
|
|
|
- allow taking the address of a predicate with multiple modes
|
|
(This would require mode inference.)
|
|
|
|
|
|
code generation:
|
|
----------------
|
|
|
|
- The generated code should include some more profiling hooks.
|
|
In particular, we should add a version of the heap allocation
|
|
macro which takes an extra string parameter identifying which
|
|
routine allocated the memory. Then we can do heap-allocation
|
|
profiling to identify which routines use up all the bloody memory.
|
|
|
|
|
|
source-level transformations
|
|
----------------------------
|
|
|
|
- more work on module system, separate compilation, and the multiple
|
|
specialization problem
|
|
|
|
- deforestation
|
|
|
|
- transform non-tail-recursive predicates into tail-recursive form
|
|
using accumulators
|
|
[being worked on by jammb]
|
|
|
|
low-level optimizations
|
|
-----------------------
|
|
|
|
- reduce the overhead of higher-order predicate calls (avoid copying
|
|
the real registers into the fake_reg array and back)
|
|
|
|
- tail recursion optimization using pass-by-reference argument conventions
|
|
[being worked on by jammb]
|
|
|
|
- other specializations, e.g. if argument is known to be bound to
|
|
f(X,Y), then just pass X and Y in registers
|
|
|
|
- trim stack frames before making recursive calls, to minimize stack usage
|
|
[this would probably be a pessimization much of the time - zs]
|
|
|
|
compilation speed
|
|
-----------------
|
|
|
|
- improve efficiency of the expansion of equivalence types (currently O(N^2))
|
|
(e.g. this is particularly bad when compiling live_vars.m.)
|
|
|
|
- improve efficiency of the module import handling (currently O(N^2))
|
|
|
|
- improve the efficiency of mode checking very large facts
|
|
(e.g. this is particularly bad when compiling eliza.m.)
|
|
|
|
- improve the efficiency of the type_to_term and term_to_type implementation
|
|
so that we can enable them in the standard distribution of the Mercury
|
|
compiler
|
|
|
|
|
|
better diagnostics
|
|
------------------
|
|
|
|
- optional warning for any implicit quantifiers whose scope is not
|
|
the entire clause (the "John Lloyd" option :-).
|
|
|
|
- give a better error message for the use of if-then without else.
|
|
|
|
- give a better error message for the use of `<=' instead of `>='
|
|
(but how?)
|
|
|
|
- give a better error message for type errors involving higher-order pred
|
|
constants (requested by Bart Demoen)
|
|
|
|
- give better error messages for syntax errors in lambda expressions
|
|
|
|
general
|
|
-------
|
|
|
|
- coroutining and parallel versions of Mercury
|
|
[being worked on by conway]
|
|
|
|
- implement a very fast turn-around bytecode compiler/interpreter/debugger,
|
|
similar to Gofer
|
|
|
|
- implement a new backend which compiles to high-level C that can
|
|
be debugged at the Mercury source code level using gdb
|
|
[a start has been made by fjh]
|
|
|
|
- implement "accurate" garbage collection
|
|
[being worked on by trd]
|
|
|
|
- implement user-defined operators:
|
|
Add a new construct `:- op(Pred, Type, Op).' as in Prolog;
|
|
change prog_io.m to parse this construct and call io__op
|
|
accordingly. But how does this fit in with the module system?
|
|
|
|
*******************************************************************************
|