Estimated hours taken: 0.1
Allow prolog version of the compiler to be built.
library/string.nu.nl:
Add missing definition of string__from_rev_char_list
Estimated hours taken: 0.1
library/Mmakefile:
Delete a stray tab that caused problems with older versions
of GNU Make. (Thanks to Warwick Harvey for reporting this bug.)
Estimated hours taken: 0.1
library/math.m:
Fix a cut-and-paste bug reported by Dan Hazel
<d.hazel@mailbox.uq.edu.au>: Mercury's acos/1 was
calling C's asin() instead of acos().
Estimated hours taken: 0.5
library/private_builtin.m:
Add declarations of some things defined in library/builtin.m.
This fixes some bugs that I introduced when splitting up
mercury_builtin.m that broke things in non-gc grades.
Estimated hours taken: 6
Fix various invasions of the user's namespace by `mercury_builtin.m',
by splitting mercury_builtin.m into two modules, called builtin.m and
private_builtin.m, and ensuring that the latter is imported as if
by `:- use_module' rather than `:- import_module'.
library/builtin.m:
library/private_builtin.m:
Split mercury_builtin.m into two modules, builtin.m,
which contains stuff intended to be public,
and private_builtin.m, which contains implementation
details that are not supposed to be public.
library/mercury_builtin.m:
Add a comment saying that this module is no longer used, and
should eventually be removed. I have not removed it yet, since
that would prevent bootstrapping with the current compiler. It
will be removed as a seperate change later, once all the
changes have propagated.
compiler/prog_util.m:
Change the definition of mercury_private_builtin_module/1 and
mercury_public_builtin_module so that instead of automatically
importing mercury_builtin.m as if by `import_module', the
copiler will now automatically import builtin.m as if by
`import_module' and private_builtin.m as if by `use_module'.
compiler/polymorphism.m:
Change a call to mercury_private_builtin_module/1 for
unsafe_promise_unique to instead call mercury_public_builtin_module/1.
compiler/unify_proc.m:
Avoid hard-coding "mercury_builtin" by instead
calling one of mercury_{private,public}_builtin_module/1.
runtime/mercury_type_info.[ch]:
library/term.m:
library/std_util.m:
compiler/code_util.m:
Change a few hard-coded instances of "mercury_builtin"
to "builtin" or "private_builtin" as appropriate.
runtime/mercury_trace_util.c:
runtime/mercury_trace_internal.c:
library/prolog.m:
compiler/*.m:
Update comments that refer to "mercury_builtin" to instead
refer to either "builtin" or "private_builtin".
doc/Mmakefile:
Don't include the interface to private_builtin.m in the
library reference manual.
tools/bootcheck:
Add `-p'/`--copy-profiler' option. This is needed to get
the above changes to bootstrap.
tools/test_mercury:
Pass `-p' to tools/bootcheck.
tests/term/*.trans_opt_exp:
s/mercury_builtin/builtin/g
Estimated hours taken: 24
Add code to parse terms from strings rather than from streams.
The original intention for this change was twofold:
to increase expressiveness and to improve efficiency.
However, for the moment I have given up on the goal of
improving efficiency.
library/io.m:
Add io__read_file_as_string/{4,5}, for efficiently
reading a whole file into a single string.
Add io__read_from_string/5, for reading terms of
any type from a string.
(Should that instead be named string__read instead?)
library/string.m:
Implement string__substring/4 more efficiently,
using `pragma c_code' rather than by calling
string__right(string__left(...)).
Export string__unsafe_index/3, and add new exported
predicate string__unsafe_substring/4 -- these
are versions of string__index and string__substring
that don't check for range errors. They are
needed to get reasonable efficiency when dealing
with very large strings.
library/string.nu.nl:
Add Prolog implementations of string__substring
and string__unsafe_substring.
library/lexer.m:
Add lexer__string_get_token_list/{5,6}, for parsing
tokens from a string. This required adding
`string_' versions of most of the lexical analysis routines.
XXX lots of code duplication, I'm afraid.
XXX the string versions are not as efficiency as they
could ideally be.
library/parser.m:
Add new predicates parser__read_term_from_string/{4,6}
and parser__parse_token_list.
compiler/bytecode_gen.m:
compiler/error_util.m:
compiler/fact_table.m:
compiler/term_errors.m:
Minor changes to use term__context as an ADT rather than
as a concrete data type.
In addition, I made the following changes, which I am NOT committing.
compiler/prog_io.m:
Change to use io__read_file_as_string and
parser__read_term_from_string.
(Not committed because the existing method is
in currently more efficient.)
library/term.m:
Add new alternative term__detailed_context to the term__context type.
This alternative can record both the start and end of a term rather
than just the end.
(The lexer now has almost all the necessary support for detailed
contexts, but enabling it would have some potentially significant
efficiency costs, and curently the parser uses only single contexts
rather than ranges; so currently this is not used.)
Estimated hours taken: 0.5
library/mercury_builtin.m:
Fix some bugs in tabling -- the new handwritten code didn't
create stack layouts for internal labels.
Estimated hours taken: 1
Various bug fixes and other cleanups of the new tabling code.
library/mercury_builtin.m:
Fix a couple of bugs in the new tabling code that broke in
grades other than asm_fast.gc.
runtime/mercury_tabling.h:
Fix a couple of type errors that caused things to break in
grades other than asm_fast.gc.
Change the layout to match our coding guidelines.
runtime/mercury_table_any.c:
Fix the layout to match our coding guidelines.
runtime/mercury_table_any.h:
runtime/mercury_table_enum.h:
runtime/mercury_table_int_float_string.h:
runtime/mercury_table_type_info.h:
Add copyright notice.
runtime/mercury_table.h:
Add a comment pointing out that this is hash tables,
not tabling.
Estimated hours taken: 250
Add support for tabling.
This change allows for model_det, model_semidet and model_non memoing,
minimal model and loop detection tabling.
compiler/base_type_layout.m:
Update comments to reflect new runtime naming standard.
compiler/det_analysis.m:
Allow tabling to change the result of det analysis. This is
necessary in the case of minimal model tabling which can
turn a det procedure into a semidet one.
compiler/det_report.m:
compiler/hlds_data.m:
Add code to report error messages for various non compatible
tabling methods and determinism.
compiler/hlds_out.m:
compiler/modules.m:
Remove reference to the old memo marker.
compiler/hlds_pred.m:
Create new type (eval_method) to define which of the available
evaluation methods should be used each procedure.
Add new field to the proc_info structure.
Add several new predicates relating to the new eval_method type.
compiler/inlining.m:
compiler/intermod.m:
Make sure only procedures with normal evaluation are inlined.
compiler/make_hlds.m:
Add code to process new tabling pragmas.
compiler/mercury_compile.m:
Call the tabling transformation code.
compiler/modes.m:
Make sure that all procedures with non normal evaluation have
no unique/partially instantiated modes. Produce error messages
if they do. Support for partially instantiated modes is currently
missing as it represents a large amount of work for a case that
is currently not used.
compiler/module_qual.m:
compile/prog_data.m:
compiler/prog_io_pragma.m:
Add three new pragma types:
`memo'
`loop_check'
`minimal_model'
and code to support them.
compiler/simplify.m:
Don't report infinite recursion warning if a procedure has
minimal model evaluation.
compiler/stratify.m:
Change the stratification analyser so that it reports cases of
definite non-stratification. Rather than reporting warnings for
any code that is not definitely stratified.
Remove reference to the old memo marker.
compiler/switch_detection.m:
Fix a small bug where goal were being placed in reverse order.
Call list__reverse on the list of goals.
compiler/table_gen.m:
New module to do the actual tabling transformation.
compiler/notes/compiler_design.html:
Document addition of new tabling pass to the compiler.
doc/reference_manual.texi:
Fix mistake in example.
library/mercury_builtin.m:
Add many new predicates for support of tabling.
library/std_util.m:
library/store.m:
Move the functions :
ML_compare_type_info
ML_collapse_equivalences
ML_create_type_info
to the runtime.
runtime/mercury_deep_copy.c:
runtime/mercury_type_info.h:
runtime/mercury_type_info.c:
Move the make_type_info function into the mercury_type_info module
and make it public.
runtime/Mmakefile:
runtime/mercury_imp.h:
Add references to new files added for tabling support.
runtime/mercury_string.h:
Change hash macro so it does not cause a name clash with any
variable called "hash".
runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
Add three new functions taken from the library :
MR_compare_type_info
MR_collapse_equivalences
MR_create_type_info.
runtime/mercury_table_any.c:
runtime/mercury_table_any.h:
runtime/mercury_table_enum.c:
runtime/mercury_table_enum.h:
runtime/mercury_table_int_float_string.c:
runtime/mercury_table_int_float_string.h:
runtime/mercury_table_type_info.c:
runtime/mercury_table_type_info.h:
runtime/mercury_tabling.h:
New modules for the support of tabling.
Mmakefile:
library/Mmakefile:
Ensure that things get recompiled properly if you modify the
VERSION file and the run `mmake' from the top-level directory.
Also an unrelated change:
Mmakefile:
Add a new `install_main' target, which is like
`install' except that it doesn't invoke `install_grades'.
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: 3
Fix stack traces dying in -O-1.
error/1 is usually generated with no stack frame, but in -O-1 it is
generated with one (but doesn't need it). error/1 passes
MR_dump_stack MR_succip and MR_sp, and MR_dump_stack assumes that
MR_succip is for the topmost stack frame, but if error/1 has a stack
frame, this is not true.
library/require.m:
Make sure the caller of MR_dump_stack has no stack frame
by using handwritten code. We call the handwritten code
from error/1, and so we have the nice side effect that
error now appears in the stack dump.
runtime/mercury_stack_trace.h:
Document that MR_dump_stack assumes the succip is for the
topmost stack frame.
runtime/mercury_label.h:
Fix a comment, layout info is for a label, not a procedure.
Estimated hours taken: 0.1
library/rational.m:
I accidentally checked in a slightly earlier version of this
file which didn't compile. 8^(
This is the correct version.
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.25
library/mercury_builtin.m:
Fix a warning due to a type error in grades that don't use
non-local gotos: mercury__mercury_builtin__init should be
a function of type `void ()', not `ModuleFunc'.
Also avoid the use of nested extern declarations.
Estimated hours taken: 0.5
library/benchmarking.m:
Fix a bug which caused the "10 most expensive procedures/types since
the last report" to be computed not on the basis of the number of
words allocated since the last report, but on the number of words
allocated so far in all of the execution.
Fix a bug that could result in divide by zero if two reports have
no intervening memory allocations.
Estimated hours taken: 1
Implement nondet stack dumps.
library/require.m:
Call MR_dump_stack with MR_curfr.
runtime/mercury_stack_trace.c:
runtime/mercury_stack_trace.h:
Get MR_curfr as input.
If we hit a nondet stack frame, handle moving down a frame a
little differently.
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: 0.5
Fix some bugs with the SICStus/NU-Prolog versions of some library predicates.
library/io.nu.nl:
Fix another bug (wrong variable name) in the code for
io__remove_file_name_2.
library/store.nu.nl:
Fix a bug in the Prolog implementation of store__set_mutvar:
the SICStus Prolog name for this is `update_mutable', not
`put_mutable'.
Estimated hours taken: 1
Fix some Mmakefile errors that were diagnosed by `--warn-undefined-variables'.
Also, make a small fix to mmake.in and add empty definitions for various
Mmake variables to avoid spurious warnings.
scripts/mmake.in:
Add ` dep*' to the patterns for which we do not
pass `--warn-undefined-variables'; previously it
matched "$@" against `dep*', which did not catch the
case of `mmake -k depend'.
^^^
scripts/Mmake.vars.in:
Add definition for `ds_subdir'.
Define `MLLIBS' as `$(EXTRA_MLLIBS)' rather than empty,
and add empty definition for `EXTRA_MLLIBS'.
Add empty definition for `MAIN_TARGET'.
Mmakefile:
Fix misspelling: `deps_subdir' not `dep_subdir'.
Add empty definitions for `PREINSTALL_HACK', `POSTINSTALL_HACK',
and `MMAKEFLAGS'.
boehm_gc/Mmakefile:
Add empty definition for `PROF'.
runtime/Mmakefile:
Add empty definition for `DLL_CFLAGS'.
library/Mmakefile:
Add empty definition for `CHECK_TERM_OPTS'.
compiler/Mmakefile:
Add empty definition for `MTAGSFLAGS'.
Estimated hours taken: 2
Fix some bugs which meant that building NU-Prolog or SICStus Prolog
executables with MMAKE_USE_SUBDIRS set to `yes' did not work.
scripts/mnc.in:
scripts/msc.in:
Add support for a `--use-subdirs' option.
scripts/Mmake.rules:
If MMAKE_USE_SUBDIRS=yes, then add `--use-subdirs' to
$(MNCFLAGS) and $(MSCFLAGS).
scripts/mnl.in:
Add support for new environment variable MERCURY_NU_DEBUG_LIB_OBJS,
for use by library/Mmakefile.
library/Mmakefile:
Fix places where .no and .ql files where hard-coded as being in
the current directory instead of in $(nos_subdir) or $(qls_subdir).
Estimated hours taken: 0.25
Fix a problem that broke the use of NU-Prolog debugging.
The problem was that portray.nl was calling current_op/3,
but NU-Prolog only has currentOp/3.
The fix was to change things to use the NU-Prolog version
and add an implementation of the NU-Prolog version in
terms of the SICStus/ISO Prolog version to sp_lib.nl.
(A better policy would be always use the ISO names, and
to have an nc_lib.nl file providing implementations of
the ISO names in terms of the NU Prolog names rather than
vice versa; however, the current policy of always using
the NU-Prolog names is at least consistent, and changing
the current policy consistently would be a relatively large
amount of work.)
library/portray.nl:
Change calls to current_op/3 to instead call currentOp/3.
library/sp_lib.nl:
Add an implementation.
Estimated hours taken: 3
relation__rtc was just plain broken. Rather than try to fix an
algorithm which I pulled out of an obscure paper some years ago, it's
now replaced with a slightly less efficient algorithm which is much
easier to understand.
library/relation.m:
Changes detailed above.
tests/Makefile:
tests/rtc_bug.m:
tests/rtc_bug.exp:
Test case for the above change.
tests/relation_test.m:
tests/relation_test.exp:
Change in output format to make debugging easier.
Estimated hours taken: 0.25
library/Mmakefile:
Fix a bug in rule for `mmake install_ints' which creates the
Mercury/ints etc. subdirectories: change the code so that the
rule works when installing over the top of an already existing
installation.
Estimated hours taken: 6
Fix some problems with the `--use-subdirs' option.
The compiler itself now compiles and bootstraps fine with --use-subdirs.
compiler/modules.m:
Put `.h' files in the source directory, rather than
in the `Mercury/hs' subdirectory.
compiler/mercury_compile.m:
scripts/Mmake.rules:
If `--use-subdirs' is enabled, pass `-I.' to the C compiler,
so that #include statements work relative to the source directory
rather than relative to the `Mercury/cs' subdirectory.
scripts/Mmake.vars.in:
Define $(cs_subdir), $(os_subdir) etc. variables;
these are set to the directory to use for .c, .o, etc. files,
(including the trailing `/'), or to the empty string,
if --use-subdirs is not set.
scripts/Mmake.rules:
Use $(cs_subdir), $(os_subdir) etc. to avoid the code
duplication created by my previous change to handle
--use-subdirs.
Also add lots of comments, and reorder the code
in a more logical order.
Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
Use $(cs_subdir), $(os_subdir) etc. to fix a few hard-coded
file-names (e.g. *.dep, *_init.[co], tree234.o) that were
used in some of the rules.
library/Mmakefile:
Add `rm -f tags' to the rule for `mmake realclean'.
tools/bootcheck:
Add `--use-subdirs' option (defaults to setting of the
MMAKE_USE_SUBDIRS environment variable).
Change the code which compares the stage2 & stage3 C files
to use the appropriate location for them based on the
setting of this option.
Estimated hours taken: 1
library/string.m:
Fix a bug in string__base_string_to_int:
it was handling MININT incorrectly.
tests/hard_coded/Mmakefile:
tests/hard_coded/minint_bug.m:
tests/hard_coded/minint_bug.exp:
Regression test.
Estimated hours taken: 11
Finish off the centralization of the file name handling code, and
add support for generating intermediate files in subdirectories.
scripts/mmake.in:
Add a new boolean option `--use-subdirs';
if enabled, it just sets the environment variable MMAKE_USE_SUBDIRS
to `yes' before invoking Make.
Also add negative versions of the various options
(`--no-use-subdirs', `--no-verbose', `--no-save-makefile').
scripts/Mmake.rules:
Add code to handle generating intermediate file names
in subdirectories. If MMAKE_USE_SUBDIRS=yes, we add
`--use-subdirs' to MCFLAGS, and most of the pattern rules
are changed to use subdirectories.
Note that getting this to work required a bit of a hack:
due to what seem to be bugs in GNU Make, `mmake depend'
needs to do `mmc --make-short-interface *.m' to get things
started. But once the int3s are there, the dependencies
seem to work OK.
compiler/options.m:
Add a new boolean option `--use-subdirs'.
compiler/modules.m:
Add new predicate `fact_table_file_name'.
Add an extra argument to `module_name_to_file_name',
specifying whether or not to create any directories
needed for the file name.
Change all the file-name-creating predicates here
to go through a single new predicate `choose_file_name',
and add code in that predicate to handle the `--use-subdirs'
option.
Also if the `--use-subdirs' option is set, don't use the
compact dependencies format, since it can't work in that case.
compiler/fact_table.m:
Call `fact_table_file_name' rather than using `string__append'.
compiler/mercury_compile.m:
Change `link_module_list' and `join_module_list'
so that they create file names by calling `module_name_to_file_name'.
compiler/export.m:
compiler/intermod.m:
compiler/llds_out.m:
compiler/mercury_compile.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/termination.m:
compiler/trans_opt.m:
compiler/unused_args.m:
Change all calls to `module_name_to_file_name' to pass
the extra argument specifying whether or not to make
any directories needed for the file name.
library/Mmakefile:
Change the rule for `mmake install_ints' so that it
creates a `Mercury' subdirectory with symbolic links
`ints', `int2s', `int3s', `opts', and `trans_opts'
which just point to `..'. This is needed for the
`--use-subdirs' option to work, because Mmake currently
does not support mixing libraries compiled with and
without `--use-subdirs'.
doc/user_guide.texi:
Document the above changes.
Estimated hours taken: 0.1
library/debugger_interface.m:
Update a comment: changed the pointer to runtime/mercury_accurate_gc.h
to instead point to runtime/mercury_stack_layout.h.
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.1
runtime/mercury_types.h:
library/io.m:
Move a comment about MercuryFile from io.m to mercury_types.h,
since the definition of the MercuryFile type had been moved.
Estimated hours taken: 24
Add support to the Mercury tracer for interacting with an external
Opium-style debugger via a socket.
TODO: currently there is no way for the debugger to specify
constraints on the arguments for a `forward_move' query.
The current code for doing that doesn't work.
(However, the reporting of arguments to the debugger
for an `output_current' query works fine.)
runtime/mercury_trace.c:
Add code to MR_trace() to open a socket connection to
an external debugger, and to process requests from that
debugger, and send responses back.
runtime/mercury_trace.h:
runtime/mercury_wrapper.c:
Call MR_trace_end() from mercury_runtime_terminate() so that
the external debugger gets notified when the program does
a (normal) exit.
runtime/mercury_stack_layout.h:
Fix a bug where the structures here did not match
the output produced by compiler/stack_layout.m.
library/debugger_interface.m:
New file. Declares the Mercury types used for the debugger
socket interface and defines support routines used by
runtime/mercury_trace.c.
library/io.m:
runtime/mercury_types.h:
Move the definition of MercuryFile from library/io.m to
runtime/mercury_types.h, for use by runtime/mercury_trace.c.
library/io.m:
When printing out values of type `c_pointer', print out
the "<<c_pointer>>" string in single quotes, to ensure
that it has valid syntax for a Prolog or Mercury term.
This is necessary because otherwise c_pointers in procedure
arguments could lead to the Mercury process sending a
syntactically invalid term down the socket to the debugger,
which would then be unable to parse it.
library/library.m:
Add reference to debugger_interface.m, so that it gets
include in libmercury.a.
doc/Mmakefile:
Make sure that the library/debugger_interface.m does *not*
get included in the Mercury library reference manual.
runtime/mercury_wrapper.h:
runtime/mercury_wrapper.c:
runtime/mercury_init.h:
util/mkinit.c:
Declare, define, and initialize pointers to the C functions
exported by library/debugger_interface.m.
(This is to avoid having a circular dependency where the
runtime depends on the library.)
compiler/notes/authors.html:
Add Erwan Jahier.
Estimated hours taken: 12
Add support for stack dumps, do a stack dump from error/1.
compiler/Mmakefile:
library/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
Insert EXTRA_MGNUCFLAGS before CFLAGS or EXTRA_CFLAGS
becasue mgnuc stops processing its options when it
encounters a non-mgnuc option.
library/require.m:
Call MR_dump_stack if error is called.
runtime/Mmakefile:
runtime/mercury_imp.h:
Add #includes of new files.
runtime/mercury_type_info.h:
Remove conditional definition of MR_STATIC_CODE_ADDRESSES
(moved into mercury_conf.h.in).
runtime/mercury_accurate_gc.h:
Remove stack_layout stuff, leave this file for accurate
GC specific definitions.
runtime/mercury_conf.h.in:
Add conditional definitions of MR_INSERT_LABELS,
MR_USE_STACK_LAYOUTS, MR_NEED_INITIALIZATION_CODE and
MR_STATIC_CODE_ADDRESSES, depending on various other options.
runtime/mercury_goto.h:
Insert labels into label table if MR_INSERT_LABELS is defined,
rather than NATIVE_GC.
util/mkinit.c:
Initialize if MR_NEED_INITIALIZATION_CODE is defined, rather than
NATIVE_GC.
runtime/mercury_stack_layout.h:
All the old stack layout definitions from mercury_accurate_gc.h.
Add code for MR_DETISM_DET_CODE_MODEL.
runtime/mercury_stack_trace.c:
runtime/mercury_stack_trace.h:
Implement MR_dump_stack which just provides a dump of the stack
as far as possible.
Set MR_INSERT_LABELS and MR_USE_STACK_LAYOUTS if MR_STACK_TRACE
is set.
runtime/mercury_grade.h:
Add _strce if stack tracing is enabled in the grade. This
might not be a permanent change.
runtime/mercury_ho_call.c:
Remove unused label declarations.
scripts/mgnuc.in:
Add --stack-trace and --no-stack-trace options.
Consolidate some duplicate code.
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: 0.25
Fix some problems that broke the SICStus version of the Mercury compiler.
library/sp_builtin.nl:
library/nc_builtin.nl:
Ignore `:- impure ...' and `:- semipure ...' declarations.
library/io.nu.nl:
Add (SICStus) Prolog implementations of
io__rename_file_2, io__delete_file_2, io__tmpnam/5,
and io__tmpnam_2.
Estimated hours taken: 0.75
Fix some problems that broke the SICStus version of the Mercury compiler.
library/sp_builtin.nl:
library/np_builtin.nl:
Ignore `:- impure ...' and `:- semipure ...' declarations.
library/io.nu.nl:
Add (SICStus) Prolog implementations of
io__rename_file_2, io__delete_file_2, io__tmpnam/5,
and io__tmpnam_2.
Estimated hours taken: 0.5
library/Mmakefile:
Only turn on non-interface intermodule information flow
(and hence installation) if LIBRARY_INTERMODULE is defined.
Mmake.common.in:
Turn on LIBRARY_INTERMODULE by default. It can be turned off
by Mmake.{,stage.}params.
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.
Estimated hours taken: 0.5
Fix some bugs in `io__tmpnam/5'.
library/io.m:
Change the implementation of io__tmpnam so that it never uses
tempnam(). We can't use tempnam() to implement io__tmpnam/5,
because tempnam() ignores the directory name passed if TMP_DIR
is set (or at least it does this on dec-alpha-osf3.2).
Note that we should not change the specification for io__tmpnam/5
to match that of tempnam(), because the current specification
for io__tmpnam/5 is much more useful.
Also fix another bug: in a couple of places the C code was
using `&&' where it should have used `||'.
Also change MAX_TEMPNAME_RETRIES from 5 to 10.
Estimated hours taken: 0.5
library/io.m:
Add a new predicate `io__rename_file', which calls the ANSI C
function rename().
Also improve the documentation and error messages
for `io__remove_file' (document that the behaviour is
implementation-dependent if you attempt to remove an
open file; prefix the error message with "remove failed: ").