Estimated hours taken: 60
User-guided type specialization.
compiler/prog_data.m:
compiler/prog_io_pragma.m:
compiler/modules.m:
compiler/module_qual.m:
compiler/mercury_to_mercury.m:
Handle `:- pragma type_spec'.
compiler/prog_io_pragma.m:
Factor out some common code to parse predicate names with arguments.
compiler/hlds_module.m:
Added a field to the module_sub_info to hold information about
user-requested type specializations, filled in by make_hlds.m
and not used by anything after higher_order.m.
compiler/make_hlds.m:
For each `:- pragma type_spec' declaration, introduce a new predicate
which just calls the predicate to be specialized with the
specified argument types. This forces higher_order.m to produce
the specialized versions.
compiler/higher_order.m:
Process the user-requested type specializations first to ensure
that they get the correct names.
Allow partial matches against user-specified versions, e.g.
map__lookup(map(int, list(int)), int, list(int)) matches
map__lookup(map(int, V), int, V).
Perform specialization where a typeclass constraint matches a
known instance, but the construction of the typeclass_info is
done in the calling module.
Give slightly more informative progress messages.
compiler/dead_proc_elim.m:
Remove specializations for dead procedures.
compiler/prog_io_util.m:
Change the definition of the `maybe1' and `maybe_functor' types
to avoid the need for copying to convert between `maybe1'
and `maybe1(generic)'.
Changed the interface of `make_pred_name_with_context' to allow
creation of predicate names for type specializations which describe
the type substitution.
compiler/make_hlds.m:
compiler/prog_io_pragma.m:
Make the specification of pragma declarations in error
messages consistent. (There are probably some more to
be fixed elsewhere for termination and tabling).
compiler/intermod.m:
Write type specialization pragmas for predicates declared
in `.opt' files.
compiler/mercury_to_mercury.m:
Export `mercury_output_item' for use by intermod.m.
compiler/options.m:
Add an option `--user-guided-type-specialization' enabled
with `-O2' or higher.
compiler/handle_options.m:
`--type-specialization' implies `--user-guided-type-specialization'.
compiler/hlds_goal.m:
Add predicates to construct constants. These are duplicated
in several other places, I'll fix that as a separate change.
compiler/type_util.m:
Added functions `int_type/0', `string_type/0', `float_type/0'
and `char_type/0' which return the builtin types.
These are duplicated in several other places,
I'll fix that as a separate change.
library/private_builtin.m:
Added `instance_constraint_from_typeclass_info/3' to extract
the typeclass_infos for a constraint on an instance declaration.
This is useful for specializing class method calls.
Added `thread_safe' to various `:- pragma c_code's.
Added `:- pragma inline' declarations for `builtin_compare_*', which
are important for user-guided type specialization. (`builtin_unify_*'
are simple enough to go in the `.opt' files automatically).
compiler/polymorphism.m:
`instance_constraint_from_typeclass_info/3' does not need type_infos.
Add `instance_constraint_from_typeclass_info/3' to the
list of `typeclass_info_manipulator's which higher_order.m
can interpret.
NEWS:
doc/reference_manual.texi:
doc/user_guide.texi
Document the new pragma and option.
tests/invalid/Mmakefile:
tests/invalid/type_spec.m:
tests/invalid/type_spec.err_exp:
Test error reporting for invalid type specializations.
tests/hard_coded/Mmakefile:
tests/invalid/type_spec.m:
tests/invalid/type_spec.exp:
Test type specialization.
Estimated hours taken: 0.4
Add a new predicate to array.m: array__map.
NEWS:
mention the new predicate.
library/array.m:
add the new predicate array__map/3.
Estimated hours taken: 16
Add GNU readline support to the debugger.
Because GNU readline is licensed under the GPL, not the LGPL,
I was careful to ensure that (1) the readline library is
only linked into your application if it is compiled with
debugging enabled and (2) even in the latter case, the readline
support is disable-able (if you use the source distribution).
Mmakefile:
bindist/Mmakefile:
Add dependency of configure on new file aclocal.m4.
aclocal.m4:
Define a macro MERCURY_CHECK_READLINE to check for the readline
headers, the readline library, and for libraries needed by readline,
in particular -l{termcap,curses,ncurses}.
If they're not found, define MR_NO_USE_READLINE.
Otherwise, define various variables for using & installing readline.
bindist/bindist.configure.in:
configure.in:
Add call to MERCURY_CHECK_READLINE to check for readline.
scripts/ml.in:
If tracing is enabled, then (by default) link in readline,
and hence also termcap/curses/ncurses.
Add a new option `--no-readline' to disable this.
trace/mercury_trace_internal.c:
Delete the FILE * parameter from the MR_getline() function,
because there are actually two files involved (MR_mdb_in and
MR_mdb_out), and they are always the same for all calls to this
function.
Also change this function so that it calls MR_trace_readline() rather
than printing the prompt and then calling MR_trace_getline_raw().
Delete the MR_trace_getline_raw() function -- this has been renamed
as MR_trace_readline_raw() and moved to mercury_trace_readline.c.
trace/mercury_trace_readline.h:
trace/mercury_trace_readline.c:
New module containing a new function MR_trace_readline() that prints
a prompt and reads a line in by calling the readline library.
I put all this new code inside `#ifndef MR_NO_USE_READLINE' so that
the use of readline can be disabled. If that symbol is defined,
it reverts to the old implementation using MR_trace_readline_raw()
(formerly called MR_trace_getline_raw()).
runtime/mercury_conf.h.in:
Define the new configuration parameter `MR_NO_USE_READLINE'.
trace/Mmakefile:
Add the new files mercury_trace_readline.[ch].
Ensure that this new module is compiled with warnings disabled,
to avoid spurious warnings resulting from the readline header files.
Also simplify the code by deleting unnecessary uses of $(EXTRA_*) --
that's handled by scripts/Mmake.vars now.
NEWS:
Mention the readline support.
.INSTALL.in:
Mention that it is helpful to have GNU Readline installed.
bindist/bindist.INSTALL:
Mention that you may need to have GNU Readline installed.
Estimated hours taken: 0.5
Deprecate the old style of lambda expressions.
NEWS:
doc/reference_manual.texi:
Document that the old-style lambda expressions are now deprecated.
compiler/notes/todo.html:
Mention that we should warn about the use of old-style lambda
expressions.
Estimated hours taken: 1
Change the bit shift functions to perform checking to avoid
implementation defined behaviour.
library/int.m:
Add checking to `int:<<' and `int:>>'.
Add `int:unchecked_left_shift' and `int:unchecked_right_shift'
which do not perform any checking.
compiler/code_util.m:
Replace `int:<<' and `int:>>' with `int:unchecked_left_shift' and
`int:unchecked_right_shift' in the builtin table.
NEWS:
Mention the changes to int.m.
tests/hard_coded/Mmakefile:
tests/hard_coded/shift_test.m:
tests/hard_coded/shift_test.exp:
Test the shift functions.
Estimated hours taken: 1
library/float.m:
Uncomment some `:- pragma obsolete' declarations, since the
bug that caused them to be commented out was fixed years ago.
Add `:- pragma obsolete' declarations for some predicate versions
of functions, and move them out of the Library Reference Manual.
Define obselete predicates in terms of non-obsolete functions
rather than the other way around.
NEWS:
Document the obsolete predicates.
Estimated hours taken: 5
Remove support for NU-Prolog and SICStus Prolog.
The reasons for this are:
(a) We now have a proper working debugger, so we don't need to use
NU-Prolog or SICStus Prolog for debugging.
(b) The Prolog support was only ever a hack, not a proper solution;
Mercury language features like functions or mode reordering
were never supported.
(c) It was a maintenance problem.
compiler/make_hlds.m:
Warn that NU-Prolog `when' declarations are deprecated.
compiler/prog_io.m:
Update a comment to say that NU-Prolog `when' declarations
are now deprecated.
library/*.m:
Delete `when' declarations.
configure.in:
bindist/bindist.configure.in:
Delete the autoconf tests for NU-Prolog and SICStus Prolog.
Delete the stuff for generating the NU-Prolog and SICStus Prolog
scripts.
tools/bootcheck:
Delete the options for testing using SICStus Prolog.
library/Mmakefile:
Delete the rules for building NU-Prolog and SICStus Prolog stuff.
library/library.nu.nl.in:
library/swi_*.m:
library/*.nu.nl:
library/array.nu.nl:
library/assoc_list.nu.nl:
library/char.nu.nl:
library/float.nu.nl:
library/int.nu.nl:
library/io.nu.nl:
library/library.nu.nl.in:
library/map.nu.nl:
library/mercury_builtin.nu.nl:
library/nc_builtin.nl:
library/require.nu.nl:
library/sp_builtin.nl:
library/sp_lib.nl:
library/std_util.nu.nl:
library/store.nu.nl:
library/string.nu.nl:
library/swi_builtin.m:
library/swi_lib.m:
library/term_io.nu.nl:
Delete these files.
scripts/mnc.in:
scripts/mnp.in:
scripts/mnl.in:
scripts/msc.in:
scripts/msl.in:
scripts/msp.in:
Delete these files.
doc/user_guide.texi:
Delete the documentation about the Prolog support.
NEWS:
w3/news/newsdb.inc:
Mention that we've removed the Prolog support.
Estimated hours taken: 5
extras/dynamic_linking/dl.m:
New module, containing support for dynamic linking
(i.e. a binding to dlopen(), dlsym(), and dlclose()).
extras/dynamic_linking/name_mangle.m:
New module, containing a representation for Mercury procedure
specifiers and a function for mangling them into symbol names.
extras/dynamic_linking/dl_test.m:
extras/dynamic_linking/dl_test.exp:
extras/dynamic_linking/hello.m:
A test case (and sample program) for the use of dynamic linking.
extras/dynamic_linking/README:
A brief README file describing the files in this directory.
extras/dynamic_linking/Mmakefile:
A simple Mmakefile to build it all and test it.
NEWS:
Mention the new dynamic linking support.
compiler/llds_out.m:
Add some comments warning about code duplication
between the code here and that in extras/dynamic_linking/name_mangle.m
(and also profiler/demangle.m and util/mdemangle.c).
Estimated hours taken: 0.1
library/bag.m:
Add a new predicate bag__count_value/3 which returns how
many of a value a bag contains.
NEWS:
Mention bag__count_value/3.
Estimated hours taken: 20
These changes make `var' and `term' polymorphic. This allows us to make
variables and terms representing types of a different type to those
representing program terms and those representing insts.
These changes do not *fix* any existing problems (for instance
there was a messy conflation of program variables and inst variables,
and where necessary I've just called varset__init(InstVarSet) with
an XXX comment).
NEWS:
Mention the changes to the standard library.
library/term.m:
Make term, var and var_supply polymorphic.
Add new predicates:
term__generic_term/1
term__coerce/2
term__coerce_var/2
term__coerce_var_supply/2
library/varset.m:
Make varset polymorphic.
Add the new predicate:
varset__coerce/2
compiler/prog_data.m:
Introduce type equivalences for the different kinds of
vars, terms, and varsets that we use (tvar and tvarset
were already there but have been changed to use the
polymorphic var and term).
Also change the various kinds of items to use the appropriate
kinds of var/varset.
compiler/*.m:
Thousands of boring changes to make the compiler type correct
with the different types for type, program and inst vars and
varsets.
Estimated hours taken: 0.25
Update a few files in preparation for release 0.8.
BUGS:
Delete one of the bugs from the list, since we have basically
fixed that one.
NEWS:
s/typeclasses/type classes/g
Estimated hours taken: 0.5
Update a few files in preparation for release 0.8.
NEWS:
Put the main sections in reverse chronological order,
i.e. 0.8, then 0.7.3, then 0.7.2, rather than 0.7.2, 0.7.3, then 0.8.
This is better since the changes in 0.7.2 and 0.7.3 are old news.
Also a few minor changes, such as deleting the XXX about
`pragma import' and nondet `pragma c_code' not being documented.
RELEASE_NOTES:
Update for 0.8.
configure.in:
Update the test for recently-added features to test for
`promise_only_solution'. That should be recent enough
to ensure that we can bootstrap.
Estimated hours taken: 2
library/map.m:
Add some predicates that may be generally useful. Some of them
are needed in a near-future change to the compiler.
NEWS:
Mention the new predicates.
Estimated hours taken: 0.1
NEWS:
Mention recent changes to the mtags script.
Index: NEWS
===================================================================
RCS file: /home/staff/zs/imp/mercury/NEWS,v
retrieving revision 1.119
diff -u -r1.119 NEWS
--- 1.119 1998/09/10 06:53:16
+++ NEWS 1998/09/11 01:42:48
@@ -487,3 +487,8 @@
* XXX remove the X debugger command
* We've made the MERCURY_OPTIONS environment variable somewhat easier to use.
+
+* Mtags is now able to produce tags for typeclass declarations. It is
+ also able to produce tags files in the extended format supported by
+ recent versions of Vim and Elvis. Do `mtags --help' for more
+ information.
Estimated hours taken: 50
Rework the handling of types in higher_order.m.
- Fix bugs in higher_order.m that stopped it working with --typeinfo-liveness.
- Perform type and typeclass specialisation.
compiler/polymorphism.m:
Previously the type of typeclass_infos variables did not contain
any information about the constraint about which the variable contains
information. Now the type of a typeclass_info is
`private_builtin:typeclass_info(
private_builtin:constraint([ClassName, ConstrainedTypes]))'.
This allows predicates such as type_list_subsumes to check that
the class constraints match.
Note that `private_builtin:constraint' has no declaration, so
a lookup in the type definition map will fail. That's OK, because
type_to_type_id will fail on it, so it will be treated as a type
variable by any code which doesn't manipulate types directly.
Added polymorphism__typeclass_info_class_constraint to get the
class_constraint from a typeclass_info's type. This isn't used yet.
Also, fix a bug in extract_type_info: an entry in the typeinfo_var_map
was being overwritten using an entry from a dummy typevarset. Actually
the optimization to overwrite the location of the type_info after
extracting it from a typeclass_info was wrong because the type_info
won't be in that location in other branches.
compiler/higher_order.m:
Rework the handling of type substitutions. Now the types of the
called procedure are `inlined' into the calling procedure, rather
than building up the types of the specialised version using the
higher-order arguments. The advantage of this is that the code is
a bit simpler and handles extra type_infos properly. The disadvantage
is that the argument types for specialised versions may be more
specific than they need to be, so in some cases more specialised
versions will be created than before.
Also, don't actually rebuild the higher-order terms in the specialised
versions - just pass the terms through in case they are needed.
Handle the extra typeinfos required for --typeinfo-liveness.
Specialize calls to unify/2, index/2 and compare/3.
Specialize class_method_calls.
Specialize calls to the predicates in private_builtin.m which
manipulate typeclass_infos.
compiler/type_util.m:
type_to_type_id now fails on the dummy `constraint' type.
Remove typeinfos for non-variable types from the typeinfo_varmap
after inlining and higher-order specialisation.
compiler/inlining.m:
Factor out some common code to handle type substitutions
for use by higher_order.m.
compiler/hlds_pred.m:
Return the list of extra type_info variables added to the
argument list.
compiler/goal_util.m:
Take a set of non-locals as an argument to
goal_util__extra_nonlocal_typeinfos rather than extracting
them from a goal.
compiler/special_pred.m:
Handle unmangled unify/compare/index in special_pred_get_type.
compiler/base_type_layout.m:
Don't generate references to the typeinfo for
`private_builtin:constraint' - it doesn't exist.
compiler/unused_args.m:
Don't barf on specialised unification predicate names.
compiler/options.m:
Added options:
`--type-specialization' (default off).
`--higher-order-size-limit' - restrict the size of specialized
versions produced by higher_order.m.
`--disable-opt-for-trace' (default on) - where possible don't
change the options to make the trace match the source code.
compiler/handle_options.m:
Don't disable higher_order.m when --typeinfo-liveness is set.
Handle `--disable-opt-for-trace'.
compiler/hlds_data.m:
compiler/*.m:
Add the instance number to `base_typeclass_info_const' cons_ids,
so that higher_order.m can easily index into the list of instances
for a class to find the methods.
compiler/hlds_out.m:
Use the correct varset when printing out the constraint proofs.
Write the typeclass_info_varmap for each procedure.
compiler/mercury_to_mercury.m:
Print type variables with variable numbers.
library/private_builtin.m:
Add the argument to the typeclass_info type to hold the representation
of the constraint.
runtime/mercury_ho_call.c:
Semidet and nondet class_method_calls where
(0 < num_arg_typeclass_infos < 4) were aborting at runtime
because arguments were being placed starting at r1 rather
than at r(1 + num_arg_typeclass_infos).
doc/user_guide.texi
Document the new options.
compiler/notes/compiler_design.html:
Update the role of higher_order.m.
tests/hard_coded/typeclasses/extra_typeinfo.m:
Test case for the mercury_ho_call.c bug and the polymorphism.m
extract_typeinfo bug and for updating the typeclass_info_varmap
for specialised versions.
Estimated hours taken: 10
library/io.m:
library/io.nu.nl:
Implement io__read_line_as_string/{3,4}.
Also sneaked in here are some trivial whitespace fixes in some
of the pragma c_code which did not comply with our coding
standards (to do with type casting).
samples/cat.m:
samples/sort.m:
Use io__read_line_as_string.
tests/general/Mmakefile:
tests/general/read_line_as_string.exp:
tests/general/read_line_as_string.m:
Test case for io__read_line_as_string.
NEWS:
Mention the above change.
Estimated hours taken: 3
library/math.m:
library/float.m:
Addition of four new system constants (float__radix,
float__mantissa_digits, float__min_exponent and
float__max_exponent) plus predicate equivalents. Also
added in some extra documentation for the other constants.
Rename floating point constants using the C coding standard
way (ML_*).
Put code for mathematical domain checking inside
`#ifndef ML_OMIT_MATH_DOMAIN_CHECKS', so that the user
can disable domain checking. (Note: This is actually safe,
since the combination of floating point hardware and -lm
should do all these checks for you.)
NEWS:
Mention the above changes.
Estimated hours taken: 1
Various changes to the README files, in preparation for the next release.
.README.in:
Update version numbers and copyright dates.
Update the list of README.* files.
README.HPUX:
New file.
README.AIX:
Update to reflect recent bug fix.
README.Linux:
Delete an obsolete patch at the end of this file;
the text describing this patch had been removed already.
README.MS-Windows:
Mention that we haven't tested it on Windows 98.
NEWS:
We've updated to Boehm GC version 4.13alpha2.
extras/README:
Add descriptions of each subdirectory.
Estimated hours taken: 0.5
Phase out term__compare/4, since it is error-prone (the comparison
includes the term__contexts, which is probably not what you want)
and in general is probably not quite the right interface.
In addition, it's probably not of sufficient usefulness to
warrant inclusion in the standard library -- programmers can always
implement it themselves.
library/term.m:
Add `pragma obsolete' declaration and some comments for
term__compare/4, and move the declaration into a separate
interface section so that it won't appear in the library
reference manual.
NEWS:
Mention this change.
Estimated hours taken: 5
Bring the handling of MERCURY_OPTION into the 90s (a bit late :-).
Get rid of lack-of-prototype warnings from getopt.h.
runtime/getopt.[ch]:
runtime/getopt1.c:
runtime/GETOPT:
runtime/GETOPT/getopt.[ch]:
runtime/GETOPT/getopt1.c:
Move these files to a new subdirectory, GETOPT. This should avoid
the nuisance warnings one gets when stdlib.h picks up the getopt.h
in the runtime directory by accident. (The GETOPT directory should
never need to be included in -I search paths.)
runtime/mercury_getopt.[ch]:
runtime/mercury_getopt1.c:
Copies of the files in GETOPT, slightly modified to make sure that
(1) every external symbol they define starts with MR_, and (2)
we get a minimal number of compilation errors (as of now, 3 warnings
about casting away const).
These files are not to be modified by humans.
runtime/process_getopt:
This is the script that creates mercury_getopt{.h,.c,1.c} from the
files in GETOPT.
runtime/mercury_wrapper.c:
Get rid of the -s<area><size> notation, which can hard to remember,
and replace it with long options such as --heap-size=1024.
Print an error message and stop if MERCURY_OPTIONS contains anything
other than options.
Refer to everything from mercury_getopt.h with a name that starts with
MR_.
runtime/Mmakefile:
Mention the new source files.
doc/user_guide.texi:
Document the new options.
NEWS:
Mention the new options.
Estimated hours taken: 3
Add Mmake support for target-specific MCFLAGS flags (MCFLAGS-foo, etc.)
using some tricky GNU Make hackery that avoids warning about undefined
variables.
Also define ALL_MCFLAGS = $(MCFLAGS) $(TARGET_MCFLAGS) $(EXTRA_MCFLAGS)
and use $(ALL_MCFLAGS) instead of $(MCFLAGS). This allows user Mmakefiles
to override MCFLAGS without suppressing the use of the TARGET_MCFLAGS
and EXTRA_MCFLAGS.
Similarly for the other *FLAGS variables.
scripts/Mmake.vars.in:
Define ALL_*FLAGS and TARGET_*FLAGS.
scripts/Mmake.rules:
Use ALL_*FLAGS instead of *FLAGS.
scripts/mmake.in:
Re-enable the warnings about undefined variables,
since we won't get too many spurious warnings now.
Mmake.common.in:
Delete `$(MCFLAGS-$*)' from the definition of `MCFLAGS', since this
is now done automatically by Mmake.
tests/Mmake.common:
Delete the definitions of MCFLAGS and GRADEFLAGS, since this stuff
is now done automatically by Mmake.
doc/user_guide.texi:
NEWS:
Document these changes.
Estimated hours taken: 4
Port Mercury to cygwin32 version b19 and to binutils 2.9.1 on that platform.
boehm_gc/config.h:
Change the definition of DATASTART and DATAEND for cygwin32
to work with binutils 2.9.1.
README.MS-Windows:
Mention that for b19, you need to use egcs 1.0.2
instead of the gcc that comes with b19.
NEWS:
Mention these changes.
Estimated hours taken: 4
This change makes the parsing of GRADE/--grade strings more flexible.
The GRADE string can now have its components given in any order. The
only places that depend on the order are those that use the grade as
part of a pathname: ml and install_grades. There is also a new option
to the compiler `--output-grade-string' which prints the grade string
for the set of options given to mmc/mmake.
NEWS:
mention the changes.
compiler/handle_options.m:
Reimplement convert_grade_option to accept a grade string with
its components in any order. The conversion is now table-driven,
which should make it easier to add new dimensions to the grade
and new values to existing ones.
Reimplement compute_grade to use the same table as
convert_grade_option.
compiler/mercury_compile.m:
If --output-grade-string option was given, just compute the
grade string and print it.
compiler/options.m:
Add the --output-grade-string option.
library/list.m:
Add an extra mode to list__foldl2 (gee, it would be nice to be
able to make higher order predicates polymorphic in their
determinism).
scripts/ml.in:
Include .par in the grade string. (bugfix)
scripts/parse_grade_options.sh-subr:
split the grade string into . separated pieces and process them
in a loop, setting the appropriate options.
doc/user_guide.texi:
Add documentation on --output-grade-string.
Change the description of how grades are handled to match
the implementation. Add a some missing bits.
Estimated hours taken: 0.1
NEWS:
Undo Zoltan's (accidental?) changes to the ordering.
Changes to language features are now documented in the same
order as those features are documented in the
Mercury language reference manual.
Estimated hours taken: 2
Various changes to make the `--debug' option work.
compiler/options.m:
Fix an omission in a previous change of mine:
add a special_handler for the `--debug' option.
compiler/handle_options.m:
scripts/mgnuc.in:
scripts/ml.in:
Make the .debug grade imply --use-trail. The reason for this is
to avoid unnecessary proliferation in the number of different grades.
If you're using .debug, you've already taken a major performance
hit, so you should be able to afford the performance hit caused
by --use-trail.
configure.in:
Include a `.tr.debug' grade in LIBGRADES, which holds the set of
library grades that get installed.
scripts/mdb:
NEWS:
Update some obsolete documentation referring to the old
`--generate-trace' option.
NEWS:
Update some more obsolete documentation listing the commands
supported by the debugger and describing how to build programs
with debugging enabled.
Estimated hours taken: 20
Allow the debugger to print the values of variables in ancestors
of the current call. This requires knowledge about which named variables
are live at call return sites. Providing this information properly required
fixing the interaction of execution tracing and accurate garbage collection.
compiler/globals.m:
Introduce a new trace level, so that there are now four:
none, interface, interface_ports (corresponding to the existing
three levels) and the new level interface_ports_returns,
each of which requires all the information required by lower
levels.
Make the trace level abstract, since in the future we may want to
introduce trace levels for new combinations, e.g. interfaces and
returns but not internal ports. Introduce the necessary new
predicates.
compiler/continuation_info.m:
Redefine internal_label_info to allow us to record separate info about
the sets of vars needed at (a) internal ports of execution tracing
and at (b) call return points for accurate gc or (now) uplevel
printing during execution tracing. Neither is a subset of the other,
and they need to be treated differently.
compiler/mercury_compile.m:
Gather information about vars at return labels if the trace level
requires uplevel printing capability, even if agc is off.
compiler/stack_layout.m:
Fix the handling of labels which are needed both by agc and by
execution tracing. If information at a return label is needed only
by uplevel printing in execution tracing and not by agc, then
discard all info about lvals which do not hold named variables
or their typeinfos (in fact we keep all typeinfos at the moment).
If a label is both the label of a port and a return label, we
include in the layout structure the union of the information
recorded for the two roles.
Sort the var_info vector before using it to generate layout
structures in an attempt to make llds_common more effective
and to make lists of variables printed by the debugger look better.
Record a distinguished value when there is no info about the vars
live at a label, rather than (incorrectly) recording that there
are no live variables. Before up-level printing, the lie was harmless;
now it isn't.
Remove the label number from return label layouts, since the tracer
isn't expecting it. It used to be included for debugging purposes
if the label was for agc, but it is possible for a label to be needed
both for agc and for execution tracing. If Tyson finds he needs the
label number, it can be easily turned back on for all label layouts.
compiler/code_info.m:
Conform to the new definition of internal_label_info.
Rename an internal pred for clarity.
Rename some bool parameter to correctly reflect their new meaning.
compiler/*.m:
Trivial changes, mostly due to making trace_level an abstract type.
runtime/mercury_stack_layout.h:
Remove the label number from return label layouts, since the tracer
isn't expecting it.
runtime/mercury_stack_trace.[ch]:
Add a new function that returns the label layout structure at the
Nth ancestor return continuation, together with the values of
sp and curfr at that point. This required changing MR_stack_walk_step
to step from an entry layout only to the return label layout.
runtime/mercury_stacks.h:
Add macros that let us access detstackvars and framevars based on
these synthesized values of sp and curfr.
runtime/mercury_trace_util.[ch]:
Generalize several functions to allow them to use synthesized
(as opposed to saved) values of sp and curfr in looking up values.
Retain functions with the original names and signatures that call
the new, general versions with the necessary additional parameters.
runtime/mercury_trace_internal.c:
Add a new command that sets the "ancestor level". For example,
"l 2" sets it to 2, which means that the command "v" and "p" will
refer to the grandparent of the current call. The ancestor level
persists while the debugger is at the current event; after that
it is reset to 0.
The implementation involves calling the new function in
mercury_stack_trace.c and the generalized functions in
mercury_trace_util.c.
Also add a deliberately undocumented extra command, X, which
prints the stack pointers.
NEWS:
Add a reminder about removing the X command before release.
tests/debugger/*
Update half the test cases (those which assume a non-debug-grade
library) to conform to the changes in the debugger interface.
The others will need to be updated later.
Estimated hours taken: 3
Allow a predicate to have matching `cc' and `non-cc' modes.
compiler/det_analysis.m:
If there is a call to a cc procedure in a non-cc context,
then search for a mode of that predicate which is
identical to the called mode except that it is not cc.
If such a mode is found, use it, rather than reporting
an error.
compiler/modecheck_call.m:
Add predicate modes_are_identical_bar_cc, for use by
det_analysis.m.
NEWS:
LIMITATIONS:
doc/reference_manual.texi:
Document the new feature and delete documentation about the
lack of this feature.
tests/hard_coded/Mmakefile:
tests/hard_coded/cc_and_non_cc_test.m:
tests/hard_coded/cc_and_non_cc_test.exp:
Add a test case for the new feature.
Estimated hours taken: 6
Add Mmake support for nested sub-modules.
compiler/mercury_compile.m:
compiler/modules.m:
compiler/intermod.m:
Pass down the source file name to various places.
Store the source file name in the module_imports data structure.
In various places, use this source file name instead of assuming
that the source file name can be obtained from the module name.
compiler/modules.m:
Change the generated .d and .dep files to use the source file names.
Add hard-coded rules in the .d files if the source file name does not
match the form expected by the pattern rules in scripts/Mmake.rules.
XXX unfortunately the rules don't work right for parallel makes of
nested modules
scripts/Mmake.rules:
Add a comment saying that any changes here might need to
be duplicated in compiler/modules.m.
tests/hard_coded/Mmakefile:
tests/hard_coded/nested.m:
tests/hard_coded/nested2.m:
tests/hard_coded/nested.exp:
tests/hard_coded/nested2.exp:
Add a couple of test cases for nested modules (XXX not enabled,
due to the above-mentioned problem with parallel makes).
doc/reference_manual.texi:
Update the "implementation bugs and limitations" section.
NEWS:
Update the news about nested modules.
Estimated hours taken: 400
Deforestation.
This increases the code size of the compiler by ~80k when compiling
with --intermodule-optimization --deforestation.
The improvement from deforestation is not measurable for mmc -C make_hlds.m.
Compile time for make_hlds.m increased from 50.7 seconds to 52.2 seconds
when running deforestation.
compiler/simplify.m
compiler/common.m
Provide a nicer interface for simplifying a goal,
not an entire procedure.
Rework the interface to avoid manipulating lots of booleans.
Return an estimate of the improvement in cost from simplification.
Remove failing cases and disjuncts.
Add an option to optimize common structures even across calls.
Remove code to merge branched goals, since that is now
done by deforestation.
Fix a bug: the code to collect instmap_deltas for cases was not
including the switched-on variable in the instmap_delta,
which caused an abort in merge_instmap_delta if the switched
on variable was further instantiated in the switch.
This came up while compiling the compiler with --deforestation.
compiler/det_report.
Output duplicate call warnings even if --warn-simple-code is not set.
XXX fix the same problem with `:- pragma obsolete'.
compiler/code_aux.m
Update code_aux__cannot_loop to use termination information.
compiler/hlds_pred.m
compiler/dnf.m
Pass the type_info_varmap and typeclass_info_varmap
into hlds_pred__define_new_pred.
Restrict the variables of the new procedure onto the variables
of the goal.
Make sure all relevant type_infos are passed into the new
procedure if --typeinfo-liveness is set.
compiler/modes.m
compiler/unique_modes.m
compiler/mode_info.m
compiler/modecheck_unify.m
Put `how_to_check_goal' into the mode_info, rather
than passing it around.
Add a field to the `check_unique_modes' case which
controls whether unique modes is allowed to choose
a different procedure. For deforestation, this is
not allowed, since it could result in choosing a less
efficient procedure after generalisation.
compiler/options.m
New options:
--deforestation
--deforestation-depth-limit
Safety net for termination of the algorithm.
--deforestation-cost-factor
Fudge factor for working out whether deforestation
was worthwhile.
--deforestation-vars-threshold
Like --inline-vars-threshold.
Enable deforestation at -O3.
Removed an unnecessary mode for option_defaults_2, since it
resulted in a warning about disjuncts which cannot succeed.
compiler/handle_options.m
--no-reorder-conj implies --no-deforestation.
compiler/inlining.m
Separate code to rename goals into inlining__do_inline_call.
compiler/hlds_goal.m
Added predicates goal_list_nonlocals, goal_list_instmap_delta
and goal_list_determinism to approximate information about
conjunctions.
compiler/hlds_module.m
Added module_info_set_pred_proc_info to put an updated
pred_info and proc_info back into the module_info.
compiler/hlds_out.m
Exported hlds_out__write_instmap for debugging of deforestation.
Bracket module names on constructors where necessary.
compiler/mercury_compile.m
Call deforestation.
Use the new interface to simplify.m.
compiler/intermod.m
Put recursive predicates with a top-level branched goal
into `.opt' files.
goal_util.m
Added goal_calls_pred_id to work out if a predicate is
recursive before mode analysis.
Export goal_util__goals_goal_vars for use by deforestation.
Give a better message for a missing variable in a substitution.
compiler/instmap.m
Give a better message for inst_merge failing.
compiler/notes/compiler_design.m
Document the new modules.
library/varset.m
Add varset__select to project a varset's names and values
onto a set of variables.
doc/user_guide.texi
Document deforestation.
Remove a reference to a non-existent option, --no-specialize.
util/mdemangle.c
profiler/demangle.m
tests/misc_tests/mdemangle_test.{exp,inp}
Handle the `DeforestationIn__' predicate names introduced by
deforestation, similar to the `IntroducedFrom__' for lambda goals.
New files:
deforest.m Deforestation.
pd_cost.m Cost estimation.
pd_debug.m Debugging output.
pd_info.m State type and version control.
pd_term.m Termination checking.
pd_util.m Utility predicates
Estimated hours taken: 13
library/integer.m:
Implementation of an arbitrary precision integer type and
operations on it.
library/rational.m:
Implementation of arbitrary precision rational numbers.
library/library.m:
Necessary changes for adding the above two modules.
NEWS:
Noted the addition of the above two modules.
Estimated hours taken: 0.5
library/std_util.m:
library/term.m:
Move det_univ_to_type from term.m to std_util.m, and
add better error reporting (print the types of the univ
and the data).
NEWS:
Document this change to std_util.
Estimated hours taken: 0.5
NEWS:
mention the changes to map and tree234.
library/map.m:
added map__foldl/4 and map__map_values/3 which forward to the
corresponding predicates in tree234.
library/tree234.m:
implement tree234__foldl and tree234__map_values.
Estimated hours taken: 2
library/relation.m:
Add new predicate relation__add_values.
Implement the previously commented-out predicates
relation__from_assoc_list and relation__compose.
Change relation__to_assoc_list so that it returns
an assoc list of values rather than an assoc list
of relation_keys.
NEWS:
Document the above changes.
tests/general/Mmakefile:
tests/general/relation_test.m:
tests/general/relation_test.exp:
Add a few tests of the relation module.
Estimated hours taken: 0.5
library/bag.m:
Add two predicates to bag.m, bag__remove_list/3 and
bag__det_remove_list/3.
Add an extra line to each pred comment in the interface to
make them a bit more readable.
NEWS:
Note the new predicates.
Estimated hours taken: 50
Add support for nested modules.
- module names may themselves be module-qualified
- modules may contain `:- include_module' declarations
which name sub-modules
- a sub-module has access to all the declarations in the
parent module (including its implementation section).
This support is not yet complete; see the BUGS and LIMITATIONS below.
LIMITATIONS
- source file names must match module names
(just as they did previously)
- mmc doesn't allow path names on the command line any more
(e.g. `mmc --make-int ../library/foo.m').
- import_module declarations must use the fully-qualified module name
- module qualifiers must use the fully-qualified module name
- no support for root-qualified module names
(e.g. `:parent:child' instead of `parent:child').
- modules may not be physically nested (only logical nesting, via
`include_module').
BUGS
- doesn't check that the parent module is imported/used before allowing
import/use of its sub-modules.
- doesn't check that there is an include_module declaration in the
parent for each module claiming to be a child of that parent
- privacy of private modules is not enforced
-------------------
NEWS:
Mention that we support nested modules.
library/ops.m:
library/nc_builtin.nl:
library/sp_builtin.nl:
compiler/mercury_to_mercury.m:
Add `include_module' as a new prefix operator.
Change the associativity of `:' from xfy to yfx
(since this made parsing module qualifiers slightly easier).
compiler/prog_data.m:
Add new `include_module' declaration.
Change the `module_name' and `module_specifier' types
from strings to sym_names, so that module names can
themselves be module qualified.
compiler/modules.m:
Add predicates module_name_to_file_name/2 and
file_name_to_module_name/2.
Lots of changes to handle parent module dependencies,
to create parent interface (`.int0') files, to read them in,
to output correct dependencies information for them to the
`.d' and `.dep' files, etc.
Rewrite a lot of the code to improve the readability
(add comments, use subroutines, better variable names).
Also fix a couple of bugs:
- generate_dependencies was using the transitive implementation
dependencies rather than the transitive interface dependencies
to compute the `.int3' dependencies when writing `.d' files
(this bug was introduced during crs's changes to support
`.trans_opt' files)
- when creating the `.int' file, it was reading in the
interfaces for modules imported in the implementation section,
not just those in the interface section.
This meant that the compiler missed a lot of errors.
library/graph.m:
library/lexer.m:
library/term.m:
library/term_io.m:
library/varset.m:
compiler/*.m:
Add `:- import_module' declarations to the interface needed
by declarations in the interface. (The previous version
of the compiler did not detect these missing interface imports,
due to the above-mentioned bug in modules.m.)
compiler/mercury_compile.m:
compiler/intermod.m:
Change mercury_compile__maybe_grab_optfiles and
intermod__grab_optfiles so that they grab the opt files for
parent modules as well as the ones for imported modules.
compiler/mercury_compile.m:
Minor changes to handle parent module dependencies.
(Also improve the wording of the warning about trans-opt
dependencies.)
compiler/make_hlds.m:
compiler/module_qual.m:
Ignore `:- include_module' declarations.
compiler/module_qual.m:
A couple of small changes to handle nested module names.
compiler/prog_out.m:
compiler/prog_util.m:
Add new predicates string_to_sym_name/3 (prog_util.m) and
sym_name_to_string/{2,3} (prog_out.m).
compiler/*.m:
Replace many occurrences of `string' with `module_name'.
Change code that prints out module names or converts
them to strings or filenames to handle the fact that
module names are now sym_names intead of strings.
Also change a few places (e.g. in intermod.m, hlds_module.m)
where the code assumed that any qualified symbol was
fully-qualified.
compiler/prog_io.m:
compiler/prog_io_goal.m:
Move sym_name_and_args/3, parse_qualified_term/4 and
parse_qualified_term/5 preds from prog_io_goal.m to prog_io.m,
since they are very similar to the parse_symbol_name/2 predicate
already in prog_io.m. Rewrite these predicates, both
to improve maintainability, and to handle the newly
allowed syntax (module-qualified module names).
Rename parse_qualified_term/5 as `parse_implicit_qualified_term'.
compiler/prog_io.m:
Rewrite the handling of `:- module' and `:- end_module'
declarations, so that it can handle nested modules.
Add code to parse `include_module' declarations.
compiler/prog_util.m:
compiler/*.m:
Add new predicates mercury_public_builtin_module/1 and
mercury_private_builtin_module/1 in prog_util.m.
Change most of the hard-coded occurrences of "mercury_builtin"
to call mercury_private_builtin_module/1 or
mercury_public_builtin_module/1 or both.
compiler/llds_out.m:
Add llds_out__sym_name_mangle/2, for mangling module names.
compiler/special_pred.m:
compiler/mode_util.m:
compiler/clause_to_proc.m:
compiler/prog_io_goal.m:
compiler/lambda.m:
compiler/polymorphism.m:
Move the predicates in_mode/1, out_mode/1, and uo_mode/1
from special_pred.m to mode_util.m, and change various
hard-coded definitions to instead call these predicates.
compiler/polymorphism.m:
Ensure that the type names `type_info' and `typeclass_info' are
module-qualified in the generated code. This avoids a problem
where the code generated by polymorphism.m was not considered
type-correct, due to the type `type_info' not matching
`mercury_builtin:type_info'.
compiler/check_typeclass.m:
Simplify the code for check_instance_pred and
get_matching_instance_pred_ids.
compiler/mercury_compile.m:
compiler/modules.m:
Disallow directory names in command-line arguments.
compiler/options.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
compiler/modules.m:
Add a `--make-private-interface' option.
The private interface file `<module>.int0' contains
all the declarations in the module; it is used for
compiling sub-modules.
scripts/Mmake.rules:
scripts/Mmake.vars.in:
Add support for creating `.int0' and `.date0' files
by invoking mmc with `--make-private-interface'.
doc/user_guide.texi:
Document `--make-private-interface' and the `.int0'
and `.date0' file extensions.
doc/reference_manual.texi:
Document nested modules.
util/mdemangle.c:
profiler/demangle.m:
Demangle names with multiple module qualifiers.
tests/general/Mmakefile:
tests/general/string_format_test.m:
tests/general/string_format_test.exp:
tests/general/string__format_test.m:
tests/general/string__format_test.exp:
tests/general/.cvsignore:
Change the `:- module string__format_test' declaration in
`string__format_test.m' to `:- module string_format_test',
because with the original declaration the `__' was taken
as a module qualifier, which lead to an error message.
Hence rename the file accordingly, to avoid the warning
about file name not matching module name.
tests/invalid/Mmakefile:
tests/invalid/missing_interface_import.m:
tests/invalid/missing_interface_import.err_exp:
Regression test to check that the compiler reports
errors for missing `import_module' in the interface section.
tests/invalid/*.err_exp:
tests/warnings/unused_args_test.exp:
tests/warnings/unused_import.exp:
Update the expected diagnostics output for the test cases to
reflect a few minor changes to the warning messages.
tests/hard_coded/Mmakefile:
tests/hard_coded/parent.m:
tests/hard_coded/parent.child.m:
tests/hard_coded/parent.exp:
tests/hard_coded/parent2.m:
tests/hard_coded/parent2.child.m:
tests/hard_coded/parent2.exp:
Two simple tests case for the use of nested modules with
separate compilation.