Branches: main
valid/deforest_loop.m:
valid/exported_foreign_type2.m:
valid/headvar_not_found.m:
valid/ho_and_type_spec_bug.m:
valid/inst_perf_bug_1.m:
valid/intermod_impure2.m:
valid/lambda_recompute.m:
valid/livevals_seq.m:
valid/mostly_uniq_neg.m:
valid/multidet_prune1.m:
valid/nondet_live.m:
valid/param_mode_bug.m:
valid/simplify_bug.m:
valid/soln_context.m:
valid/switch_detection_bug2.m:
valid/tricky_assert2.m:
valid/uniq_unify.m:
valid/vn_float.m:
warnings/purity_warnings.m:
warnings/singleton_test.m:
Add Erlang pragma foreign_* for these test cases.
warnings/singleton_test.exp:
Update line numbers in expected output for C.
warnings/singleton_test.exp2:
warnings/singleton_test.exp3:
Update line numbers and format C# and Java (untested).
warnings/singleton_test.exp4:
Add expected output for Erlang.
Estimated hours taken: 8
Branches: main
My previous fix to dead proc elimination helped fixed some compiler aborts,
but a related problem remained.
The problem involved an unused procedure that was kept around so that the code
generator would create the table associated with it. Since the procedure was
unused, its body was thought to be unused too. If it contained a reference to a
procedure that wasn't referred to from anywhere else, that procedure would be
removed, leaving a dangling reference. This would cause a code generator abort.
We can't fix the abort by replacing the kept-around procedure's body with
"true", since that would cause a different code generator abort when moving the
(now unbound) output variables to their argument registers. We could avoid
generating any code for the procedure at all by e.g. marking it as
opt_imported, but this would (a) be inconsistent and (b) require special case
coding to still generate the table structure.
The fix is to generate the global variable used for tabling *independently* of
the procedure that enters things in the table.
compiler/hlds_module.m:
Add a field to the module_info (actually module_sub_info) that records
the information the backends need to create the global variables
representing call tables.
Name all the fields of the module_info and module_sub_info during
initialization, to make it easier to know where to add a new field.
Put the initializations of the fields in the same order as the fields
themselves.
compiler/hlds_pred.m:
Keep only the info for I/O tabling in procedures, since such tabling
does not require defining a per-procedure global variable.
Since the info for the forms of tabling that *do* require a
per-procedure global variable are now divorced from the procedure,
change their definition to avoid storing prog_vars in them, since
those prog_vars would be separated from their varset. Instead, we
record their numbers and their names (both are used only for debug
support).
On the other hand, some info from the pred_info and proc_info are
to create the global variable; copy them into the data structure stored
in hlds_module.
Rename some fields to avoid ambiguities.
compiler/table_gen.m:
Continue to record information about I/O tabling in the proc_info,
but record information about other forms of tabling in the new field
in the module_info.
compiler/rtti.m:
compiler/hlds_rtti.m:
Move the functions for constructing and deconstructing rtti_proc_labels
from rtti.m (which is in backend_libs) to hlds_rtti.m (which is in
hlds); the definition of rtti_proc_label was already in hlds_rtti.m.
The move is needed to allow table_gen to put an rtti_proc_label
in the data structures it puts in the module_info.
compiler/hlds_out.m:
Print out the new module_info field, and conform to the change to
hlds_pred and table_arg_info.
Always print variable numbers for type variables in table_arg_infos.
compiler/continuation_info.m:
Make room for either kind of tabling info for a procedure.
(While the LLDS code generator doesn't need to know about the global
variable representing the call table in order to create it, it does
need to know about it in order to describe it to the debugger.)
Conform to the change in table_arg_info.
Rename some fields to avoid ambiguities.
compiler/proc_gen.m:
When generating code for procedures, do not try to create a
per-procedure tabling struct, but do fill in the slot describing it
in the continuation_info.
Add a predicate to define all the tabling structs in a module.
compiler/mercury_compile.m:
Call proc_gen separately to define all the tabling structs.
compiler/ml_code_gen.m:
As with proc_gen, define tabling structs directly from the module_info
and not when generating code from each proc_info.
(The code for handling each proc is now logically not contiguous;
I will address that in a separate change, to make the diff for this one
easier to read.)
compiler/dead_proc_elim.m:
Don't keep unused tabled procedures alive, since that leads to the
problem described up top.
Keep track of which tabling structs are live, but don't yet act on that
information, since some uses are hidden (for now).
Add conditionally compiled tracing code that helped me trace down the
problem.
Fix an oversight in the severity level of an error spec.
compiler/base_typeclass_info.m:
compiler/code_util.m:
compiler/deep_profiling.m:
compiler/ml_code_util.m:
compiler/proc_label.m:
compiler/type_ctor_info.m:
Conform to the move of make_rtti_proc_label.
compiler/optimize.m:
Conform to the change to continuation_info.
compiler/stack_layout.m:
Conform to the data structure changes above.
doc/user_guide.texi:
Document 'Z' as the character in -D arguments that tells hlds_out
to dump the global structures needed for tabling.
Fix an old oversight: document 'S' as the character in -D arguments
that tells hlds_out to dump info about structure sharing.
compiler/handle_options.m:
Include 'Z' in -DALL -and -Dall.
tests/tabling/mercury_java_parser_dead_proc_elim_bug.{m,exp}:
Move this test case here from valid, since compiling all the way to
executable doesn't work in valid (in yields link errors unrelated to
the bug we are testing for).
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.{m,exp}:
Add this new test case that in unfixed compilers gives the problem
described up top.
tests/tabling/Mmakefile:
Enable the new tests.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/mercury_java_parser_dead_proc_elim_bug.m:
Remove references to the moved test and the test itself.
Estimated hours taken: 1
Branches: main
Fix an old bug described by this comment:
% Some eval methods cause the procedure implementation to include
% a global variable representing the root of the per-procedure call
% and answer tables. In some rare cases, the code of a tabled
% procedure may be dead, but other predicates (such as the
% predicate to reset the table) that refer to the global are
% still alive. In such cases, we cannot eliminate the tabled
% procedure itself, since doing so would also eliminate the
% definition of the global variable, leaving a dangling reference.
compiler/dead_proc_elim.m:
Fix the bug described above.
Fix some obsolete documentation and predicate names.
Introduce some new types that make the code easier to read.
Rename some ambiguous and/or obsolete function symbols.
compiler/*.m:
Conform to the changes in dead_proc_elim.m.
tests/valid/mercury_java_parser_dead_proc_elim_bug.m:
New test case for this bug.
tests/valid/Mmakefile:
Enable the new test case.
tests/valid/Mercury.options:
Get the new test case compiled to executable, not just to a .c file,
to give a chance for the link error to manifest itself.
Estimated hours taken: 0.2
Branches: main
Fix a bug that prevented some of the Mercury programs used for the packrat
paper from compiling. This is the bug description from the new test case:
% This is a regression test. In versions of the compiler before 7 Aug 2007,
% it used to cause this compiler abort:
%
% Software Error: code_gen.m: Unexpected: nondet model in det/semidet context
%
% when generating code for the java_identifier predicate.
%
% The bug was that the follow_code pass would push a goal binding a variable
% into a semidet disjunction. This would cause the disjunction to have an
% output, which would cause the simplify pass to change its determinism,
% and from there the determinism of the entire procedure body, to nondet.
% Since java_identifier is supposed to be semidet, this causes the abort above.
compiler/follow_code.m:
Fix the bug.
tests/valid/mercury_java_parser_follow_code_bug.m:
Add the new test case.
tests/valid/Mmakefile:
Enable the new test case.
Estimated hours taken: 0.2
Branches: main
tests/*/.cvsignore:
tests/*/.nocopyright:
Update or add these files. In particular, CVS should ingore
.mgnuc* files.
Estimated hours taken: 3
Branches: main
Improve documentation of polymorphic modes and include more
tests in the test suite to the check parsing of declarations that
contain them.
doc/reference_manual.texi:
Indicate where the parentheses must be placed in order to resolve
operator precedence issues with predicate mode declarations that
contain inst constraints. Also indicate where the determinism
component must occur in such declarations w.r.t the inst
constraints.
Add determinism components to the mode declarations that are used
as example of constrained polymorphic insts.
library/bitmap.m:
Unrelated change: conform to our coding standard w.r.t comment
positioning in the standard library.
tests/valid/Mmakefile:
tests/valid/constr_inst_syntax.m:
Further test cases for constrained polymorphic modes; in
particular check that parsing of declarations containing
both type class and inst constraints works.
Estimated hours taken: 1.5
Branches: main
library/io.m:
Implement some more I/O primitives for Erlang.
tests/debugger/Mmakefile:
tests/debugger/declarative/Mmakefile:
tests/hard_coded/Mmakefile:
tests/invalid/Mmakefile:
tests/par_conj/Mmakefile:
tests/recompilation/Mmakefile:
tests/valid/Mmakefile:
Disable test cases which don't apply to the Erlang backend for
whatever reason.
tests/hard_coded/constraint_order.m:
tests/hard_coded/copy_pred.m:
tests/hard_coded/copy_pred_2.m:
tests/hard_coded/export_test.m:
tests/hard_coded/external_unification_pred.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/ho_solns.m:
tests/hard_coded/ho_univ_to_type.m:
tests/hard_coded/intermod_multimode.m:
tests/hard_coded/intermod_poly_mode_2.m:
tests/hard_coded/lookup_disj.m:
tests/hard_coded/multimode.m:
tests/hard_coded/no_inline.m:
tests/hard_coded/pragma_foreign_export.m:
tests/hard_coded/redoip_clobber.m:
tests/hard_coded/rnd.m:
tests/hard_coded/sub-modules/sm_exp_bug.m:
tests/hard_coded/typeclasses/impure_methods.m:
tests/par_conj/dep_par_10.m:
tests/valid/flatten_conj_bug.m:
Fix test cases which were failing with the Erlang for simple reasons,
mostly missing foreign procs or foreign types.
tests/general/string_format_test_2.exp5:
tests/general/string_format_test_3.exp5:
tests/hard_coded/exceptions/test_uncaught_exception.exp5:
tests/hard_coded/no_fully_strict.exp5:
Add expected outputs with stack dumps for Erlang.
compiler to abort. This is the same bug that has been cause the
ho_and_type_spec_bug to fail in deep profiling grades. The problem occurs in
the other grades as well but it is usually masked by the effects of inlining.
tests/valid/ho_and_type_spec_bug2.m:
tests/valid/Mercury.options:
A new test case (derived from ho_and_type_spec_bug) that
causes the compiler to abort.
compiler/Mercury.options:
Delete the comment saying that the workarounds for ho_and_type_spec_bug
can be deleted. Mention that we must pass this new test case as
well before this an happen.
tests/EXPECT_FAIL_TESTS.all_grades:
Expect the new test case to fail.
Estimated hours taken: 2
Branches: main
The following code causes code to be generated which seg-faults
:- interface
:- instance tc(list(T)).
:- implementation.
:- instance tc(list(T)) <= tc(T) where [...].
because the exported instance declaration doesn't contain the
typeclass constraint.
mercury/compiler/add_class.m:
Check that for all the "same" instance declarations
the instance constraints are exactly the same on each
declaration.
tests/invalid/incompatible_instance_constraints*:
Add tests for this code.
tests/invalid/*:
Fix some headvar name errors.
tests/valid/*:
Fix some invalid abstract instance declarations.
Estimated hours taken: 3
Branches: main
Fix failure of tests/valid/foreign_type_spec.
compiler/add_type.m:
Fix a place where error codes were being `and'ed together
rather than `or'ed, resulting in missing foreign type
declarations not being reported and compiler aborts later.
Remove code to only test GRADEFLAGS when generating code.
GRADEFLAGS is passed for all compilation targets now.
library/bitmap.m:
Uncomment the IL definition of the bitmap type to allow
the interface files to be used by tests in grade `il'.
tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/foreign_type_missing.{m,err_exp}:
Test case for missing foreign type declarations for
the current back-end.
tests/valid/Mercury.options:
Fix a typo which caused different parts of the foreign_type_spec
test case to be compiled in different grades.
tests/EXPECT_FAIL_TESTS.all_grades:
Remove foreign_type_spec.
Estimated hours taken: 0.5
Branches: main
Make the stream error type specific to each reader, not specific to an entire
input stream. This means that different readers attached to the same stream
can return different types of error; this is useful in the case where a
reader can return a partial result.
library/stream.m:
Change the definition of input streams so that they no longer include
parameter for the error type.
Introduce the error type as a parameter of the reader class.
This means that different readers attached to the same stream may
now have different error types. The error type is functionally
dependent upon the reader's handle and unit types.
library/io.m:
extras/net/tcp.m:
tests/valid/logged_stream.m:
Conform to the above change.
Estimated hours taken: 4
Branches: main
compiler/typeclasses.m:
Fix a bug which could cause non-termination during context
reduction.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/time_yaowl.m:
Test case.
Estimated hours taken: 1.5
Branches: main
Fix a bug reported by Peter Ross.
compiler/check_typeclass.m:
Only check concrete instance definitions for mutual consistency.
Abstract definitions will always appear to be inconsistent with
the concrete ones.
tests/valid/Mmakefile:
tests/valid/logged_stream.m:
New test case.
Estimated hours taken: 20
Branches: main
Add support for deconstructing by functor number rather than name,
for use by write_binary.
library/deconstruct.m:
runtime/mercury_deconstruct.h:
runtime/mercury_deconstruct.c:
runtime/mercury_ml_expand_body.h:
runtime/mercury_ml_deconstruct_body.h:
Add predicates deconstruct.functor_number and
deconstruct.deconstruct.du, which returns a functor number
suitable for use by construct.construct rather than a functor
name.
library/construct.m:
library/term.m:
browser/term_rep.m:
extras/quickcheck/qcheck.m:
tests/valid/agc_unbound_typevars.m:
tests/valid/agc_unbound_typevars2.m:
Add a function get_functor_lex, which returns the lexicographic
functor number given an ordinal functor number.
Add equivalence types to make it clearer which ordering is
being used by which functor numbers.
Remove a C-ism: num_functors now fails rather than returning -1
for types without functors.
NEWS:
Document the new predicates and functions.
runtime/mercury_type_info.h:
runtime/mercury_builtin_types.c:
runtime/mercury_mcpp.h:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/type_ctor_info.m:
compiler/rtti_to_mlds.m:
compiler/opt_debug.m:
Add a field to MR_TypeCtorInfo which contains a mapping from
an ordinal functor number to a lexicographic functor number
which can be passed to construct.construct.
Bump MR_RTTI_VERSION.
tests/hard_coded/expand.m:
tests/hard_coded/expand.exp:
tests/hard_coded/expand.exp2:
tests/hard_coded/construct_test.m:
tests/hard_coded/construct_test.exp:
tests/hard_coded/construct_test_exist.m:
tests/hard_coded/construct_test_exist.exp:
Test cases.
Estimated hours taken: 0
Branches: main
tests/valid/mert.m:
Delete the bodies of the foreign_procs in this module so that we can
compile it into a .o file (as the standard runtest target in this
directory requires).
Estimated hours taken: 0.1
Branches: main
Fix the failure of valid/csharp_hello.m in some grades.
tests/valid/Mercury.options:
For the tests that build .il files make sure that we reset all of
the grade components rather than just the target.
Delete some residual aditi stuff.
Estimated hours taken: 0.5
Branches: main
Fix a bug reported by Ondrej Bojar.
compiler/goal_util.m:
When renaming variables, rename them in the list of variables
quantified by a trace goal too. This is the bug fix.
compiler/hlds_out.m:
Print the list of variables quantified by a trace goal more nicely.
tests/valid/mert.m:
A cut down version of Ondrej's test case.
tests/valid/Mmakefile:
Enable the new test case.
Estimated hours taken: 4
Branches: main, release
Fix a bug with interface files and typeclasses reported by Peter Ross.
Typeclass definitions in the implementation section of a module are written
out as abstract declarations in the implementation of the interface files.
The bug was that module imports from the implementation section that were
needed by items referred to from the typeclass constraints were not being
included in the implementation section of the interface file. This caused a
map lookup abort when other modules were compiled against these interface
files.
The fix is to make sure that we consider any typeclass constraints when
computing the set of "necessary" implementation imports, i.e. those that
must appear in the interface files.
compiler/modules.m:
Include module imports required by typeclass constraints in the
set of modules that must appear in the implementation section of
an interface file.
tests/valid/Mmakefile:
tests/valid/tc_map_lookup.m:
tests/valid/tc_map_lookup_2.m:
Testcase for the above.
Estimated hours taken: 16
Branches: main
Support polymorphic instances of typeclasses with functional dependencies.
We do this by allowing type variables in the range arguments, which must be
distinct according to existing typeclass restrictions, to be determined
from type variables in the domain arguments by the functional dependencies
on the instance constraints.
compiler/check_typeclass.m:
Remove the range-restrictedness check and replace it with a coverage
check, which makes use of the instance constraints when determining
if a type variable is bound.
Explicitly pass the range tvars to get_unbound_tvars, so that it
can be used by the coverage pass as well as the
check_typeclass_constraints pass.
Rearrange the structure of the module, since multiple passes now
make use of the get_unbound_tvars predicate. Separate out the
error reporting code from the main logic.
Clarify the description at the top of this module. It now corresponds
more closely with the structure of the module.
Fix a bug in check_instance_pred_procs/12 whereby the wrong context
was being used in the new instance definition, leading to incorrect
error messages; use field update syntax to avoid this problem.
doc/reference_manual.texi:
Add an example to illustrate the relaxed restrictions.
tests/valid/Mmakefile:
tests/valid/fundeps_poly_instance.m:
Test the new feature.
tests/invalid/Mmakefile:
tests/invalid/fundeps_coverage.err_exp:
tests/invalid/fundeps_coverage.m:
Test the new error reporting.
tests/invalid/range_restrict.err_exp:
Update for the changed error message.
tests/invalid/typeclass_bogus_method.err_exp:
tests/invalid/typeclass_test_10.err_exp:
Update these expected outputs for the bugfix.
Estimated hours taken: 15
Branches: main, release
Implement superclass reduction in the style of CHRs rather than as a top
down search. This is shorter, simpler, and more consistent with the rest
of the typeclass implementation. It also removes a few XXXs and fixes a
bug reported by Julien.
compiler/hlds_data.m:
Add an ancestors field to the hlds_constraint type. This caches
all the ancestors of assumed constraints, along with proofs (in the
form of a sequence of subclass constraints) of how each ancestor is
derived.
Update this field whenever new assumed constraints are created, by
traversing the class hierarchy bottom up.
Delete the old subclass_details type, which was part of the
superclass table.
compiler/typeclasses.m:
Use the cached ancestors to apply the class rules, rather than
performing a top down search.
compiler/type_util.m:
Apply substitutions to the ancestors.
compiler/typecheck.m:
compiler/typecheck_info.m:
Update to account for the additional field.
compiler/*.m:
Remove the superclass table from the module_info and from the
interface to context reduction; it is no longer needed.
compiler/hlds_out.m:
Don't output the superclass table.
tests/valid/Mmakefile:
tests/valid/superclass_bug.m:
Regression test for the bug that is now fixed.
Estimated hours taken: 1.5
Branches: main
compiler/prog_io_typeclass.m:
Enforce the requirement that type variables in instance declarations
are distinct.
tests/invalid/Mmakefile:
tests/invalid/instance_dup_var.err_exp:
tests/invalid/instance_dup_var.m:
Test case.
tests/hard_coded/typeclasses/Mmakefile:
Disable the instance_unconstrained_tvar_dup test case, since we
don't support the feature that it tests.
tests/invalid/range_restrict.err_exp:
tests/invalid/range_restrict.m:
tests/valid/mpj5.m:
Comment out the parts of these test cases which use duplicated
instance variables, and adjust the expected output where applicable.
Estimated hours taken: 25
Branches: main
Change the representation of file streams in the io module so that they
can be used as typeclass instances. This is not currently possible because
file streams are defined as equivalence types and making them typeclass
instances results in overlapping instances.
This diff changes the representation by putting notag wrappers around the
various file stream types: io.input_stream, io.output_stream,
io.binary_input_stream, etc. This avoids the problem with overlapping
instances. It also improves type-safety; it is now not possible to pass a
binary input stream where a binary output stream is expected and so forth.
This change is complicated by the fact that the io module interacts with both
the runtime and the debugger via the C interface. In order to preserve the
existing C interface that the io module presents to the runtime (the
alternative being to more or less change all the argument types to MR_Word),
the I/O operations that operate on file streams have been split into two
parts: a "typed" part that is exported from the io module and an "untyped"
part that deals with primitive streams (the io.stream type).
For the debugger the problem is the reverse since there we typically pass
values of type MercuryFilePtr to exported Mercury procedures. In order
to avoid warnings from gcc we add a set of macros to the runtime that
wrap or unwrap MercuryFilePtrs. There should be no performance impact
since the macros just expand to casts.
library/io.m:
Do not define the various I/O streams as equivalence types in order
to avoid problems with overlapping instances when these types are
used as typeclass instances.
Mark io.seek_binary/5 and io.binary_stream_offset/4 as obsolete.
Add a typeclass io.binary_stream and make both binary file stream
types instances of it. This is so that the above predicates will
continue to work until they are deleted.
Add new predicates: io.seek_binary_input/5, io.seek_binary_output/5
io.binary_input_stream_offset/4 and io.binary_input_stream_offset/4
to replace the above.
When using io.write to print file streams strip off the wrapper
before printing the entry from the stream database. The information
in the wrapper is redundant - we use that from the stream db since
that is more detailed.
Format some section headings to conform with our current coding
standard.
Lots of minor formatting changes.
runtime/mercury_init.h:
s/io.h/io.mh/ in a comment.
runtime/mercury_library_types.h:
Add macros to wrap (and in one case unwrap) file stream types
as we pass them across the C interface. This avoids warnings
from gcc.
browser/listing.m:
Upwrap the input stream passed to mercury_stream_to_c_FILE_star
before trying to extract the underlying C file pointer.
trace/mercury_trace_browse.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
Use the new macros in the runtime to wrap streams that we pass back to
Mercury procedures.
compiler/export.m:
Unrelated change: s/Word/MR_Word/
NEWS:
Announce the changes to the io module.
tests/debugger/declarative/io_stream_test.exp2:
Conform to the changes in the io module.
tests/hard_coded/Mmakefile:
tests/hard_coded/print_stream.{m,exp}:
Test for io.write and file streams.
tests/invalid/Mmakefile:
tests/invalid/mixed_up_streams.{m,err_exp}:
Test that it isn't possible to pass binary input streams where
binary output streams are expected.
tests/valid/Mmakefile:
tests/valid/file_stream_instances.m:
Add a test case to check that we can use the various file stream
types as typeclass instances.
Estimated hours taken: 1
Branches: main, release
Fix a bug with parametric modes. Mode specific clauses or foreign_export
pragmas that involved a parametric mode didn't work because the compiler
could not match the clause or foreign_export pragma with the corresponding
mode declaration. The problem here is that the inst varsets attached to
the mode declaration and clause or foreign_export pragma are not necessarily
the same so unifying the modes is not sufficient to prove that they match.
Since we have already fixed this problem for foreign_proc pragmas the fix here
is just to extend that solution to mode-specific clauses and foreign_export
pragmas. The fix is just to allow for a renaming between the inst variables.
(Note: I've also extended this fix to the termination_info and structure
sharing/reuse pragmas which could also be affected by this.)
compiler/add_pragma.m:
Use get_procedure_matching_declmodes_with_renaming/4 instead
of get_procedure_matching_declmodes/4. This fixes problems
with items that contain inst variables not matching the
corresponding mode declaration for that item.
Delete get_procedure_matching_declmodes/4 as it isn't used
anymore and is fundamentally broken w.r.t to the way inst
variables are currently handled inside the compiler.
Move some code around so that the predicates are in top-down
order.
compiler/add_clause.m:
Call get_procedure_matching_declmodes_with_renaming/4 instead
of get_procedure_matching_declmodes.
tests/valid/Mmakefile:
tests/valid/param_mode_bug.m:
Add a test case for the above.
Estimated hours taken: 6
Branches: main, release
Fix a bug reported by Peter Hawkins. The problem occurred with switches with
multiple arms that shared code. Switch detection expands such arms by making
copies of the shared code. Requantification then renames the variables in
these copies apart, but the new variables are not being entered into the RTTI
varmaps. This leads to an assertion failure.
compiler/quantification.m:
Update the RTTI varmaps after renaming apart. Failing to add any
freshly introduced variables into the RTTI varmaps makes them
inconsistent.
compiler/add_clause.m:
compiler/add_pragma.m:
compiler/cse_detection.m:
compiler/equiv_type_hlds.m:
compiler/follow_code.m:
compiler/hlds_clauses.m:
compiler/hlds_pred.m:
compiler/hlds_rtti.m:
compiler/lambda.m:
compiler/mode_constraints.m:
compiler/pd_util.m:
compiler/polymorphism.m:
compiler/saved_vars.m:
compiler/simplify.m:
compiler/size_prof.m:
compiler/tupling.m:
compiler/unify_proc.m:
compiler/unneeded_code.m:
compiler/unused_args.m:
Conform to the above change.
Minor formatting fixes.
tests/valid/Mmakefile:
tests/valid/hawkins_switch_bug.m:
Test case for the above.
Estimated hours taken: 0.5
Branches: main
Fix a bug reported by Jakob Puchinger. When constructing the table reset or
statistics predicates for memoed functions we were not subtracting one from
the arity.
compiler/add_pragma.m:
When creating the name for a tabling reset or statistics predicate
subtract one from the arity if the aforementioned predicated is
for a memoed function.
tests/valid/Mmakefile:
tests/valid/table_wrong_func_arity.m:
Add a test case for the above.
Estimated hours taken: 3
Branches: main, release-0.13
Fix a bug with solver type initialisation.
compiler/modes.m:
Use type information to resolve ambiguity when looking up the
initialisation predicate of a solver type.
tests/valid/Mmakefile:
tests/valid/solver_type_bug_2.m:
Regression test.
Estimated hours taken: 6
Branches: main, release
Make it an error for the (promised) purity of a foreign clause to disagree
with the declared purity of the corresponding predicate or function
declaration. We only perform this check in the absence of a
promise_{pure,semipure} pragma for the predicate or function.
Previously this situation was sometimes picked up by purity analysis but not
in all cases. For example, if a predicate was declared impure but the
foreign_proc was promised pure it wasn't reported. In that particular case
it was a problem because if the foreign_proc did not have any outputs, then
simplify.m might have optimised its body away (which is how I noticed this).
compiler/add_pramga.m:
In the absence of promise_{pure,semipure} pragmas emit error messages
about mismatches between the declared purity of a procedure and the
(promised) purity of a foreign clause for it.
compiler/mode_errors.m:
Fix a typo in an error message: s/becaise/because/
compiler/purity.m:
Fix a bug reported by Ian. Inconsistent purity annotation were being
treated as both a warning and an error. Make it into an error.
library/private_builtin.m:
library/solutions.m:
Delete bogus purity promises from foreign_proc attributes reported by
the new check.
tests/invalid/Mmakefile:
tests/invalid/foreign_purity_mismatch.{m,err_exp}:
Test case for the new error.
compiler/simplify.m:
compiler/prog_io_pragma.m:
Fix some formatting.
tests/*/*:
Fix purity errors picked up by the new check.
Estimated hours taken: 1.5
Branches: main, release
Fix a compiler abort when `--optimise-dups' detects some duplicate code
sequences in parallel conjunctions.
compiler/dupelim.m:
Allow `most_specific_instr' to generalise two `fork',
`init_sync_term', `join_and_continue' or `join_and_terminate'
instructions if they take exactly the same arguments.
tests/valid/Mercury.options:
tests/valid/Mmakefile:
tests/valid/par_dupelim.m:
Add a test case.
Estimated hours taken: 1.5
Branches: main, release
compiler/saved_vars.m:
The saved_vars pass was not pushing unifications that assign
constants to variables into parallel conjunctions. Since the
original unification would be deleted, the parallel conjunction
would be left referring to an unbound variable.
tests/valid/Mercury.options:
tests/valid/par_saved_const.m:
Add a test case.
Estimated hours taken: 0.2
Branches: main, release
tests/valid/Mmakefile:
Fix the previous change to not run tests/valid/par_dummy in
decldebug grades.
Estimated hours taken: 0.1
Branches: main, release
tests/valid/Mmakefile:
Don't run tests/valid/par_dummy in decldebug grades, since using
parallel conjunction in those grades causes an abort in the compiler.
Estimated hours taken: 1
Branches: main
Some miscellaneous parallel conjunction related fixes.
compiler/add_clause.m:
Keep parallel conjuncts in the order they were written, not reversed.
This is less confusing when debugging.
compiler/det_report.m:
Add a missing space in an error message.
compiler/hlds_out.m:
Indent the opening bracket of parallel conjunctions in HLDS dumps.
compiler/par_conj_gen.m:
In the code generated for parallel conjunctions, don't attempt to copy
output variables which are of dummy types back to the parent thread's
stack frame.
tests/valid/Mmakefile:
tests/valid/par_dummy.m:
Add test case for the fix above.
Estimated hours taken: 0.1
Branches: main
Delete the obsolete versions of the all-solutions predicates from std_util.m.
(Normally we would wait until after the 0.13 release, but we don't want them
in the next g12 release of Mercury which is why they are being deleted now.)
Document some parts of the library that are handled as special cases by the
compiler and the declarative debugger.
library/std_util.m:
Delete the obsolete versions of the all-solutions predicates from
this module.
library/solutions.m:
Mention that these predicates are handled as a special case
in browser/declarative_tree.m:
Reformat a descriptive comment so that the library reference manual
doesn't have a line that exceeds 80 characters in length.
library/builtin.m:
Mention that cc_multi_equal is handled as a special case in
browser/declarative_tree.m.
Mention that dynamic_cast/2 is handled as a special case in
compiler/const_prop.m.
tests/*/*.m:
Import solutions where necessary.
Estimated hours taken: 0.1
Branches: main
Fix some more test cases that were failing due to recent library changes.
tests/valid/mc_bag.m:
tests/valid/mc_graph.m:
tests/valid/mc_hhf_nonlocals_bug.m:
Update these test cases to conform to recent library changes.
Estimated hours taken: 0.05
Branches: Main
Checking in test cases I forgot to 'cvs add' on the previous commit.
Here are the descriptions of the bug fixes they're testing for:
Fix a bug where the producer/consumer analysis was failing when implied modes
were required in predicate calls. Appropriate unifications are now generated
so as to allow for such calls.
Fix a bug where conservative approximation of nonlocals sets was leading
analysis to assume a goal consumed a variable it didn't actually use. This was
fixed by running a requantification before processing a module.
Finally, the transformation to hhf was leaving some nonlocals sets inaccurate,
so some producing/consuming conjuncts for certain program variables were being
ignored, resulting in a failure in producer/consumer analysis. This was fixed
by no longer transforming to hhf for the propagation solver constraints
based mode analysis. This is fine for now, because the current version
uses only simple constraints and doesn't need hhf. However, if it is going
to be extended to the full constraints system (that handles subtyping and
partial instantiation) the transformation to hhf will have to be used,
and the nonlocals sets bug fixed.
tests/valid/mc_bag.m:
tests/valid/mc_graph.m:
Reasonably large tests taken and modified from the standard library
that the propagation solver approach to constraints based mode
analysis currently runs correctly on.
tests/valid/mc_extra_nonlocals.m:
tests/valid/mc_hhf_nonlocals_bug.m:
tests/valid/mc_implied_modes.m:
Small tests that used to cause the propagation solver implementation
of constraints based mode analysis to fail, or hang.
Estimated hours taken: 18
Branches: main
Move the univ, maybe, pair and unit types from std_util into their own
modules. std_util still contains the general purpose higher-order programming
constructs.
library/std_util.m:
Move univ, maybe, pair and unit (plus any other related types
and procedures) into their own modules.
library/maybe.m:
New module. This contains the maybe and maybe_error types and
the associated procedures.
library/pair.m:
New module. This contains the pair type and associated procedures.
library/unit.m:
New module. This contains the types unit/0 and unit/1.
library/univ.m:
New module. This contains the univ type and associated procedures.
library/library.m:
Add the new modules.
library/private_builtin.m:
Update the declaration of the type_ctor_info struct for univ.
runtime/mercury.h:
Update the declaration for the type_ctor_info struct for univ.
runtime/mercury_mcpp.h:
runtime/mercury_hlc_types.h:
Update the definition of MR_Univ.
runtime/mercury_init.h:
Fix a comment: ML_type_name is now exported from type_desc.m.
compiler/mlds_to_il.m:
Update the the name of the module that defines univs (which are
handled specially by the il code generator.)
library/*.m:
compiler/*.m:
browser/*.m:
mdbcomp/*.m:
profiler/*.m:
deep_profiler/*.m:
Conform to the above changes. Import the new modules where they
are needed; don't import std_util where it isn't needed.
Fix formatting in lots of modules. Delete duplicate module
imports.
tests/*:
Update the test suite to confrom to the above changes.
Estimated hours taken: 35
Branch: main.
Bugfixes for constraints based mode analysis (propagation solver).
Fix a bug where the producer/consumer analysis was failing when implied modes
were required in predicate calls. Appropriate unifications are now generated
so as to allow for such calls.
Fix a bug where conservative approximation of nonlocals sets was leading
analysis to assume a goal consumed a variable it didn't actually use. This was
fixed by running a requantification before processing a module.
Finally, the transformation to hhf was leaving some nonlocals sets inaccurate,
so some producing/consuming conjuncts for certain program variables were being
ignored, resulting in a failure in producer/consumer analysis. This was fixed
by no longer transforming to hhf for the propagation solver constraints
based mode analysis. This is fine for now, because the current version
uses only simple constraints and doesn't need hhf. However, if it is going
to be extended to the full constraints system (that handles subtyping and
partial instantiation) the transformation to hhf will have to be used,
and the nonlocals sets bug fixed.
compiler/handle_options.m
Added option implications since the antecedents do nothing
without the consequents:
debug_mode_constraints -> prop_mode_constraints
simple_mode_constraints -> mode_constraints
compiler/mercury_compile.m
The results of constraints based mode analysis are no longer
discarded - they are now passed on to the rest of the compiler.
The original mode analysis can now finish anything constraints
based mode analysis hasn't done, but it shouldn't have to do
any reordering of conjunctions.
compiler/mode_constraints.m
When the propagation solver is used, the transformation to HHF
no longer occurs, and unifications are generated to allow for
use of implied modes in predicate calls. Then, the module is
requantified to make nonlocals sets more accurate.
compiler/prop_mode_constraints.m:
Implemented a HLDS tranformation that introduces unifications
to allow constraints based mode analysis to consider implied
modes in predicate calls.
tests/valid/Mmakefile:
Included some regression tests for these bugs, and some fairly
large modules that the analysis currently runs correctly on.
tests/valid/Mercury-options:
Included the option --prop-mode-constraints for the new tests.
tests/valid/mc_bag.m:
tests/valid/mc_graph.m:
Reasonably large tests taken and modified from the standard library
that the propagation solver approach to constraints based mode
analysis currently runs correctly on.
tests/valid/mc_extra_nonlocals.m:
tests/valid/mc_hhf_nonlocals_bug.m:
tests/valid/mc_implied_modes.m:
Small tests that used to fail under the above bugs.
Estimated hours taken: 1
Branches: main
Add a new option `--no-warn-obsolete' that disables warnings about calls to
predicates and functions that have `:- pragma obsolete' declarations.
Previously, this was controlled by `--no-warn-simple-code', but that was
non-obvious and you wouldn't necessarily want to disable all the other
warnings. `--no-warn-simple-code' will no longer disable warnings about
obsolete procedures.
Avoid emitting warnings for calls to obsolete procedures if those calls
are from within a procedure that is itself obsolete.
doc/user_guide.texi:
compiler/options.m:
Add a new option: `--no-warn-obsolete'.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/no_warn_obsolete.m:
Test the new option.
compiler/simplify.m:
Don't warn about calls to obsolete procedures from obsolete
procedures.
tests/warnings/Mmakefile:
tests/warnings/spurious_obsolete.m:
tests/warnings/spurious_obsolete.exp:
Test case for the above.
Estimated hours taken: 4
Branches: main
Move the all-solutions predicates from the library module std_util into their
own module, solutions.
Move semidet_fail, semidet_succeed, cc_multi_equal and dynamic cast from
std_util.m into builtin.m.
Add some more utility functions for performing determinism or purity casts.
(The later are primarily intended for use by solver implementors.)
library/std_util.m:
Move the all-solutions predicates into their own module, solutions.m.
For now there are (obsolete) forwarding predicates from this module to
the new one. The forwarding predicates will be included in the
upcoming 0.13 release and then removed in later versions.
Move semidet_succeed, semidet_fail, cc_multi_equal and dynamic_cast
to builtin.m
library/solutions.m:
New file. This is the new home for the all-solutions predicates.
This is pretty much cut and pasted from std_util (with module
qualifiers updated accordingly). I've rearranged the code in a more
top-down fashion as per our current coding standard.
library/builtin.m:
Move semidet_fail/0, semidet_succeed/0, cc_multi_equal/2 and
dynamic_cast/2 to this module.
Add semidet_true/0 and semidet_false/0 as synonyms for semidet_fail/0
and semidet_succeed/0.
Add impure_true/0 and semipure_true/0. These are useful for performing
purity casts, e.g. in solver implementations.
library/library.m:
Add the new module.
NEWS:
Announce the changes.
library/*.m:
Update to conform to the above.
compiler/const_prop.m:
Update evaluate_semidet_call/5 with the new module name for
dynamic_cast.
compiler/*.m:
Module qualify calls to solutions to either disambiguate them from the
versions in std_util (where they weren't module qualified) or change
the module qualifier where they were (to avoid warnings about calls to
the now deprecated versions).
tests/debugger/declarative/solutions.*:
Rename this module as the name conflicts with the new library module.
tests/debugger/declarative/solns.*:
Renamed version of above (with updated expected output).
tests/debugger/declarative/Mmakefile:
Handle the renamed version of the solutions test.
tests/debugger/all_solutions.m:
tests/debugger/declarative/args.m:
tests/debugger/declarative/library_forwarding.m:
tests/hard_coded/constant_prop_2.m:
tests/invalid/multisoln_func.m:
tests/invalid/one_member.m:
tests/invalid/promise_equivalent_claueses.m:
tests/valid/simplify_bug2.m:
tests/valid/solv.m:
Update to conform to the above changes.
sample/solutions/*.m:
Update to conform to the above changes.
Estimated hours taken: 12
Branches: main
Remove from std_util.m the predicates that merely call predicates in
the type_desc, construct and deconstruct modules, to reduce clutter
in std_util.m.
library/std_util.m:
Remove those predicates from std_util.m.
library/deconstruct.m:
Add a type we need that was previously defined in std_util.m.
library/construct.m:
Delete some module qualifications that have now become unnecessary,
browser/browse.m:
browser/browser_info.m:
browser/declarative_tree.m:
browser/dl.m:
browser/help.m:
browser/sized_pretty.m:
browser/term_rep.m:
compiler/bytecode_gen.m:
compiler/llds_out.m:
compiler/mlds_to_il.m:
compiler/mlds_to_managed.m:
library/assoc_list.m:
library/hash_table.m:
library/io.m:
library/pprint.m:
library/private_builtin.m:
library/prolog.m:
library/require.m:
library/rtti_implementation.m:
library/store.m:
library/term.m:
library/term_to_xml.m:
library/version_hash_table.m:
mdbcomp/program_representation.m:
Import type_desc.m, construct.m and/or deconstruct.m to provide
definitions of functions or predicates that up till now were in
std_util.m. Modify the calls if the called function or predicate
had a slightly different interface in std_util.m.
Also, convert term_to_xml.m to four-space indentation, and delete
unnecessary module qualifications in term.m.
tests/debugger/polymorphic_output.{m,inp,exp,exp2}:
tests/hard_coded/copy_pred_2.m:
tests/hard_coded/deconstruct_arg.exp:
tests/hard_coded/deconstruct_arg.exp2:
tests/hard_coded/deconstruct_arg.m:
tests/hard_coded/elim_special_pred.m:
tests/hard_coded/existential_bound_tvar.m:
tests/hard_coded/expand.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/higher_order_type_manip.m:
tests/hard_coded/nullary_ho_func.m:
tests/hard_coded/tuple_test.m:
tests/hard_coded/type_ctor_desc.m:
tests/hard_coded/type_qual.m:
tests/hard_coded/write_xml.m:
tests/hard_coded/sub-modules/class.m:
tests/hard_coded/sub-modules/nested.m:
tests/hard_coded/sub-modules/nested2.m:
tests/hard_coded/sub-modules/nested3.m:
tests/hard_coded/sub-modules/parent.m:
tests/hard_coded/sub-modules/parent2.child.m:
tests/hard_coded/typeclasses/existential_rtti.m:
tests/recompilation/type_qual_re.m.1:
cvs update: Updating tests/submodules
cvs update: Updating tests/tabling
cvs update: Updating tests/term
cvs update: Updating tests/tools
cvs update: Updating tests/trailing
cvs update: Updating tests/typeclasses
cvs update: Updating tests/valid
tests/valid/agc_unbound_typevars.m:
tests/valid/agc_unbound_typevars2.m:
tests/valid/agc_unused_in.m:
Replace references to the deleted predicates in std_util with
references to the equivalent predicates in type_desc, construct
and/or deconstruct. In test cases that already tested both the
functionality in std_util and in the other modules, simply delete
the part exercising std_util.
Estimated hours taken: 6
Branches: main
Fix a bug with solver types and mutables that was causing the compiler to
abort in deep profiling grades (The HLDS was incorrect in all grades, it just
didn't show in most of them). The bug occurred when a mutable was initialised
with a non-ground value, as in the following example derived from Ralph's sat
solver:
:- mutable(global, sat_literal, _, any, [untrailed]).
(sat_literal is some solver type).
The problem was that when adding the clauses for the mutable initialisation
predicates to the HLDS we did not consider that the initial value might be a
variable, as in this case, and attached an empty varset to the clause instead
of one containing the variable.
For the intialisation predicate for the above mutable, we have the following
at stage 197:
msat.initialise_mutable_global :-
msat.'__Initialise__'(V_1),
impure msat.set_global(V_1).
The prog_varset is (incorrectly) empty at this point - it should contain
V_1.
Deep profiling, stage 205, now comes along and starts allocating fresh
variables. The results pretty much speak for themselves ;-)
msat.initialise_mutable_global :-
ProcStaticLayout = deep_profiling_proc_layout(...),
impure det_call_port_code_sr(ProcStaticLayout, TopCSD,
MiddleCSD, ActivationPtr),
SiteNum = 0,
impure prepare_for_normal_call(SiteNum),
msat.'__Initialise__'(TopCSD), % *** should be V_1
SiteNum = 1,
impure prepare_for_normal_call(SiteNum),
impure msat.set_global(TopCSD), % *** should be V_1
impure det_exit_port_code_sr(TopCSD, MiddleCSD, ActivationPtr).
The fix is to attach the varset we use at parse time to the mutable items and
when adding the clauses for the mutable initialisation predicate to the HLDS,
to use that varset instead of an empty one.
compiler/prog_item.m:
compiler/prog_io.m:
Attach the varset to the mutable item, in case the initial value term
has a non-ground value.
compiler/make_hlds_passes.m:
Use the above varset when constructing the clauses for the mutable
initialisation predicates in order to avoid the bug outlined above.
compiler/equiv_type.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
Conform to the above changes to the mutable item.
tests/valid/Mmakefile:
tests/valid/solver_type_mutable_bug.m:
Test case for the above derived from msat.m by Ralph.
Estimated hours taken: 2
Branches: main
Remove support for the Aditi backend. It is a pain to have to update it every
time a data structure changes when we don't see any benefit from it, and its
presence makes compilation of the compiler directory take about 10% longer
(since the Aditi backend modules are roughly 10% of the code in the compiler
directory). Deleting the Aditi-specific data structures from the HLDS should
also speed up compilation a little bit.
I have spoken to Rao and he is fine with this step.
Aditi users, if there are any, can continue to use the Aditi support in
release 0.12.*. I also tagged the last version on the trunk to support aditi
with the name "last_aditi". The need for modifications in this Aditi support
is likely to be very rare to nonexistent, if the recent past is any guide:
the Aditi backend hasn't seen a nontrivial modification in a year or more.
This diff removes a net 31492 lines.
compiler/add_aditi.m:
compiler/aditi_backend.pp:
compiler/aditi_builtin_ops.m:
compiler/context.m:
compiler/dnf.m:
compiler/magic.m:
compiler/magic_util.m:
compiler/rl.m:
compiler/rl_analyse.m:
compiler/rl_block.m:
compiler/rl_block_opt.m:
compiler/rl_code.m:
compiler/rl_dump.m:
compiler/rl_exprn.m:
compiler/rl_file.pp:
compiler/rl_gen.m:
compiler/rl_info.m:
compiler/rl_key.m:
compiler/rl_liveness.m:
compiler/rl_loop.m:
compiler/rl_opt.m:
compiler/rl_out.pp:
compiler/rl_relops.m:
compiler/rl_sort.m:
compiler/rl_stream.m:
Remove these compiler modules, since they existed only to support the
Aditi backend.
compiler/hlds_goal.m:
Delete the Aditi-specific components of goals (e.g. the aditi-builtin
kind of generic calls and Aditi-evaluated lambdas).
compiler/hlds_pred.m:
Delete the Aditi-specific components of pred_infos.
compiler/prog_data.m:
Delete the Aditi-specific items.
compiler/passes_aux.m:
Don't worry about processing all procedures or just all non-Aditi
procedures.
compiler/add_clause.m:
Add a predicate from a deleted module that is now used only here.
compiler/*.m:
Conform to the data structure changes above.
compiler/notes/*.html:
Remove references to the Aditi backend.
tests/invalid/aditi.m:
tests/invalid/aditi_errors.err_exp:
tests/invalid/aditi_errors.m:
tests/invalid/aditi_private_builtin.m:
tests/invalid/aditi_state_errors.err_exp:
tests/invalid/aditi_state_errors.m:
tests/invalid/aditi_update_derived_relation.err_exp:
tests/invalid/aditi_update_derived_relation.m:
tests/invalid/aditi_update_errors.err_exp:
tests/invalid/aditi_update_errors.m:
tests/invalid/aditi_update_mode_errors.err_exp:
tests/invalid/aditi_update_mode_errors.m:
tests/valid/aditi.m:
tests/valid/aditi_calls_mercury.m:
tests/valid/aditi_error_bug.m:
tests/valid/aditi_error_bug2.m:
tests/valid/aditi_error_bug3.m:
tests/valid/aditi_private_builtin.m:
tests/valid/aditi_query.m:
tests/valid/aditi_update.m:
tests/valid/base_relation.m:
tests/valid/base_relation2.m:
tests/valid/ite_to_disj.m:
Remove these Aditi-specific tests.
tests/*/Mmakefile:
Remove the references to these Aditi-specific tests.
Estimated hours taken: 2
Branches: main
Fix a problem introduced by my recent changes to simplify.m that broke the
nightly builds on those hosts that use `--intermodule-optimization'. When
compiling with `--intermodule-optimization --no-fully-strict' simplify now
realises that it can replace calls to `builtin.false/0' with `fail'. In the
process of doing so it was emitting warning about `false' never succeeding.
compiler/simplify.m:
Don't emit a warning when replacing calls to builtin.false/0 with
fail.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/builtin_false.m:
Test case for the above.