tests/hard_coded/*.m:
Update programming style, unless doing so would change
the meaning of the test, in particular:
- use '.' as a module qualifier in place of '__'
- use {write,print}_line where appropriate
- use if-then-else in place of C -> T ; E
- use state variables in place of DCGs
tests/hard_coded/dir_test.m:
Document what the expected outputs correspond to.
Use a uniform module qualifier in the output.
tests/hard_coded/dir_test.exp*:
Conform to the above change.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
Estimated hours taken: 30
Get the system to work with --no-special-preds, relying on RTTI interpretation
to perform unifications and comparisons, in almost all cases. The only thing
that doesn't work is comparisons involving types with user-defined equality;
the generated exception does not get propagated across MR_call_engine
boundaries properly.
compiler/make_hlds.m:
With --no-special-spreds, do not generate even declarations for
type-specific index and compare predicates. Generate declarations
and clauses for type-specific unify predicates, since we may need
them for unifications that are not (in,in). However, we prevent
the generation of code for the (in,in) case (i.e. mode 0) by pretending
that the unify predicate is pseudo_imported, even in the module
defining the type. There is one exception to this: for types with
user-defined equality, we do generate a proper __Unify__ predicate,
since this is the only convenient way to convert the specified
sym_name of the equality predicate into a pred_id and proc_id,
and a proper __Compare__ predicate, since this is the only convenient
way to generate the full type name for the error message at runtime
(due to polymorphism, the full type may not be known at compile time).
(Finding the pred_id may require resolving type overloading,
and finding the proc_id may require mode checking.)
compiler/simplify.m:
When converting complicated unifications to calls, call the generic
unify/2 and compare/3 predicates instead of the type-specific
__Unify__ and __Compare__ predicates, if the latter do not exist.
compiler/higher_order.m:
Do not specialize calls to the generic unify/2 and compare/3 predicates
to type-specific __Unify__ and __Compare__ predicates, if the latter
do not exist.
Previously, we were not specializing comparisons of builtins and
enumerations here, leaving it to inlining. In the absence of
--special-preds, that doesn't work for enumerations, since there
is no compiler-generated comparison predicate to do the inlining in.
We therefore now perform both specializations.
compiler/polymorphism.m:
Fix a bug: the code for looking up the special preds for user defined
types was handling enums as builtins, which they are not: they can have
user-defined equality.
compiler/type_ctor_info.m:
Even with --no-special-preds, the type has type-specific __Unify_
and __Compare__ predicates if it has user-defined equality. These
predicates must be, and now are, put into the type_ctor_info.
runtime/mercury_wrapper.[ch]:
Expand the facilities for collecting statistics about unify, index
and compare operations. We used to collect only counts of operations
for each type_ctor_rep; we now also collect counts of operations
for each specific type. Rename MR_CTOR_REP_STATS as MR_TYPE_CTOR_STATS
to reflect this expansion.
runtime/mercury_conf_param.h:
Document MR_TYPE_CTOR_STATS instead of MR_CTOR_REP_STATS.
runtime/mercury_ho_call.c:
runtime/mercury_unify_compare_body.h:
Fix a bug that showed with --no-special-preds: the Mercury predicate
unify_2_0 cannot call the MR_generic_compare function to handle the
arguments of a function symbol, because comparison is not defined
on types with user-defined equality. Instead, we need to call the new
MR_generic_unify C function, which does work on such types.
Fix a bug that showed with --no-special-preds: the MR_succip register
has to be saved and restored across calls to MR_generic_unify, since
for types with user-defined equality, such calls involve a recursive
invocation of the Mercury engine.
Optimize the unification of du types by performing only one
functor_desc lookup instead of two, and failing as early as possible.
Use the new statistics facilities provided by mercury_wrapper.c.
tools/bootcheck
If the new --type-stats option is given, preserve the type constructor
statistics derived from (a) the stage 3 compilation process, and (b)
compiling the test suite, for later analysis.
tools/type_ctor_stats:
A new shell script to analyze type constructor statistics in their
new, expanded format.
tests/hard_coded/user_defined_equality.{m,exp}:
Test comparisons as well as unifications on enums with user-defined
equality.
Estimated hours taken: 0.5
runtime/mercury_ho_call.c:
Disable the MR_UNIFY_COMPARE_BY_CTOR_REP code,
because it does the wrong thing for enumerations
with user-defined equality types.
tests/hard_coded/Mmakefile:
tests/hard_coded/user_defined_equality.m:
tests/hard_coded/user_defined_equality.exp:
Add a regression test.