mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 14:25:56 +00:00
15df6f9323f018f50f243b9a6faaa797de09e21f
253 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
4e66989587 | Don't clean up a file we never create. | ||
|
|
ae4b736fdd |
Implement warnings for suspicious recursion.
compiler/simplify_goal_call.m:
If the --warn-suspicious-recursion option is set, and if the warning
isn't disabled, generate warnings for two different kinds of suspicious
recursion. They are both related to, but separate from, the warning
we have long generated for infinite recursion, which occurs when
the input args of a recursive call are the same as the corresponding
args in the clause head.
Both kinds suspicious recursion look at the input args of a recursive call
that are NOT the same as the corresponding args in the clause head.
Both require these args to have non-unique modes. (If they have unique
modes, then the depth of the recursion may be controlled by state outside
the view of the Mercury compiler, which means that a warning would be
likely to be misleading.)
The first kind is when all these args use state variable notation.
Most of the time, we use state var notation to denote the data structures
updated by the recursive code; having variables using such notation
*controlling* the recursion is much less common, and much more likely
to be unintended. The motivation for the new option was this infinitely
looping code, which resulted from neglecting to s/[X | Xs]/Xs/ after
cutting-and-pasting the clause head to the recursive call.
p([X | Xs], !S) :-
...,
p([X | Xs], !S).
The other kind of suspicious recursive call we warn about involve
input arguments where the base names of the input arguments (the part
before any numeric suffixes) seem be switched between the clause head
and the recursive call, as here:
q(As0, Bs0, ...) :-
...,
q(Bs1, As, ...).
compiler/mercury_compile_main.m:
Disable style warnings when invoked with --make-optimization-interface
or its transitive variant. Without this, warnings about suspicious
recursion would get reported in such invocations.
Move a test from a callee to a caller to allow the callee to be
less indented.
compiler/options.m:
Export functionality to mercury_compile_main.m to make the above possible.
library/string.m:
Add a predicate to convert a string to *reverse* char list directly.
Note a discrepancy between the documentation and the implementation
of the old predicate the new one is based on (which converts a string
to a forward char list).
NEWS:
Note the new predicate in string.m.
compiler/cse_detection.m:
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/deforest.m:
compiler/dep_par_conj.m:
compiler/det_analysis.m:
compiler/distance_granularity.m:
compiler/frameopt.m:
compiler/inst_util.m:
compiler/lp_rational.m:
compiler/matching.m:
compiler/modes.m:
compiler/old_type_constraints.m:
compiler/rbmm.points_to_analysis.m:
compiler/rbmm.region_arguments.m:
compiler/recompilation.usage.m:
compiler/stratify.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.indirect.m:
compiler/typeclasses.m:
compiler/use_local_vars.m:
deep_profiler/callgraph.m:
deep_profiler/canonical.m:
library/bit_buffer.read.m:
library/bit_buffer.write.m:
library/calendar.m:
library/diet.m:
library/lexer.m:
library/parser.m:
library/parsing_utils.m:
library/ranges.m:
library/set_ctree234.m:
library/set_tree234.m:
library/string.parse_util.m:
library/tree234.m:
library/varset.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
profiler/demangle.m:
Avoid warnings for suspicious recursion. In most cases, do this by
wrapping disable_warning scopes around the affected recursive calls;
in a few cases, do this by changing the code.
tests/warnings/suspicious_recursion.{m,exp}:
A test case for the new warnings.
tests/warnings/Mercury.options:
tests/warnings/Mmakefile:
Enable the new test case.
|
||
|
|
1f8d8aeabf |
Warn about non-contiguous clauses in the Mercury system by default.
configure.ac:
Require the installed compiler to have the recent bug fix to
contiguity warnings, since without that bug fix, we get warnings
for code that is actually perfectly ok.
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
Specify both --warn-non-contiguous-clauses and
--warn-non-contiguous-foreign-procs as the default in each directory.
library/Mercury.options:
Disable the warnings for exception.m and io.m, which are have not
been cleaned up yet wrt these warnings.
|
||
|
|
c5ac31fdcb |
Enable --warn-suspicious-foreign-code.
Enable the recently added --warn-suspicious-foreign-code warning by default for
the Mercury system.
configure.ac:
Check that --warn-suspicious-foreign-code is supported by the bootstrap
compiler
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
profiler/PROF_FLAGS.in:
Enable the option.
|
||
|
|
8303b503b6 |
Unify and compare packed args in bulk when possible.
compiler/unify_proc.m:
Try to optimize the code we generate for unification and comparison
predicates when a function symbol's arguments include sub-word-sized
arguments packed together into a word.
For unify predicates, generate code to test whether the two words
at the same offset in the terms being unified are equal. This works
regardless of whether the arguments are signed or unsigned.
For compare predicates, generate code to compare the two words
at the same offset in the terms being compared *if* all the arguments
in the terms being compared are unsigned. This works because we put
the earlier arguments in the more significant bit positions. But if
some of the arguments are signed, then divide the argument word
in sequences of zero or more unsigned arguments separated by signed
arguments. We then generate code that compares any contiguous sequences
of unsigned arguments in bulk, while comparing each signed field
separately.
Do the bulk unification and comparison via foreign_proc goals generated
inline. This works only when we are generating C, but this is ok because
we pack sub-word-sized arguments into a word only when generating C.
We do the comparison of signed sub-word-sized fields (int8, int16 or int32)
via foreign_proc goals generated inline as well. Doing them using unify
goals would work as well, but would be less efficient in general. This is
because having N such arguments in a function symbols requires storing
only one value across calls for each term being compared (the term itself)
when generating foreign_procs, but would require storing N values across
calls (the values of the sub-word-sized signed arguments) when generating
unifications. Generating inline foreign_procs is effectively a manual
application of the optimization implemented by saved_vars.m.
library/private_builtin.m:
Add the builtin predicates that unify_proc.m now generates calls to.
We should never need their bodies, but the compiler does need to know
the declarations of all predicates mentioned in inline foreign_procs.
configure.ac:
runtime/mercury_conf.h.in:
Define either MR_MERCURY_IS_32_BITS or MR_MERCURY_IS_64_BITS depending
on the word size. Make the configured value of MR_BITS_PER_WORD available
to C code.
mdbcomp/program_representation.m:
Register the new builtin predicates as no_typeinfo_builtins, i.e.
builtins whose arguments' types contain type variables, that nevertheless
should *not* be passed the typeinfos of the actual types bound to those
type variables.
compiler/hlds_clauses.m:
Bulk unification of arguments works only when all the arguments involved
are initially ground. The optimized unification clauses we can now generate
are thus appropriate only for <in,in> unifications. (Technically, they
*would* work for unifications for which the function symbol arguments
involved in bulk unify operations are ground even if some other arguments
are initially free, but that distinction is too hard to make, compared
to the extremely small performance gain that would be available
if we *could* make that distinction.)
Provide a way for unify_proc.m to mark a clause as being for use either
in the <in,in> modes of unifications (for the optimized version using bulk
unifications), or as in all other modes of unifications (for a version in
which that optimization has been disabled).
Replace two boolean fields in clauses_infos with bespoke types, for
greater readability and reliability. These are a remnant of a different
way to differentiate <in,in> vs non-<in,in> clauses that I ultimately
decided against. These bespoke types are independent of the main change
in this diff, but there is no reason to undo their use.
compiler/clause_to_proc.m:
When copying clauses to procedure bodies inside type-specific unify
predicates, pay attention to the markers that unify_proc.m put on
those clauses about which are for <in,in> modes and which are for
non-<in,in> modes.
To make this possible, make our callers pass us extra information.
compiler/options.m:
Add a bootstrapping option that governs whether unify_proc.m should
try to apply the new optimization.
Give an option that governs comparisons of function symbols for Erlang
a name that reflects that fact.
compiler/hlds_pred.m:
Fix a misleading predicate name.
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/dead_proc_elim.m:
compiler/det_report.m:
compiler/erl_code_gen.m:
compiler/handle_options.m:
compiler/higher_order.m:
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/hlds_statistics.m:
compiler/intermod.m:
compiler/mercury_compile_front_end.m:
compiler/ml_proc_gen.m:
compiler/modecheck_unify.m:
compiler/proc_gen.m:
compiler/proc_requests.m:
compiler/purity.m:
compiler/resolve_unify_functor.m:
compiler/structure_reuse.indirect.m:
compiler/structure_sharing.analysis.m:
compiler/tabling_analysis.m:
compiler/type_constraints.m:
compiler/typecheck.m:
compiler/unused_args.m:
Conform to the changes above.
|
||
|
|
2d02046650 | Simplify the code of a predicate. | ||
|
|
72f174b4e2 |
Don't print value of errno in MR_fatal_error.
The majority of calls to MR_fatal_error do not follow an operation that sets errno, so printing out an error message unrelated to the reason for the fatal error will lead to confusion. It can also cause test failures if errno happens to be set to non-zero some time prior to an expected call to MR_fatal_error. Fixes bug #464. runtime/mercury_misc.c: Don't print value of errno in MR_fatal_error. runtime/mercury_context.c: runtime/mercury_thread.c: Pass strerror strings to MR_fatal_error where appropriate. runtime/mercury_memory_zones.c: runtime/mercury_memory_zones.h: Pass strerror strings to MR_fatal_error following failures of MR_protect_pages. Document that this assumes MR_protect_pages sets errno on error. Skip unnecessary call to sprintf before MR_fatal_error. runtime/mercury_deep_profiling.c: Skip unnecessary call to sprintf before MR_fatal_error. Reduce size of some buffers. runtime/mercury_overflow.c: runtime/mercury_stack_trace.c: Pass a fixed format string to MR_fatal_error just in case the message string may contain percentage signs. runtime/mercury_tabling.c: Skip unnecessary call to sprintf before MR_fatal_error. deep_profiler/timeout.m: library/thread.m: mdbcomp/shared_utilities.m: Pass strerror strings to MR_fatal_error where appropriate. trace/mercury_trace.c: Skip unnecessary call to sprintf before MR_fatal_error. trace/mercury_trace_external.c: Pass a fixed format string to MR_fatal_error just in case. |
||
|
|
7a14e6d7bd |
Fix missing whitespace.
library/getopt_io.m:
mdbcomp/rtti_access.m:
As above.
|
||
|
|
2bfe4d402c | Compile everything with --halt-at-warn-if-possible. | ||
|
|
83d1ce637e |
Delete private_builtin.store_at_ref.
It was deprecated in favour of store_at_ref_impure ten years ago.
library/private_builtin.m:
Delete the predicate's declaration.
compiler/builtin_ops.m:
Delete the predicate's definition as a builtin.
compiler/add_pred.m:
compiler/lco.m:
compiler/term_constr_initial.m:
mdbcomp/program_representation.m:
Delete references to the predicate.
|
||
|
|
46fbdba449 |
Workaround limitations of the Roslyn C# compiler on non-Windows systems.
Signing assemblies with a strong name does not work with the Rosyln C# compiler on non-Windows systems. Delay sign assemblies on non-Windows system instead when using this compiler. (This is what the Mono documentation currently recommends.) configure.ac: browser/MDB_FLAGS.in: library/LIB_FLAGS.in: mdbcomp/MDBCOMP_FLAGS.in: ssdb/SSDB_FLAGS.in: As above. |
||
|
|
006b29bd20 |
Fix strncpy() string truncation warning.
mdbcomp/rtti_access.m:
Fix gcc -Wstringop-truncation warning for call to strncpy().
|
||
|
|
d465fa53cb |
Update the COPYING.LIB file and references to it.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
|
||
|
|
f519e26173 |
Add builtin 64-bit integer types -- Part 1.
Add the new builtin types: int64 and uint64.
Support for these new types will need to be bootstrapped over several changes.
This is the first such change and does the following:
- Extends the compiler to recognise 'int64' and 'uint64' as builtin types.
- Extends the set of builtin arithmetic, bitwise and relational operators
to cover the new types.
- Adds the new internal option '--unboxed-int64s' to the compiler; this will be
used to control whether 64-bit integer types are boxed or not.
- Extends all of the code generators to handle the new types.
- Extends the runtimes to support the new types.
- Adds new modules to the standard library intend to contain basic operations
on the new types. (These are currently empty and not documented.)
There are bunch of limitations marks with "XXX INT64"; these will be lifted in
part 2 of this change. Also, 64-bit integer types are currently always boxed,
again this limitation will be lifted in later changes.
compiler/options.m:
Add the new option --unboxed-int64s.
compiler/prog_type.m:
compiler/prog_data.m:
compiler/builtin_lib_types.m:
Recognise int64 and uint64 as builtin types.
compiler/builtin_ops.m:
Add builtin operations for the new types.
compiler/hlds_data.m:
Add new tag types for the new types.
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/export.m:
compiler/foreign.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_dependency_graph.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/mercury_to_mercury.m:
compiler/mode_util.m:
compiler/module_qual.qualify_items.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_name.m:
compiler/polymorphism.m:
compiler/prog_out.m:
compiler/prog_util.m:
compiler/rbmm.execution_path.m:
compiler/rtti.m:
compiler/table_gen.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the above changes to the parse tree and HLDS.
compiler/c_util.m:
Support writing out constants of the new types.
compiler/llds.m:
Add a representation for constants of the new types to the LLDS.
compiler/stack_layout.m:
Add a new field to the stack layout params that records whether
64-bit integers are boxed or not.
compiler/call_gen.:m
compiler/code_info.m:
compiler/disj_gen.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/global_data.m:
compiler/jumpopt.m:
compiler/llds_out_data.m:
compiler/llds_out_instr.m:
compiler/lookup_switch.m:
compiler/mercury_compile_llds_back_end.m:
compiler/prog_rep.m:
compiler/prog_rep_tables.m:
compiler/var_locn.m b/compiler/var_locn.m:
Support the new types in the LLDS code generator.
compiler/mlds.m:
Support constants of the new types in the MLDS.
compiler/ml_call_gen.m:
compiler/ml_code_util.m:
compiler/ml_global_data.m:
compiler/ml_rename_classes.m:
compiler/ml_top_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/ml_util.m:
compiler/mlds_to_target_util.m:
compiler/rtti_to_mlds.m:
Conform to the above changes to the MLDS.
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
Generate the appropriate target code for constants of the new types
and operations involving them.
compiler/bytecode.m:
compiler/bytecode_gen.m:
Handle the new types in the bytecode generator; we just abort if we
encounter them for now.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_call_gen.m:
compiler/erl_code_util.m:
compiler/erl_unify_gen.m:
Handle the new types in the Erlang code generator.
library/private_builtin.m:
Add placeholders for the builtin unify and compare operations for
the new types. Since the bootstrapping compiler will not recognise
the new types we give them polymorphic arguments. These can be
replaced after this change has bootstrapped.
Update the Java list of TypeCtorRep constants here.
library/int64.m:
library/uint64.m:
New modules that will eventually contain builtin operations on the new
types.
library/library.m:
library/MODULES_UNDOC:
Do not include the above modules in the library documentation for now.
library/construct.m:
library/erlang_rtti_implementation.m:
library/rtti_implementation.m:
library/table_statistics.m:
deep_profiler/program_representation_utils.m:
mdbcomp/program_representation.m:
Handle the new types.
configure.ac:
runtime/mercury_conf.h.in:
Define the macro MR_BOXED_INT64S. For now it is always defined, support for
unboxed 64-bit integers will be enabled in a later change.
runtime/mercury_dotnet.cs.in:
java/runtime/TypeCtorRep.java:
runtime/mercury_type_info.h:
Update the list of type_ctor reps.
runtime/mercury.h:
runtime/mercury_int.[ch]:
Add macros for int64 / uint64 -> MR_Word conversion, boxing and
unboxing.
Add functions for hashing 64-bit integer types suitable for use
with the tabling mechanism.
runtime/mercury_tabling.[ch]:
Add additional HashTableSlot structs for 64-bit integer types.
Omit the '%' character from the conversion specifiers we pass via
the 'key_format' argument to the macros that generate the table lookup
function. This is so we can use the C99 exact size integer conversion
specifiers (e.g. PRIu64 etc.) directly here.
runtime/mercury_hash_lookup_or_add_body.h:
Add the '%' character that was omitted above to the call to debug_key_msg.
runtime/mercury_memory.h:
Add new builtin allocation sites for boxed 64-bit integer types.
runtime/mercury_builtin_types.[ch]:
runtime/mercury_builitn_types_proc_layouts.h:
runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_table_type_body.h:
runtime/mercury_tabling_macros.h:
runtime/mercury_tabling_preds.h:
runtime/mercury_term_size.c:
runtime/mercury_unify_compare_body.h:
Add the new builtin types and handle them throughout the runtime.
runtime/Mmakefile:
Add mercury_int.c to the list of .c files.
doc/reference_manual.texi:
Add the new types to the list of reserved type names.
Add the mapping from the new types to their target language types.
These are commented out for now.
|
||
|
|
014ca2144b |
Enable --warn-insts-with-functors-without-type.
configure.ac:
Require that the installed compiler support this option (which I added
about two weeks ago).
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
Specify this option by default for every directory that contains
Mercury code.
|
||
|
|
d9e576a2b2 |
Specify the type for inst definitions.
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
library/*.m:
mdbcomp/*.m:
ssdb/*.m:
Specify the type constructor for every inst definition that lists
the functors that values of that type may be bound to.
In library/maybe.m, delete the inst maybe_errors/1, because
(a) its name is misleading, since it is for the maybe_error/1 type (no s),
and (b) there is already an inst with the non-misleading name maybe_error
which had an identical definition.
In compiler/dep_par_conj.m, delete two insts that were duplicates
of insts defined in hlds_goal.m, and replace references to them
accordingly.
|
||
|
|
ba24a880fe |
Add targets for building stage 3 C# source files.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
Add the 'css' target for building the C# source files.
|
||
|
|
345bdfff55 |
Add targets for building the Java source files only.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/mdbcmp/Mmakefile:
profiler/Mmakefile:
slice/Mmakefile:
ssdb/Mmakefile:
As above (required for stage 3).
Delete residual references to the IL backend.
|
||
|
|
8a240ba3f0 |
Add builtin 8, 16 and 32 bit integer types -- Part 1.
Add the new builtin types: int8, uint8, int16, uint16, int32 and uint32.
Support for these new types will need to be bootstrapped over several changes.
This is the first such change and does the following:
- Extends the compiler to recognise 'int8', 'uint8', 'int16', 'uint16', 'int32'
and 'uint32' as builtin types.
- Extends the set of builtin arithmetic, bitwise and relational operators to
cover the new types.
- Extends all of the code generators to handle new types. There currently lots
of limitations and placeholders marked by 'XXX FIXED SIZE INT'. These will
be lifted in later changes.
- Extends the runtimes to support the new types.
- Adds new modules to the standard library intended to hold the basic
operations on the new types. (These are currently empty and not documented.)
This change does not introduce the two 64-bit types, 'int64' and 'uint64'.
Their implementation is more complicated and is best left to a separate change.
compiler/prog_type.m:
compiler/prog_data.m:
compiler/builtin_lib_types.m:
Recognise int8, uint8, int16, uint16, int32 and uint32 as builtin types.
Add new type, int_type/0,that enumerates all the possible integer types.
Extend the cons_id/0 type to cover the new types.
compiler/builtin_ops.m:
Parameterize the integer operations in the unary_op/0 and binary_op/0
types by the new int_type/0 type.
Add builtin operations for all the new types.
compiler/hlds_data.m:
Add new tag types for the new types.
compiler/hlds_pred.m:
Parameterize integers in the table_trie_step/0 type.
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/export.m:
compiler/foreign.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_dependency_graph.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/mercury_to_mercury.m:
compiler/mode_util.m:
compiler/module_qual.qualify_items.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/parse_tree_out_info.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_name.m:
compiler/polymorphism.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_rep_tables.m:
compiler/prog_util.m:
compiler/rbmm.exection_path.m:
compiler/rtti.m:
compiler/rtti_to_mlds.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/type_constraints.m:
compiler/type_ctor_info.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/xml_documentation.m:
Conform to the above changes to the parse tree and HLDS.
compiler/c_util.m:
Support generating the builtin operations for the new types.
doc/reference_manual.texi:
Add the new types to the list of reserved type names.
Add the mapping from the new types to their target language types.
These are commented out for now.
compiler/llds.m:
Replace the lt_integer/0 and lt_unsigned functors of the llds_type/0,
with a single lt_int/1 functor that is parameterized by the int_type/0
type.
Add a representations for constants of the new types to the LLDS.
compiler/call_gen.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/global_data.m:
compiler/jumpopt.m:
compiler/llds_out_data.m:
compiler/llds_out_global.m:
compiler/llds_out_instr.m:
compiler/lookup_switch.m:
compiler/middle_rec.m:
compiler/peephole.m:
compiler/pragma_c_gen.m:
compiler/stack_layout.m:
compiler/string_switch.m:
compiler/switch_gen.m:
compiler/tag_switch.m:
compiler/trace_gen.m:
compiler/transform_llds.m:
Support the new types in the LLDS code generator.
compiler/mlds.m:
Support constants of the new types in the MLDS.
compiler/ml_accurate_gc.m:
compiler/ml_call_gen.m:
compiler/ml_code_util.m:
compiler/ml_disj_gen.m:
compiler/ml_foreign_proc_gen.m:
compiler/ml_global_data.m:
compiler/ml_lookup_switch.m:
compiler/ml_simplify_switch.m:
compiler/ml_string_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tailcall.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/ml_util.m:
compiler/mlds_to_target_util.m:
Conform to the above changes to the MLDS.
compiler/mlds_to_c.m:
compiler/mlds_to_cs.m:
compiler/mlds_to_java.m:
Generate the appropriate target code for constants of the new
types and operations involving them.
compiler/bytecode.m:
compiler/bytecode_gen.m:
Handle the new types in the bytecode generator; we just abort if we
encounter them for now.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_call_gen.m:
compiler/erl_code_util.m:
compiler/erl_rtti.m:
compiler/erl_unify_gen.m:
Handle the new types in the Erlang code generator.
library/private_builtin.m:
Add placeholders for the builtin unify and compare operations for
the new types. Since the bootstrapping compiler will not recognise
the new types we give the polymorphic arguments. These can be
replaced after this change has bootstrapped.
Update the Java list of TypeCtorRep constants.
library/int8.m:
library/int16.m:
library/int32.m:
library/uint8.m:
library/uint16.m:
library/uint32.m:
New modules that will eventually contain builtin operations
on the new types.
library/library.m:
library/MODULES_UNDOC:
Do not include the above modules in the library documentation
for now.
library/construct.m:
library/erlang_rtti_implementation.m:
library/rtti_implementation.m:
deep_profiler/program_representation_utils.m:
mdbcomp/program_representation.m:
Handle the new types.
runtime/mercury_dotnet.cs.in:
java/runtime/TypeCtorRep.java:
runtime/mercury_type_info.h:
Update the list of TypeCtorReps.
configure.ac:
runtime/mercury_conf.h.in:
Check for the header stdint.h.
runtime/mercury_std.h:
Include stdint.h; abort if that header is no present.
runtime/mercury_builtin_types.[ch]:
runtime/mercury_builtin_types_proc_layouts.h:
runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h
runtime/mercury_table_type_body.h:
runtime/mercury_tabling_macros.h:
runtime/mercury_tabling_preds.h:
runtime/mercury_term_size.c:
runtime/mercury_unify_compare_body.h:
Add the new builtin types and handle them throughout the runtime.
|
||
|
|
1a778114db |
Fix more warnings from --warn-inconsistent-pred-order-clauses.
mdbcomp/builtin_modules.m:
mdbcomp/feedback.automatic_parallelism.m:
mdbcomp/feedback.m:
mdbcomp/mdbcomp.goal_path.m:
mdbcomp/mer_mdbcomp.m:
mdbcomp/prim_data.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/sym_name.m:
mdbcomp/trace_counts.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most modules, either the order of the declarations or the order
of the definitions made sense, and I changed the other to match.
In some modules, neither made sense, so I changed *both* to an order
that *does* make sense (i.e. it has related predicates together).
Move one predicate that is needed in two modules from one of them
to a third module (prim_data.m), since that is the one that defines
the type for which the predicate is a utility predicate.
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style.
mdbcomp/MDBCOMP_FLAGS.in:
Since all the modules in this directory are now free from any warnings
generated by --warn-inconsistent-pred-order-clauses, specify that option
by default in this directory to keep it that way.
|
||
|
|
a56c4f5708 |
Merge integer tokens in lexer.
library/lexer.m:
Merge the 'integer' and 'big_integer' tokens and extend them to include
signedness and size information. This conforms to recent changes to
the rest of the system and is another step towards supporting additional
types of integer literal.
library/parser.m:
mdbcomp/trace_counts.m:
Conform to the above change.
tests/hard_coded/impl_def_lex.exp:
tests/hard_coded/impl_def_lex_string.exp:
tests/hard_coded/lexer_bigint.exp:
tests/hard_coded/lexer_zero.exp*:
tests/hard_coded/parse_number_from_string.exp*:
Update these expected outputs.
|
||
|
|
e6e295a3cc |
Generalise the representation of integers in the term module.
In preparation for supporting uint literals and literals for the fixed size
integer types, generalise the representation of integers in the term module, so
that for every integer literal we record its base, value (as an arbitrary
precision integer), signedness and size (the latter two based on the literal's
suffix or lack thereof).
Have the lexer attach information about the integer base to machine sized ints;
we already did this for the 'big_integer' alternative but not the normal one.
In conjunction with the first change, this fixes a problem where the compiler
was accepting non-decimal integers in like arity specifications. (The
resulting error messages could be improved, but that's a separate change.)
Support uints in more places; mark other places which require further work with
XXX UINT.
library/term.m:
Generalise the representation of integer terms so that we can store
the base, signedness and size of a integer along with its value.
In the new design the value is always stored as an arbitrary precision
integer so we no longer require the big_integer/2 alternative; delete it.
Add some utility predicates that make it easier to work with integer terms.
library/term_conversion.m:
library/term_io.m:
Conform to the above changes,
Add missing handling for uints in some spots; add XXX UINT comments
in others -- these will be addressed later.
library/lexer.m:
Record the base of word sized integer literals.
library/parser.m:
compiler/analysis_file.m:
compiler/fact_table.m:
compiler/get_dependencies.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_util.m:
compiler/intermod.m:
compiler/make.module_dep_file.m:
compiler/parse_class.m:
compiler/parse_inst_mode_name.m:
compiler/parse_item.m:
compiler/parse_pragma.m:
compiler/parse_sym_name.m:
compiler/parse_tree_out_term.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_defn.m:
compiler/parse_util.m:
compiler/prog_ctgc.m:
compiler/prog_util.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/superhomogeneous.m:
mdbcomp/trace_counts.m:
samples/calculator2.m:
extras/moose/moose.m:
Conform to the above changes.
tests/hard_coded/impl_def_lex.exp:
tests/hard_coded/impl_def_lex_string.exp:
tests/hard_coded/lexer_bigint.exp*:
tests/hard_coded/lexer_zero.exp*:
tests/hard_coded/parse_number_from_string.exp*:
tests/hard_coded/term_to_unit_test.exp:
Update these expected outputs.
|
||
|
|
baddfd37cd |
Make --warn-unused-imports the default for the Mercury system.
browser/MDB_FLAGS.in:
compiler/COMP_FLAGS.in:
deep_profiler/DEEP_FLAGS.in:
library/LIB_FLAGS.in:
mdbcomp/MDBCOMP_FLAGS.in:
mfilterjavac/MFILTERJAVAC_FLAGS.in:
profiler/PROF_FLAGS.in:
slice/SLICE_FLAGS.in:
ssdb/SSDB_FLAGS.in:
Add --warn-unused-imports to the list of default compiler flags
for each directory.
compiler/ml_tailcall.m:
library/io.m:
Delete some unused imports.
|
||
|
|
092e175f45 |
Add a builtin unsigned word sized integer type -- Part 1.
Add a new builtin type: uint, which is an unsigned word sized integer type.
Support for this new type will need be bootstrapped over several changes.
This is the first such change and does the following:
- Extends the compiler to recognize 'uint' as a builtin type.
- Extends the set of builtin operations to include relational and (some)
arithmetic operations on uints.
- Extends all of the code generators to handle the above. There are some
limitations currently marked by 'XXX UINT'. These will be lifted once
the compiler recognised uint and additional library support becomes
available.
- Extends the runtime to support uints.
compiler/prog_type.m:
compiler/prog_data.m:
compiler/builtin_lib_types.m:
Recognize uint as a builtin type.
Add a new alternative to the cons_id/0 type corresponding to the uint type
-- for bootstrapping purposes its argument is currently an int.
compiler/builtin_ops.m:
Add builtin relational and arithmetic operations on uints. Note that the
existing 'unsigned_le' operation is actually intended for use with signed
values. Rather than attempt to modify its meaning, I have just added new
operations specific to the uint type.
compiler/hlds_data.m:
Add a new tag type for uints.
compiler/type_ctor_info.m:
Recognise uint as a builtin.
Bump the RTTI version number here.
compiler/ctgc.selector.m:
compiler/dead_proc_elim.m:
compiler/dependency_graph.m:
compiler/export.m:
compiler/foreign.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/hlds_pred.m:
compiler/implementation_defined_literals.m:
compiler/inst_check.m:
compiler/mercury_to_mercury.m:
compiler/mode_util.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_to_term.m:
compiler/parse_type_name.m:
compiler/polymorphism.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_rep_tables.m:
compiler/prog_util.m:
compiler/rbmm.execution_path.m:
compiler/rtti.m:
compiler/special_pred.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/type_constraints.m:
compiler/type_util.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/unused_imports.m:
compiler/write_module_interface_files.m:
compiler/xml_documentation.m:
Conform to the above changes to the parse tree and HLDS.
compiler/c_util.m:
Support generating builtin operations for uints.
compiler/llds.m:
Add a representation for uint constants to the LLDS.
Map uints onto MR_Unsigned.
compiler/call_gen.m:
compiler/dupproc.m:
compiler/exprn_aux.m:
compiler/global_data.m:
compiler/jumpopt.m:
compiler/llds_out_data.m:
compiler/llds_out_instr.m:
compiler/opt_debug.m:
compiler/opt_util.m:
Support uints in the LLDS code generator.
compiler/mlds.m:
Support uint constants in the MLDS.
compiler/ml_accurate_gc.m:
compiler/ml_call_gen.m:
compiler/ml_global_data.m:
compiler/ml_simplify_switch.m:
compiler/ml_switch_gen.m:
compiler/ml_tailcall.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/ml_util.m:
compiler/rtti_to_mlds.m:
Conform to the above change to the MLDS.
compiler/mlds_to_c.m:
compiler/mlds_to_java.m:
compiler/mlds_to_cs.m:
Generate the appropriate target code for uint constants and uint
relational operations.
compiler/bytecode.m:
compiler/bytecode_gen.m:
Handle uints in the bytecode generator: we just abort if we
encounter them for now.
compiler/elds.m:
compiler/elds_to_erlang.m:
compiler/erl_call_gen.m:
compiler/erl_code_util.m:
compiler/erl_rtti.m:
compiler/erl_unify_gen.m:
Handle uints in the Erlang code generator.
library/private_builtin.m:
Add placeholders for builtin_{unify,compare}_uint. Since the
bootstrapping compiler will not recognize uint as a type, we
give them polymorphic arguments. These can be replaced after
this change has bootstrapped.
Update the Java list of TypeCtorRep constants, which for some
reason is defined here.
library/uint.m:
New module that will eventually contain operations on uints.
library/MODULES_DOCS:
library/library.m:
Add the uint module.
library/construct.m:
library/erlang_rtti_implementation.m:
library/rtti_implementation.m:
mdbcomp/program_representation.m:
Handle uints.
deep_profiler/program_representation_utils.m:
Conform to the above change.
runtime/mercury_dotnet.cs.in:
Update the list of TypeCtorReps for C#
java/runtime/TypeCtorRep.java:
Update this, although the actual TypeCtorRep constants
are defined the library.
runtime/mercury_type_info.h:
Bump the RTTI version number.
Add an alternative for uints to the tyepctor rep enum.
runtime/mercury_builtin_types.{h,c}:
runtime/mercury_builtin_types_proc_layouts.h:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_table_type_body.h:
runtime/mercury_tabling.h:
runtime/mercury_tabling_macros.h:
runtime/mercury_unify_compare_body.h:
Add uint as a builtin type and handle it throughout the runtime.
runtime/mercury_grade.h:
Bump the binary compatibility version.
runtime/mercury_term_size.c:
runtime/mercury_ml_expand_body.h:
Handle uint and fix probable bugs with the handling of ints on
64-bit Windows.
|
||
|
|
20748974b1 |
Reduce use of foreign-exported procs in dir.m.
library/io.m:
Note that io.system_error sometimes takes on Win32 error values.
Remove I/O state arguments on `make_err_msg' and
`make_maybe_win32_err_msg'.
Remove `was_error' argument from `ML_maybe_make_err_msg' and
`ML_maybe_make_win32_err_msg' macros, and rename the macros.
Simplify the macros using `MR_allocate_aligned_string_msg' instead of
`MR_offset_incr_hp_atomic_msg'.
Add `is_maybe_win32_error'.
Write `is_error' and `is_maybe_win32_error' in terms of `make_err_msg'
and `make_maybe_win32_err_msg'.
Add `thread_safe' attributes to some `make_err_msg' implementations.
Delete obsolete foreign exported predicates.
library/dir.m:
Simplify `current_directory' implementations. Avoid calling back
into Mercury from foreign code.
Separate out a code path `make_directory_including_parents' from
`make_directory', for C# and Java backends to override instead of
overriding `make_directory' directly. Avoid calling back into Mercury
from foreign code.
Delete the Erlang override of `make_directory'; just use the generic
implementation.
Simplify `make_single_directory'. Avoid calling back into Mercury
from foreign code.
Reduce use of bare ints between Mercury and foreign procs.
Fix `read_entry' using outdated Dir0 variable instead of Dir.
Catch exceptions in Java `read_entry_2'.
Delete many obsolete foreign exported predicates.
mdbcomp/program_representation.m:
Conform to change.
fixup read_entry
|
||
|
|
13bd996453 |
Only pass -install_name option on Darwin.
The -install_name option broke building with mmake --use-mmake-make on
other operating systems.
browser/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
ssdb/Mmakefile:
As above.
|
||
|
|
700a855efd |
Do not include mdbcomp modules in coverage reports by default.
slice/mcov.m:
Filter trace counts from mdbcomp modules by default. Add a
a new developer-only option, --no-ignore-mdbcomp, that causes
them to be included -- doing so may be useful for those working
on the Mercury compiler itself.
Update copyright messages.
mdbcomp/mdbcomp.m:
mdbcomp/builtin_modules.m:
Add predicates for testing whether a module is part of the mdbcomp
library.
|
||
|
|
39da4409ec |
Add .dep_err files to .gitignore
browser/.gitignore:
compiler/.gitignore:
deep_profiler/.gitignore:
library/.gitignore:
mdbcomp/.gitignore:
mfilterjavac/.gitignore:
profiler/.gitignore:
slice/.gitignore:
ssdb/.gitignore:
As above.
|
||
|
|
be553f9b16 | Turn off lcmc for modules that it doesn't help. | ||
|
|
b3139ba6c2 | Replace references to `:- external' in comments. | ||
|
|
a0760327b6 |
Do stricter checking of mode and determinism declarations.
Specifically, we now do three new checks:
BAD_DETISM: We now generate error messages for predicate declarations
that specify a determinism without also specifying argument modes.
BAD_PREDMODE: We now generate error messages for standalone mode declarations
for predicates whose predicate declaration includes modes for the arguments.
BAD_MODE_SECTION: We now generate error messages for standalone mode
declarations that are not in the same section as the predicate's (or
function's) type declaration.
compiler/hlds_pred.m:
Add a slot to the pred_sub_info. If the predicate is explicitly defined by
the user in the current module, this contains the id of the section that
contains its predicate declaration (for the BAD_MODE_SECTION check)
and whether that predicate declaration also had modes for the arguments
(for the BAD_PREDMODE check).
compiler/add_pred.m:
When adding adding new predicate declarations, perform the BAD_DETISM
check, and record the info needed for the BAD_PREDMODE and BAD_MODE_SECTION
checks.
When adding adding new mode declarations, perform the BAD_PREDMODE
and BAD_MODE_SECTION checks.
compiler/add_class.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_solver.m:
compiler/add_special_pred.m:
compiler/check_typeclass.m:
compiler/dep_par_conj.m:
compiler/higher_order.m:
compiler/make_hlds_passes.m:
compiler/table_gen.m:
compiler/unused_args.m:
Conform to the changes above.
mdbcomp/builtin_modules.m:
Add a utility predicate for use by new code in add_pred.m.
compiler/comp_unit_interface.m:
compiler/goal_util.m:
compiler/prog_rename.m:
compiler/quantification.m:
deep_profiler/program_representation_utils.m:
library/calendar.m:
library/mutvar.m:
library/pretty_printer.m:
library/random.m:
library/set_ctree234.m:
library/solutions.m:
library/stream.string_writer.m:
profiler/globals.m:
tests/accumulator/nonrec.m:
tests/accumulator/out_to_in.m:
tests/declarative_debugging/library_forwarding.m:
tests/dppd/applast_impl.m:
tests/dppd/grammar_impl.m:
tests/dppd/regexp.m:
tests/dppd/transpose_impl.m:
tests/hard_coded/copy_pred.m:
tests/hard_coded/ho_func_default_inst.m:
tests/recompilation/unchanged_pred_nr_2.m.1:
tests/recompilation/unchanged_pred_nr_2.m.2:
tests/valid/det_switch.m:
tests/valid/inlining_bug.m:
Delete determinism declarations from predicate and function declarations
that have no argument mode information, since the BAD_DETISM check
now makes these errors.
tests/valid/two_pragma_c_codes.m:
Move some mode declarations to the right section, since the
BAD_MODE_SECTION check now generates an error for the old code.
tests/invalid/typeclass_bad_method_mode.{m,err_exp}:
New test case to test for the BAD_PREDMODE check.
tests/invalid/mode_decl_in_wrong_section.{m,err_exp}:
New test case to test for the BAD_MODE_SECTION check.
tests/invalid/bad_detism.err_exp:
Add an expected output for this old, but never enabled test case,
which tests for new check BAD_DETISM.
tests/invalid/Mmakefile:
Enable the new test cases.
tests/invalid/typeclass_dup_method_mode.m:
This test case used to have two bugs. One is now by itself in the new
typeclass_bad_method_mode.m test case, so modify it to contain only
the other (indistinguishable modes).
tests/invalid/func_errors.err_exp:
tests/invalid/tc_err1.err_exp:
tests/invalid/undef_lambda_mode.err_exp:
tests/invalid/undef_type_mode_qual.err_exp:
Expect an extra error message from the BAD_DETISM check.
|
||
|
|
5649f36c80 |
Handle "use_module in interface, import_module in implementation".
If a module m1 imports module m2 using a use_module declaration in its
interface section but also imports it using an import_module declaration
in its implementation section, then references to entities defined in m2
in the interface of m1 must be module qualified, but similar references
in the implementation of m1 need NOT be module qualified.
The Mercury compiler has long had a bug that allowed entities imported
in the implementation of module m1 to be used in the interface of m1,
against the rules of the language. When I fixed that bug on 2015 nov 11,
the compiler became unable to properly process the situation described
in the paragraph above, because it still had another bug, which was that
it had a single setting for module qualification requirements: either it
was required *everywhere* in m1, or it was required *nowhere* in m1.
This diff fixes that bug (mantis bug 401) by allowing different requirements
in this respect in the interface of m1 versus its implementation.
It also changes the de-facto meaning of what exactly a use_module declaration
requires. The reference manual says only:
Uses of entities imported using @code{use_module} declarations
@emph{must} be explicitly module qualified.
This WAS unambiguous when it was written in june 1997, a few months before
submodules were added to the language. With a flat module system, there were
no nested module names, so either the module name was present, or it wasn't.
In the presence of nested modules, though, it IS ambiguous: HOW MUCH of
the module name must be present? The reference manual is silent on this.
At the moment, in the presence of a use_module for module ma.mb.mc,
a predicate p1 in ma.mb.mc may of course be referred to as ma.mb.mc.p1,
but may also be referred to as mb.mc.p1, or even just mc.p1. The specification
of mc is always required, but exactly WHICH of the previous module name
components are required depends on whether e.g. ma or ma.mb were themselves
imported via use_module or import_module declarations. The code implementing
the check (find_matches_in_permissions_map in module_qual.id_set.m) is itself
not too clear.
This diff changes the rules so that all references to anything imported
via a use_module declarations have to be fully qualified. This is stricter
than the existing rule, but it is MUCH simpler, and it better matches
the original intent of use_module declarations, which is the avoidance
of ALL POSSIBILITY of ambiguity.
NEWS:
doc/reference_manual.texi:
Document this change to the language.
compiler/prog_item.m:
Change the representation of sections in .int* files. Previously,
we recorded whether the interface file that the section was from
was read for an `import_module' or a `use_module' declaration.
We now allow the recording of the fact that it had both declarations,
a use_module in the interface and an import_module in the implementation.
compiler/modules.m:
Treat modules that have both a `use_module' declaration in interface
and an `import_module' declaration in the implementation as being of this
new internal section kind.
Add some infrastructure for debugging similar problems in the future.
compiler/module_qual.id_set.m:
Change the permissions system. Instead of recording *independently*
whether (a) an entity may be used in the interface and (b) whether
references to it must be qualified, record *separately* whether
(a) it may be used in the interface, and if so with what qualification
requirements, and (b) what its qualification requirements are in the
implementation. Unlike the old permission setup, the new one allows us
to express the "use_module in interface, import_module in implementation"
situation.
Implement the change to the language, by requiring full module
qualification of entities imported via use_module declarations.
This allows us to use a single parameterized piece of code to handle
both unqualified and qualified references, whereas before we used
separate pieces of code for them.
Change the way we handle errors in module qualification. Instead of
looking only for precise matches only, and looking for the possible causes
of errors only if we find either no matches or two or more matches, we now
return the near-miss matches as well, the ones that we need to decide
on what error message we want to generate. While this is slightly slower,
it is *much* simpler, since it allows us to avoid duplicating the search
code: once for precise matches only, once for no-match errors, and once
for multiple-match errors.
compiler/module_qual.collect_mq_info.m:
Set permissions for symbol access according to the new permissions system.
Code that previously triggered the bug will use the new interface file
section kind, and can now have its permissions record correctly.
compiler/module_qual.qual_errors.m:
Use a single predicate to generate error messages for all situations
in which there is not a single precise match for a module qualification.
This allows us to diagnose multiple potential problems with a single
lookup.
Change the wording of an existing error message to avoid a possibly-untrue
implication.
compiler/hlds_data.m:
Rename a field of the type_defn type to better document its meaning.
compiler/make_hlds.m:
Document the meaning of the need_qualifier field in sec_infos.
compiler/add_type.m:
compiler/make_hlds_separate_items.m:
compiler/module_qual.m:
compiler/pred_table.m:
compiler/parse_tree_out.m:
compiler/prog_item_stats.m:
Conform to the above changes.
mdbcomp/sym_name.m:
Add a utility predicate for use in looking for near-miss matches
in module qualification.
Make the documentation of a related predicate more precise.
tests/invalid/bad_instance.m:
tests/submodules/class.m:
tests/submodules/nested.m:
tests/submodules/nested3.m:
tests/submodules/parent.m:
Make names fully module qualified where the language rules now require it.
tests/submodules/deeply_nested.m:
Comment out a part of the test that tested the partially qualified names,
since these are now not allowed.
tests/invalid/errors.err_exp:
Expect a now-improved error message.
tests/invalid/test_nested.err_exp:
tests/invalid/transitive_import.err_exp:
tests/invalid/undef_type.err_exp:
Expect a now less-likely-to-mislead error message.
tests/valid_seq/int_impl_imports.m:
tests/valid_seq/int_impl_imports_2.m:
The test case for mantis bug 401.
tests/valid_seq/Mmakefile:
Enable the new test case.
|
||
|
|
1b17ed4d6c |
Fix a problem on OS X when building using --use-mmc-make.
The install names for Mercury shared libraries in the system were not being set
when building using --use-mmc-make. The existing code in the Mmakefiles that
does this only works for mmake, not mmc --make.
browser/Mmakefile:
library/Mmakefile:
mdbcomp/Mmakefile:
ssdb/Mmakefile:
When using --use-mmc-make set up the options to set the dylib install
names in such a way that mmc --make can see them.
Don't hardcode the library names in the definitions that set the
library install names.
|
||
|
|
30643165a6 | Delete unused predicates. | ||
|
|
e67c8bf9fb |
Fix minor issues in mdbcomp.
mdbcomp/slice_and_dice.m:
Expand tabs.
mdbcomp/mdbcomp.goal_path.m:
Fix spelling.
mdbcomp/trace_counts.m:
Consistently use "I/O" instead of "IO" in error messages.
|
||
|
|
5dd80b230d |
Delete or deprecate obsolete builtin insts, modes and predicates.
Update the list of changes in the NEWS file that potentially break backwards
compatibility.
library/builtin.m:
Delete the builtin inst synonyms 'old' and 'new'.
Delete the builtin builtin modes 'oo' and 'no'.
Add a comment stating that the modes input/0 and output/0 are deprecated.
Add obsolete pragmas for promise_only_solution/1 and
promise_only_solution_io/4.
Shift the description of the 'any' inst into the comment describing
the other builtin insts. Add the higher-order 'any' insts to this
comment.
Fix a typo in the description of the builtin higher-order insts: the
determinism is not required to be det.
browser/term_rep.m:
Replace calls to promise_only_solutions/1 with promise_equivalent_solutions
goals.
mdbcomp/trace_counts.m:
Replace a call to promise_only_solution_io/4 with a
promise_equivalent_solutions goal.
Add an XXX comment about hardcoding executable names.
NEWS:
Announce the deletion of 'old', 'new', '
List the addition of the 'for' operator as a change that may break
backwards compatibility.
Announce that the compiler no longer allows builtin types, insts and
modes to be redefined.
|
||
|
|
c6ab550db8 |
Remove the code for automatic initialization of solver vars.
We haven't supported it in years, and keeping it in the compiler
is just a maintenance burden and a performance problem.
mdbcomp/prim_data.m:
Delete the spec_pred_init functor, since we don't support special
"init" predicates anymore.
compiler/prog_data.m:
Delete the slot in solver type details that record the name of the
auto-initialization predicate.
compiler/prog_io_type_defn.m:
Don't allow a type definition to specify an auto-initialization predicate.
compiler/options.m:
compiler/globals.m:
Delete the option that allowed support for auto-initialization to be
turned back on.
compiler/inst_match.m:
compiler/inst_util.m:
Delete comments about auto-initialization.
compiler/mode_info.m:
Delete the record of whether we have variables that can be
auto-initialized (we never do anymore) and the flag that controls whether
auto-initialization is permitted or not.
compiler/modecheck_conj.m:
Simplify the code that modechecks conjunctions, since it no longer
has to figure out where to insert auto-initializations of solver vars.
compiler/modecheck_goal.m:
Delete the code that ensured that if one branch of a branched
control structure auto-initialized a solver variable, then they
all did.
compiler/modecheck_unify.m:
Don't auto-initializate variables before unifications.
compiler/modecheck_util.m:
Delete the code that auto-initialized solver variables at the ends
of procedure bodies if this needed to be done and wasn't done before.
compiler/add_special_pred.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/get_dependencies.m:
compiler/hlds_module.m:
compiler/hlds_pred.m:
compiler/modecheck_call.m:
compiler/modes.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
compiler/post_term_analysis.m:
compiler/smm_common.m:
compiler/special_pred.m:
compiler/term_constr_errors.m:
compiler/term_constr_initial.m:
compiler/term_util.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/type_util.m:
compiler/unify_proc.m:
Delete code that handled stuff related to auto-initialization,
and now always take the path that would normally be taken in the
absence of auto-initialization.
deep_profiler/read_profile.m:
runtime/mercury_layout_util.c:
runtime/mercury_stack_trace.c:
util/mdemangle.c:
Remove code that recognized the compiler-generated name of initialization
predicates.
tests/debugger/solver_test.m:
tests/hard_coded/solver_construction_init_test.m:
tests/hard_coded/solver_disj_inits.m:
tests/hard_coded/solver_ite_inits.m:
tests/invalid/missing_init_pred.m:
tests/invalid/zinc2mer_lib.m:
tests/valid/fz_conf.m:
tests/valid/solver_type_bug_2.m:
tests/valid/solver_type_mutable_bug.m:
These tests tested the handling of auto-initialization, which we
no longer support. Keep them around (and a bit more visible than
inside the git repo) in case we need them again, but add a comment
to each saying that the test is disabled.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/Mmakefile:
Disable those tests.
tests/warnings/non_term_user_special.{m,exp}:
Part of this test tested the handling of auto-initialization;
delete that part.
tests/warnings/Mercury.options:
Delete the flag required by the deleted part, since we don't support it
anymore.
|
||
|
|
94535ec121 |
Fix spelling and formatting throughout the system.
configure.ac: browser/*.m: compiler/*.m: deep_profiler/*.m: library/*.m: ssdb/*.m: runtime/mercury_conf.h.in: runtime/*.[ch]: scripts/Mmake.vars.in: trace/*.[ch]: util/*.c: Fix spelling and doubled-up words. Delete trailing whitespace. Convert tabs into spaces (where appropriate). |
||
|
|
6650ffad55 | Convert (C->T;E) to (if C then T else E). | ||
|
|
cc9912faa8 |
Don't import anything in packages.
Packages are modules whose only job is to serve as a container for submodules. Modules like top_level.m, hlds.m, parse_tree.m and ll_backend.m are packages in this (informal) sense. Besides the include_module declarations for their submodules, most of the packages in the compiler used to import some modules, mostly other packages whose component modules their submodules may need. For example, ll_backend.m used to import parse_tree.m. This meant that modules in the ll_backend package did not have to import parse_tree.m before importing modules in the parse_tree package. However, this had a price. When we add a new module to the parse_tree package, parse_tree.int would change, and this would require the recompilation of ALL the modules in the ll_backend package, even the ones that did NOT import ANY of the modules in the parse_tree package. This happened even at one remove. Pretty much all modules in every one of the backend have to import one or more modules in the hlds package, and they therefore have import hlds.m. Since hlds.m imported transform_hlds.m, any addition of a new middle pass to the transform_hlds package required the recompilation of all backend modules, even in the usual case of the two having nothing to do with each other. This diff removes all import_module declarations from the packages, and replaces them with import_module declarations in the modules that need them. This includes only a SUBSET of their child modules and of the non-child modules that import them. |
||
|
|
2f6d49a1fc | Delete more stuff needed only for the IL backend. | ||
|
|
3dd02876a5 |
Delete the MLDS->IL backend.
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_managed.m:
compiler/il_peephole.m:
compiler/ilasm.m:
compiler/ilds.m:
Delete the modules making up the MLDS->IL code generator.
compiler/globals.m:
compiler/prog_data.m:
Delete IL as a target and foreign language.
compiler/prog_io_pragma.m:
Delete the max_stack_size/1 foreign proc attribute. This was only
ever required by the IL backend.
compiler/options.m
Delete options used for the IL backend.
compiler/write_deps_file.m:
Don't generate mmake targets for .il files etc.
compiler/*.m:
Conform to the above changes.
compiler/notes/compiler_design.html
compiler/notes/work_in_progress.html
Conform to the above changes.
library/*.m:
Delete IL foreign_proc and foreign_export pragmas.
README.DotNet:
Delete this file.
browser/Mmakefile:
compiler/Mmakefile:
deep_profiler/Mmakefile:
mdbcomp/Mmakefile:
mfilterjavac/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
slice/Mmakefile:
Conform the above changes.
configure.ac:
Don't check that IL is a supported foreign language when performing the
up-to-date check.
Delete the '--enable-dotnet-grades' option.
scripts/Mmake.vars.in:
Delete variables used for the IL backend (and in on case by the Aditi
backend).
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
scripts/Mmake.rules:
scripts/canonical_grade.sh-subr:
tools/bootcheck:
Delete stuff related to the 'il' and 'ilc' grades.
doc/reference_manual.texi:
Delete the documentation of the 'max_stack_size' option.
doc/user_guide.texi:
Delete stuff related to the IL backend.
tests/hard_coded/csharp_test.{m,exp}:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/valid/csharp_hello.m:
Delete these tests: they are no longer relevant.
tests/hard_coded/equality_pred_which_requires_boxing.m:
tests/hard_coded/foreign_import_module.m:
tests/hard_coded/foreign_import_module_2.m:
tests/hard_coded/foreign_type.m:
tests/hard_coded/foreign_type2.m:
tests/hard_coded/foreign_type3.m:
tests/hard_coded/intermod_foreign_type2.m:
tests/hard_coded/lp.m:
tests/hard_coded/user_compare.m:
tests/invalid/foreign_type_2.m:
tests/invalid/foreign_type_missing.{m,err_exp}:
tests/invalid/foreign_type_visibility.m:
tests/invalid/illtyped_compare.{m,err_exp}:
tests/submodules/external_unification_pred.m
tests/valid/big_foreign_type.m
tests/valid/solver_type_bug.m
tests/valid_seq/foreign_type_spec.m
tests/valid_seq/intermod_impure2.m
Delete IL foreign_procs where necessary.
tests/hard_coded/Mmakefile
tests/invalid/Mercury.options
tests/invalid/Mmakefile
tests/submodules/Mmakefile
tests/valid/Mercury.options
tests/valid/Mmake.valid.common
tests/valid/Mmakefile
tests/valid_seq/Mmakefile
tests/valid_seq/Mercury.options
Conform to the above changes.
|
||
|
|
04daa04751 | Delete some unused imports. | ||
|
|
62ec97d443 |
Report imports shadowed by other imports.
If a module has two or more import_module or use_module declarations
for the same module, (typically, but not always, one being in its interface
and one in its implementation), generate an informational message about
each redundant declaration if --warn-unused-imports is enabled.
compiler/hlds_module.m:
We used to record the set of imported/used modules, and the set of
modules imported/used in the interface of the current module. However,
these sets
- did not record the distinction between imports and uses;
- did not allow distinction between single and multiple imports/uses;
- did not record the locations of the imports/uses.
The first distinction was needed only by module_qual.m, which *did*
pay attention to it; the other two were not needed at all.
To generate messages for imports/uses shadowing other imports/uses,
we need all three, so change the data structure storing such information
for *direct* imports to one that records all three of the above kinds
of information. (For imports made by read-in interface and optimization
files, the old set of modules approach is fine, and this diff leaves
the set of thus *indirectly* imported module names alone.)
compiler/unused_imports.m:
Use the extra information now available to generate a
severity_informational message about any import or use that is made
redundant by an earlier, more general import or use.
Fix two bugs in the code that generated warnings for just plain unused
modules.
(1) It did not consider that a use of the builtin type char justified
an import of char.m, but without that import, the type is not visible.
(2) It scanned cons_ids in goals in procedure bodies, but did not scan
cons_ids that have been put into the const_struct_db. (I did not update
the code here when I added the const_struct_db.)
Also, add a (hopefully temporary) workaround for a bug in
make_hlds_passes.m, which is noted below.
However, there are at least three problems that prevent us from enabling
--warn-unused-imports by default.
(1) In some places, the import of a module is used only by clauses for
a predicate that also has foreign procs. When compiled in a grade that
selects one of those foreign_procs as the implementation of the predicate,
the clauses are discarded *without* being added to the HLDS at all.
This leads unused_imports.m to generate an uncalled-for warning in such
cases. To fix this, we would need to preserve the Mercury clauses for
*all* predicates, even those with foreign procs, and do all the semantic
checks on them before throwing them away. (I tried to do this once, and
failed, but the task should be easier after the item list change.)
(2) We have two pieces of code to generate import warnings. The one in
unused_imports.m operates on the HLDS after type and mode checking,
while module_qual.m operates on the parse tree before the creation of
the HLDS. The former is more powerful, since it knows e.g. what types and
modes are used in the bodies of predicates, and hence can generate warnings
about an import being unused *anywhere* in a module, as opposed to just
unused in its interface.
If --warn-unused-imports is enabled, we will get two separate set of
reports about an interface import being unused in the interface,
*unless* we get a type or mode error, in which case unused_imports.m
won't be invoked. But in case we do get such errors, we don't want to
throw away the warnings from module_qual.m. We could store them and
throw them away only after we know we won't need them, or just get
the two modules to generate identical error_specs for each warning,
so that the sort_and_remove_dups of the error specs will do the
throwing away for us for free, if we get that far.
(3) The valid/bug100.m test case was added as a regression test for a bug
that was fixed in module_qual.m. However the bug is still present in
unused_imports.m.
compiler/make_hlds_passes.m:
Give hlds_module.m the extra information it now needs for each item_avail.
Add an XXX for a bug that cannot be fixed right now: the setting of
the status of abstract instances to abstract_imported. (The "abstract"
part is correct; the "imported" part may not be.)
compiler/intermod.m:
compiler/try_expand.m:
compiler/xml_documentation.m:
Conform to the change in hlds_module.m.
compiler/module_qual.m:
Update the documentation of the relationship of this module
with unused_imports.m.
compiler/hlds_data.m:
Document a problem with the status of instance definitions.
compiler/hlds_out_module.m:
Update the code that prints out the module_info to conform to the change
to hlds_module.m.
Print status information about instances, which was needed to diagnose
one of the bugs in unused_imports.m. Format the output for instances
nicer.
compiler/prog_item.m:
Add a convenience predicate.
compiler/prog_data.m:
Remove a type synonym that makes things harder to understand, not easier.
compiler/modules.m:
Delete an XXX that asks for the feature this diff implements.
Add another XXX about how that feature could be improved.
compiler/Mercury.options.m:
Add some more modules to the list of modules on which the compiler
should be invoked with --no-warn-unused-imports.
compiler/*.m:
library/*.m:
mdbcomp/*.m:
browser/*.m:
deep_profiler/*.m:
mfilterjavac/*.m:
Delete unneeded imports. Many of these shadow other imports, and some
are just plain unneeded, as shown by --warn-unused-imports. In a few
modules, there were a *lot* of unneeded imports, but most had just
one or two.
In a few cases, removing an import from a module, because it *itself*
does not need it, required adding that same import to those of its
submodules which *do* need it.
In a few cases, conform to other changes above.
tests/invalid/Mercury.options:
Test the generation of messages about import shadowing on the existing
import_in_parent.m test case (although it was also tested very thoroughly
when giving me the information needed for the deletion of all the
unneeded imports above).
tests/*/*.{m,*exp}:
Delete unneeded imports, and update any expected error messages
to expect the now-smaller line numbers.
|
||
|
|
ef44f50bee |
Eliminate the old module_defn item.
After my earlier changes to the item list, we used module_defns for only
two things: recording when one module includes another, and recording
when one module imports or uses another. After this diff, both those
pieces of information are stored separately in each item block.
This has two benefits.
The first benefit is that it allows us to use the type system to enforce
structural invariants about where include_module, import_module and use_module
declarations may appear. The one invariant that we now enforce is that
optimization files may not contain either include_module or import_module
declarations, though they may contain use_module declarations. I suspect that
there are also similar invariants about interface files, but finding them
requires something like this change.
The second benefit is that it allows traversals of item blocks to scan
only the part of the item block that may contain the object of interest.
While reading in interface and optimization files, we used to scan the
full item list several times to find included and imported modules; those
scans can now look at just the relevant information. Since the item lists
that need to be processed usually include all the declarations in a
substantial number of other modules, including some (such as list.m) that
have LOTS of declarations, the speedup can be substantial. On tools/speedtest,
the speedup is 1.5%.
compiler/prog_item.m:
Make the change described above.
Provide utility predicates on the new types representing include_module,
import_module and use_module declarations.
Move an old utility predicate from here to prog_io.m, since only prog_io.m
uses it.
compiler/module_imports.m:
Several fields of the module_imports type contained sets of module names,
but stored them as lists. Change these to actual sets, to distinguish them
from the lists whose order is actually important. (Basically, the order
of processing .trans_opt files is important, but the order in which
we read in .int0, .int3, .int2, .int and .opt files isn't.) In several
places, this also avoids the need for conversions of lists to sets
for set operations, and then back to lists.
compiler/modules.m:
This module had several predicates that processed list of module names.
Make these operate on sets of module names instead, and break each of them
into two predicates: one that decides whether there is a next module name,
and if yes whether it has been processed already, and one to do the actual
processing if needed. This avoid the need for excessive indentation.
The code that discovers what other modules' interface files may need
to be read is now simpler due to the updated item_block structure.
Remove the submodule whose job it was to discover what modules are included
in items or item blocks, since that task has now become trivial, and is
now done by a utility predicate in prog_item.m. Since this was the second
last submodule (of the original eight), the last submodule is now the
whole module. Therefore this module now has significantly greater cohesion
than it had before.
compiler/write_module_interface_files.m:
compiler/prog_io_item.m:
Parse include_module, import_module and use_module declarations as
markers, not as items.
compiler/prog_io.m:
Expect include_module, import_module and use_module declarations as
markers, not as items.
compiler/split_parse_tree_src.m:
Discover included submodules more simply with the updated item_block
structure.
compiler/compile_target_code.m:
Put the arguments of the predicates in this module in a more standard
order.
compiler/recompilation.version.m:
Conform to the above changes. Note a possible bug.
Use a bespoke type to replace some bools.
compiler/check_raw_comp_unit.m:
compiler/comp_unit_interface.m:
compiler/deps_map.m:
compiler/equiv_type.m:
compiler/generate_dep_d_files.m:
compiler/get_dependencies.m:
compiler/hlds_module.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/mercury_compile_llds_back_end.m:
compiler/mercury_to_mercury.m:
compiler/module_deps_graph.m:
compiler/module_qual.m:
compiler/prog_io_find.m:
compiler/read_modules.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/trans_opt.m:
compiler/write_deps_file.m:
Conform to the above changes.
mdbcomp/sym_name.m:
Provide a utility predicate to get the set of ancestors of a module
as a set as well as a list.
tests/invalid/exported_unify3.err_exp:
tests/invalid/ii_parent.ii_child.err_exp:
Update the expected error messages, which refer to line numbers in
.int0 files, which have now changed, as we now put all import_module
declarations before ordinary items.
(Error messages shouldn't refer to automatically generated files,
but that is a separate concern.)
|
||
|
|
f2043fc9bd |
Replace the item list with more structured ASTs.
The parts of the compiler that run before the HLDS is constructed used to use
a raw list of items to represent source files (.m), interface files (.int0,
.int3, .int2 and .int) and optimization files (.opt, and .trans_opt).
These lists had structure, but this structure was implicit, not explicit,
and its invariants were never really documented.
This diff changes that. It replaces the item list with FIVE separate types.
Three of these each represent the unprocessed content of one file:
- parse_tree_int represents the contents of one interface file;
- parse_tree_opt represents the contents of one optimization file;
- parse_tree_src represents the contents of one source file.
Two of these each represent the processed contents of one or more files:
- raw_compilation_unit represents the contents of one module in a source file.
(The source file may contain several nested modules; the compilation unit
represents just one.)
- aug_compilation_unit represents the contents of one module in a source file,
just like raw_compilation_unit, but it is augmented with the contents of the
interface and optimization files of the other modules imported (directly or
indirectly) by the original module.
These five separate concepts all used to be represented by the same type,
list(item), but different invariants applied to the structure of those lists.
The most important of those invariants at least are now explicit in the types.
I think it is entirely possible that there are other invariants I haven't
discovered and documented (for example, .int3 files must have stricter
invariants on what can appear in them than .int files), but discovering
and documenting these should be MUCH easier after this change.
I have marked many further opportunities for improvements with "XXX ITEM_LIST".
Some of these include moving code between modules, and the creation of new
modules. However, I have left acting on those XXXs until later, in order to
keep the size of this diff down as much as possible, for easier reviewing.
compiler/prog_item.m:
Define the five new AST types described above, and utility predicates
that operate on them.
In the rest of this change, I tried, as much as possible, to change
predicates that used to take item lists as arguments to make them change
one of these types instead. In many cases, this required putting
the argument lists of those predicates into a more consistent order.
(Often, predicates that operated on the contents of the module
took the name of the module and the list of items in the module
not just as separate arguments, but as separate arguments that
weren't even next to each other.)
Define types that identify the different kinds of interface and
optimization files (.int, .int2 etc). These replace the string suffixes
we used to use to identify file types. Predicates that used to take strings
representing suffixes as arguments now have to specify whether they can
handle all these file types (source, interface and optimization),
or just (e.g.) all interface file types.
We used to have items corresponding to `:- module' and `:- end_module'.
Delete these; this information is now implicit in the structure of the
relevant AST. The parser handles the corresponding terms as markers,
not items; these markers are live only during parsing.
We used to have module_defns corresponding to `:- interface' and
`:- implementation'. Delete these; this information is now also implicit
in the structure of the relevant AST. Delete also, for the same reason,
the module_defns used to mark the starts of sublists in the overall lists
of items whose items came from the interface files or optimization files
of other modules. The former are now markers during parsing. The latter
are never parsed, but are created directly, after parsing has been done.
Delete the pragma type for `:- pragma source_file'. This is never
needed later; it is now a marker during parsing.
Change the internal representation of `:- import' and `:- use'.
It used to store a list of module names, but that list was an actual list
only during parsing; after that, it always had exactly one element.
It now stores one module name, and the parser has a mechanism to convert
one read-in term to more than one item, for use with terms such as
`:- import_module a, b'.
Delete the internal representation of `:- export', which was never
implemented, since if it IS ever implemented, it will almost certainly
be in a different form, which will need different support.
Document some further opportunities for simplification, later.
(This diff is already more than big enough.)
compiler/prog_io_item.m:
Rewrite the top-level part of this module. Instead of returning an item
for every parsed term, distinguish between parsing items that end up
in item lists inside ASTs, and parsing markers that end up creating
the STRUCTURE of those ASTs.
compiler/prog_io.m:
Rewrite the meat of this module. Instead of reading in a simple item list,
we now have to read in three different parse trees with three different
grammars, each of which is more complex than a simple list.
compiler/read_modules.m:
We used to have a map that mapped file names to the contents of those
files. We now need three separate maps, for interface files, optimization
files and source files, due to their separate types.
(We don't actually use the map for optimization files, which seems
to be a potential performance bug. The root cause of that problem
us that while intermod.m and the grab_*modules part of modules.m do
similar jobs, they don't use the same mechanisms.)
Replace the read_module predicate with the predicates read_module_src
and read_module_int, since these now return different types.
To avoid having to create AST-type-specialized variants of
read_module_ignore_errors and read_module_if_changed, give each of
read_module_{src,int} arguments that optionally tell them to ignore errors
and/or to read the module only if changed (though the "and" part of
"and/or" should not be needed.) These options already existed, but
they weren't exported.
compiler/timestamp.m:
Define the type we use for this option in read_modules.
compiler/status.m:
New module, containing mostly
- stuff carved out of hlds_pred.m, which defines the import_status type,
and the predicates that operate on it;
- stuff carved out of make_hlds_passes.m, which defines the item_status
type and the predicates that operate on that; and
- stuff carved out prog_data.m, which defines the section (now
module_section) and import_locn types.
It also contains the new section kinds we now use to represent item blocks
that were imported from interface and optimization files.
compiler/parse_tree.m:
compiler/notes/compiler_design.html:
Add status.m to the parse_tree package.
compiler/hlds_pred.m:
compiler/prog_data.m:
Remove the stuff now in status.m.
compiler/error_util.m:
Provide a mechanism to control the order of messages with respect to
ALL other messages, not just those that also specify ordering.
compiler/mercury_to_mercury.m:
Provide predicates for printing out parse_tree_* and *_compilation_unit,
since printing out a simple item list is no longer enough for debugging.
Pretty-print type definitions nicely.
Replace a boolean with a purpose-specific enum.
compiler/modules.m:
Rewrite virtually all this module to make it work on the new AST
representations. Generate more detailed error messages for duplicate
module inclusions. Note lots of possibilities for further improvements,
including in the documentation. Mark places I am still not sure about,
especially places where I am not sure *why* the code is doing
what it is doing.
compiler/module_imports.m:
This module stores the data structure in which we accumulate the stuff
imported into a compilation unit, i.e. it is in these data structures
that a raw_compilation_unit becomes an aug_compilation_unit. Modify
the data structure and the predicates that operate on it to work on the
new AST representations, not on an (apparently) simple list of items.
Avoid ambiguities by adding a prefix to field names.
Add some convenience predicates.
compiler/module_qual.m:
Perform module qualification on both raw lists of items (for use when
generating .int3 files) but also on item blocks (for use pretty much
in every other situation).
Generate warnings about module imports that are unnecessarily in the
module interface using the module's context (the context of the `:- module'
declaration), not line 1 of the relevant file.
compiler/prog_io_error.m:
Split some error categories more finely, since some error kinds here
actually used to be reported for more than one distinct situation.
compiler/prog_io_util.m:
Provide utility predicates that operate on nonempty lists.
compiler/recompilation.version.m:
Make the comparison of the old and new contents of the interface file
work on two parse_tree_ints, not on two raw sequences of items.
Delete a boolean option that was always `yes', never 'no'.
compiler/recompilation.m:
Turn some functions into predicates to allow the use of state variable
notation.
Avoid ambiguities by adding a prefix to field names.
compiler/write_module_interface_files.m:
Besides updating the code in this module to work on the new parse tree
representations, also use cords instead of reversed lists in several cases.
Note many possibilities for further improvements.
library/list.m:
Move the type one_or_more here from the compiler directory, since
we now use it in more than one compiler module, and this is its natural
home.
mdbcomp/sym_name.m:
Rename "match_sym_name" to "partial_sym_name_matches_full", since this
better describes its job.
Add a det version of sym_name_get_module_name.
compiler/equiv_type.m:
Rename some types to make them more expressive.
compiler/accumulator.m:
compiler/add_class.m:
compiler/add_foreign_enum.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_pragma.m:
compiler/add_pragma_tabling.m:
compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_special_pred.m:
compiler/add_type.m:
compiler/assertion.m:
compiler/base_typeclass_info.m:
compiler/check_typeclass.m:
compiler/ctgc.util.m:
compiler/dead_proc_elim.m:
compiler/dep_par_conj.m:
compiler/dependency_graph.m:
compiler/deps_map.m:
compiler/det_report.m:
compiler/elds_to_erlang.m:
compiler/equiv_type_hlds.m:
compiler/erl_code_gen.m:
compiler/export.m:
compiler/format_call.m:
compiler/higher_order.m:
compiler/hlds_data.m:
compiler/hlds_module.m:
compiler/hlds_out_pred.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/item_util.m:
compiler/lambda.m:
compiler/lco.m:
compiler/make.module_dep_file.m:
compiler/make_hlds.m:
compiler/make_hlds_error.m:
compiler/make_hlds_passes.m:
compiler/make_tags.m:
compiler/mercury_compile.m:
compiler/ml_proc_gen.m:
compiler/ml_type_gen.m:
compiler/mode_errors.m:
compiler/oisu_check.m:
compiler/par_loop_control.m:
compiler/polymorphism.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/pred_table.m:
compiler/prog_io_dcg.m:
compiler/prog_io_find.m:
compiler/prog_io_pragma.m:
compiler/prog_io_sym_name.m:
compiler/prog_io_type_defn.m:
compiler/prog_io_typeclass.m:
compiler/prop_mode_constraints.m:
compiler/push_goals_together.m:
compiler/qual_info.m:
compiler/recompilation.check.m:
compiler/recompilation.usage.m:
compiler/simplify_proc.m:
compiler/smm_common.m:
compiler/special_pred.m:
compiler/ssdebug.m:
compiler/stm_expand.m:
compiler/structure_reuse.analysis.m:
compiler/structure_reuse.direct.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.versions.m:
compiler/structure_sharing.analysis.m:
compiler/structure_sharing.domain.m:
compiler/table_gen.m:
compiler/term_constr_initial.m:
compiler/term_constr_main.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/trans_opt.m:
compiler/type_class_info.m:
compiler/type_ctor_info.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/typecheck_info.m:
compiler/unify_proc.m:
compiler/untupling.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/write_deps_file.m:
compiler/xml_documentation.m:
Conform to the changes above.
tests/hard_coded/higher_order_func_test.m:
tests/hard_coded/higher_order_syntax.m:
Avoid a warning about importing a module in the interface, not the
implementation.
tests/invalid/after_end_module.err_exp:
tests/invalid/any_mode.err_exp:
tests/invalid/bad_end_module.err_exp:
tests/invalid/bigtest.err_exp:
tests/invalid/bug113.err_exp:
tests/invalid/duplicate_modes.err_exp:
tests/invalid/errors.err_exp:
tests/invalid/errors1.err_exp:
tests/invalid/errors2.err_exp:
tests/invalid/funcs_as_preds.err_exp:
tests/invalid/inst_list_dup.err_exp:
tests/invalid/invalid_main.err_exp:
tests/invalid/missing_interface_import2.err_exp:
tests/invalid/no_exports.err_exp:
tests/invalid/occurs.err_exp:
tests/invalid/predmode.err_exp:
tests/invalid/prog_io_erroneous.err_exp:
tests/invalid/type_inf_loop.err_exp:
tests/invalid/typeclass_missing_det_3.err_exp:
tests/invalid/typeclass_test_11.err_exp:
tests/invalid/types.err_exp:
tests/invalid/undef_inst.err_exp:
tests/invalid/undef_mode.err_exp:
tests/invalid/undef_type.err_exp:
tests/invalid/unicode1.err_exp:
tests/invalid/unicode2.err_exp:
tests/invalid/vars_in_wrong_places.err_exp:
tests/warnings/unused_import.exp:
tests/warnings/unused_interface_import.exp:
Update the expected outputs in the invalid and warnings directories
to account for one or more of the following five changes.
Error messages that warn about a module not exporting anything
used to always refer to line 1 of the module's source file.
Now expect these messages to refer to the actual context of the module,
which is the context of its `:- module' declaration.
Expect a similarly updated context for messages that warn about
unnecessarily importing modules in the interface, not in the
implementation.
Expect a similarly updated context for messages that warn about
importing a module via both `:- import_module' and `:- use_module'.
For the modules that follow the `:- module' declaration directly with code,
also expect an error message about the missing section marker.
For modules that have terms after the `:- end_module' declaration,
replace "end_module" with "`:- end_module'" in the error message.
tests/invalid/func_class.{m,err_exp}:
New test case. It is a copy of the old tests/valid/func_class.m, which
is missing more than one module marker. The expected output is what I think
we should generate. The test case currently fails, because we currently
print only a subset of the expected errors. I am pretty sure the reason
for that is that old code I have not modified simply throws away the
missing error messages. Fixing this is work for the near future.
tests/invalid/Mmakefile:
Enable the new test case.
tests/misc_tests/pretty_print_test.exp:
Expect the pretty-printed output to use four-space indentation,
per our current style guide, since the compiler now generates such output.
tests/misc_tests/pretty_print_test.m:
Clean up the source code of the test as well.
tests/valid/complicated_unify.m:
tests/valid/det_switch.m:
tests/valid/easy_nondet_test.m:
tests/valid/error.m:
tests/valid/func_class.m:
tests/valid/func_int_bug_main.m:
tests/valid/higher_order.m:
tests/valid/higher_order2.m:
tests/valid/implied_mode.m:
tests/valid/indexing.m:
tests/valid/multidet_test.m:
tests/valid/nasty_func_test.m:
tests/valid/semidet_disj.m:
tests/valid/stack_alloc.m:
tests/valid/switches.m:
Add missing section markers to these modules. They used to follow
the `:- module' declaration directly with code.
|
||
|
|
3f11ad2183 |
generate dummy table stats and reset preds for non-tabling backends.
This fixes Mantis bug #368. compiler/add_pragma_tabling.m: On backends that don't support tabling, generate the declarations for table statistics and reset predicates as usual if the tabling memo requests them, but make the definition a dummy definition. Dummy statistics predicates return statistics full of zeros, while dummy reset predicates do nothing. compiler/add_pragma_tabling.m: Pass the qual_info now needed by add_pragma_tabling.m. library/table_statistics.m: Add a predicate to return dummy statistics. Switch from error/1 to unexpected/3. mdbcomp/sym_name.m: Add a utility predicate for converting a sym_name to a term, since add_pragma_tabling.m now needs this. Make the order of predicate definitions match the order of predicate declarations. tests/valid/table_aux_preds_erlang.m: New test case to test for the presence of the bug. tests/valid/Mmakefile: Enable the new test case. |
||
|
|
58d29651c1 |
Warn about unknown format strings in the Mercury system.
*/*_FLAGS.in:
Specify that by default, the compiler should generate warnings
for unknown format strings and bad known format strings.
*/Mercury.options:
Override this default setting for a few modules that have legitimate
reasons for calling e.g. string.format with unknown format strings.
compiler/fact_table.m:
deep_profiler/html_format.m:
Minor changes to avoid calling string.format with unknown format strings.
|
||
|
|
aa60524d71 |
Eliminate redundant output from tools/bootcheck.
runtime/mercury_goto.h:
Cast the "const MR_LabelLayout *" argument of calls
MR_insert_internal_label, since without this cast, we get C compiler
warnings in the bootcheck output when the caller passes a
"const MR_LabelLayoutNoVarInfo *" for this argument.
tests/hard_coded/Mmakefile:
Redirect the output of the weak_ptr test to a file instead of including it
in the output of bootcheck itself. The output is maybe be needed in a rare
cases, but is not needed most of the time.
tests/hard_coded/weak_ptr.m:
Fix white space.
tests/feedback/Mmakefile:
Specify verbosity level 0 when invoking mdprof_create_feedback.
deep_profiling/mdprof_create_feedback.m:
Record the verbosity level when we postprocess the options. We used to
record it *after* creating the feedback file, and before printing the
messages gathered during this process. This *mostly* worked, but some
messages are printed using trace goals *during* the creation of the
feedback file, and these ignored the specified verbosity level.
deep_profiling/query.m:
Remove the IO arguments from exec and try_exec, since they do not use them.
deep_profiling/var_use_analysis.m:
Eliminate some ambiguities by renaming two predicates.
Simplify some overly complex code.
deep_profiling/autopar_costs.m:
deep_profiling/create_report.m:
deep_profiling/mdprof_cgi.m:
deep_profiling/mdprof_test.m:
Conform to the above changes.
mdbcomp/feedback.m:
Fix a typo.
|
||
|
|
d33273d033 |
Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.
*/Makefile:
*/Mmakefile:
As above.
tests/hard_coded/.gitignore:
Don't ignore the purity subdir. This ignore must have been left over
from when purity.m was a test in hard_coded, not hard_coded/purity,
and it ignored an executable, not a directory.
|