Commit Graph

24912 Commits

Author SHA1 Message Date
Julien Fischer
0515f96e4c Sync licenses with latest upstream revisions from the FSF.
Use the latest revisions of the GPL version 2 and LGPL version 2 text from the
FSF. This replaces out-of-date addresses and the assumption that the year
begins with 19.

COPYING:
COPYING.LIB:
    As above.
2026-01-13 17:15:06 +11:00
Julien Fischer
efdcd8e21a Convert another README to Markdown.
Documentation/README.x86.md:
   As above.

   Move the the bit about x86-64 not being affected by the issue
   described in this file from the bottom to the top.

Documentation/README.Linux.md:
   Add a pointer to the README.x86.md file.

README.md:
   Conform to the above change.
2026-01-13 16:45:12 +11:00
Julien Fischer
ae47f9df28 Make some examples copyable.
Documentation/README.CSharp.md:
    As above.
2026-01-13 16:29:55 +11:00
Julien Fischer
4ffe3475c9 Convert another README to Markdown.
Documentation/README.Linux-m68k.md:
    As above.

    Mention that this port has not been tested (to the best of my knowledge)
    since 1998.

Documentation/README.Linux.md:
    Add a link to the Linux/m68k README.

README.md:
    Update a link.
2026-01-13 16:25:59 +11:00
Zoltan Somogyi
3f58eabe9f Delete the allow_multi_arm_switches internal option.
The compiler has had no code to set it from its default value of "yes"
to "no" since the Erlang backend was deleted in October 2020.

compiler/options.m:
    Delete the option.

compiler/handle_options.m:
    Delete an (incorrect) reference to the option.

compiler/switch_detection.m:
    Stop paying attention to the option.

tests/warnings/help_text.err_exp:
    Stop expecting documentation of the option.
2026-01-13 15:22:12 +11:00
Julien Fischer
fc40e05a00 Fix bitrot in a README.
Documentation/README.Linux.md:
    As above.
2026-01-13 15:18:13 +11:00
Julien Fischer
593c67c174 Convert another README to Markdown.
Documentation/README.Linux:
    As above.

README.md:
    Conform the above change.
2026-01-13 15:15:35 +11:00
Julien Fischer
ca719a38ea Fix quoting in a spot.
Documentation/README.Linux-PPC.md:
    As above.
2026-01-13 15:05:06 +11:00
Julien Fischer
b526e95db5 Adjust markup.
Documentation/README.Linux-PPC.md:
    As above.
2026-01-13 15:03:23 +11:00
Julien Fischer
ef589651f8 Convert another README to Markdown.
Documentation/README.Linux-PPC:
    Rename -> README.Linux-PPC.md:

    Convert this file to Markdown.

    Make the note at the head of this file a bit stronger.

    Delete a dead link.

README.md:
Documentation/README.Linux:
    Conform to the above change.
2026-01-13 15:01:22 +11:00
Julien Fischer
0035d6d23d Delete --with-msvcrt configure option.
The --with-msvcrt option was intended for selecting between the older Microsoft
C runtime (crtdll.dll) and the Microsoft Visual C runtime (msvcrt.dll). This is
all now ancient history, since the MSVCRT itself has been superseded by the
Universal C runtime since Windows 10. Delete the --with-msvcrt option and all
uses of it.

configure.ac:
    Delete the --with-msvcrt option.

scripts/mgnuc.in
scripts/ml.in:
    Delete uses of the above configuration value.

Documentation/README.MS-VisualC.md:
    Delete references to --with-msvcrt.
2026-01-13 14:10:09 +11:00
Julien Fischer
41328b42b2 Minor corrections.
compiler/hlds_goal.m:
    Fix spelling.

compiler/handle_options.m:
compiler/mercury_compile_front_end.m:
compiler/source_file_map.m:
compiler/unused_imports.m:
    Fix doubled-up words.
2026-01-12 23:36:24 +11:00
Peter Wang
9f84fec4f5 Fix bug with direct-arg ctors and intermodule optimisation.
If the compiler decides that a du type should use the direct-arg
representation for some of its constructors, it must include information
about that into the .opt file of the module defining the type, in the
form of `where direct_arg is' clauses, which will be used by modules
opt-importing that module and that type. That information was not being
included for du types defined in the *interface* section of a module.

Also fix a related issue that was uncovered: a word_aligned_pointer
assertion on a foreign_type definition would have no effect if there is
a no-tag du type definition for the same type constructor.

compiler/intermod.m:
compler/intermod_decide.m:
    Make should_opt_export_type_defn and some_type_needs_to_be_written
    succeed for `status_exported' du type definitions with direct-arg
    constructors. While `status_exported' suggests those type
    definitions would be redundant in .opt files, the information about
    the direct-arg constructors is not redundant.

compiler/du_type_layout.m:
    Add a is_word_aligned_ptr() value to the ComponentTypeMap if a
    no-tag du type also has a foreign_type definition for the current
    target language with a word_aligned_pointer assertion. Previously,
    this was only being done for single ctor NON no-tag du types.

    Add a XXX mentioning that we silently ignore word_aligned_pointer
    assertions in other cases.

tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/direct_arg_opt.m:
tests/hard_coded/direct_arg_opt_helper_1.m:
tests/hard_coded/direct_arg_opt_helper_1.direct_arg_opt_helper_2.m:
tests/hard_coded/direct_arg_opt.exp:
    Add a test case.
2026-01-12 11:33:56 +11:00
Zoltan Somogyi
81cafc5928 Improve code readability. 2026-01-11 10:12:47 +11:00
Zoltan Somogyi
b071f84f81 Assign goal_ids in the scout disjunctions pass ...
... reducing the number of procedure body traversals by one,
and avoiding the unneeded construction of the containing goal map.
2026-01-11 07:26:49 +11:00
Zoltan Somogyi
635b2268fe Improve handling of from_ground_term_deconstruct scopes.
compiler/hlds_goal.m:
    Document that all goals inside from_ground_term_deconstruct scopes
    are not just unifications, but unifications whose right hand sides
    are rhs_functors.

compiler/constraint.m:
    Fix a potential problem, which is that pushing a constraint into
    from_ground_term_{deconstruct,other) scopes can invalidate
    their invariants.

compiler/goal_refs.m:
    Fix a comment.

compiler/lco.m:
    Qualify a call.

compiler/modecheck_goal.m:
    Fix a misleading predicate name, and typos.

compiler/try_expand.m:
    Exploit the newly-documented invariant about from_ground_term_deconstruct
    scopes.
2026-01-11 03:57:52 +11:00
Zoltan Somogyi
77017dcbcb Put related predicates together. 2026-01-10 14:57:24 +11:00
Zoltan Somogyi
17f0230447 Carve three new modules out of switch_detection.m.
Simplify the interfaces between the new modules and switch_detection.m.

compiler/scout_disjunctions.m:
    New module containing the part of the old switch_detection.m
    that scouts disjunctions ahead of the main pass in bulk.

compiler/find_bind_var.m:
    New module containing the part of the old switch_detection.m
    that scouts disjunctions as *part* of the main pass, piecemeal.

compiler/switch_candidates.m:
    New module containing the part of the old switch_detection.m
    that recognizes candidate switches, and chooses the best switch
    if there is more than one candidate.

compiler/switch_detection.m:
    Delete the moved code. Conform to the interface simplifications.

compiler/check_hlds.m:
compiler/notes/compiler_design.html:
    Add and document the new modules.

compiler/cse_detection.m:
    Conform to the changes above.

compiler/hlds_out_goal.m:
    Add the capability to format a case as a string.
2026-01-10 10:40:43 +11:00
Julien Fischer
a52090b1e7 Fix broken link (properly this time).
NEWS.md:
    As above.
2026-01-09 20:46:17 +11:00
Julien Fischer
a680c9e560 Fix broken link.
NEWS.md:
    As above.
2026-01-09 20:45:13 +11:00
Zoltan Somogyi
950edaa6c9 Describe each cluster of related library modules. 2026-01-08 22:58:17 +11:00
Zoltan Somogyi
9ef5357c60 Improve readability. 2026-01-08 12:29:27 +11:00
Zoltan Somogyi
a0d5c3590f Fix two (or three) C# test case failures.
tests/invalid_nodepend/Mercury.options:
    Prevent two test cases, fundeps_vars and require_tailrec_invalid,
    from stopping after the creation of their .int files finds errors.
    Continue on to the code generation stage, where the errors that
    these test cases for are detected. (The fix is needed only for
    bootchecks that use mmc --make.)

tests/EXPECT_FAIL_TESTS.csharp:
    Recognize that hard_coded/functor_ho_inst_excp_1 is expected to fail
    in C# grades. This test case was already on the expected-to-fail list,
    but under its old name, functor_ho_inst_excp, which was not updated
    when the name was changed.
2026-01-08 09:57:54 +11:00
Zoltan Somogyi
a94ac41af2 Fix a comment. 2026-01-08 09:16:16 +11:00
Zoltan Somogyi
3c5f1a907b Put the contents of this file into meaningful order. 2026-01-08 06:10:14 +11:00
Zoltan Somogyi
928fd04f5a Update the style of this Mmakefile. 2026-01-08 03:59:52 +11:00
Zoltan Somogyi
94fadf1797 Add uint versions of array operations.
library/array.m:
    Add uint versions of most of this module's operations.

NEWS.md:
    Mention the new operations.

library/edit_distance.m:
    Use the new array operations to eliminate some casts.

library/edit_seq.m:
    Minor style fix.

tests/hard_coded/array_gen.{m,exp}:
tests/hard_coded/array_test_2.{m,exp}:
    Extend the tests of array.m's operations to the corresponding uint
    versions. Expect the output for the new versions.

tests/hard_coded/array_resize.m:
tests/hard_coded/array_shrink.m:
    Extend the tests of array.m's operations to the corresponding uint
    versions, but generate output only if their results differ from the
    original int versions. (They don't differ.)

tests/hard_coded/array_primitives.m:
    Style fixes.
2026-01-08 03:47:09 +11:00
Julien Fischer
f1cc066ab0 Remove workarounds for depend_ints on Windows.
The changes to file copying in the compiler in early 2024 mean that we no
longer encounter the same performance problems these workarounds were put
in place to avoid.

compiler/Mmakefile:
library/Mmakefile:
    As above.
2026-01-07 16:55:55 +11:00
Julien Fischer
0f2ee70edf Support wildcard argument expansion with MSVC.
In Unix expansion of wildcard arguments is done by the shell. On Windows,
this is not the case and programs are responsible for expanding wildcard
argument themselves. When using source file mapping, we typically used
wildcards to specify the source files to map. When native Windows Mercury
compilers are used in the Windows command prompt or PowerShell, this does
not work, which is inconvenient to say the least. (In environments like
Cygwin or MSYS2, the shell does do wildcard expansion.)

Microsoft's C runtime has an optional component that programs can
link against which will do wildcard expansion on the argument vector
before main is called. Set up builds with MSVC to link against this
component when building the Mercury compiler.

scripts/parse_ml_options.sh-subr.in:
scripts/ml.in:
    Add a new option --use-msvc-setargv-extension, which causes the the
    wsetargv.obj file that enables the extension to be passed the linker.
    (MSVC seems rather picky about where this is positioned. A a result
    we do it within the ml script where have we more control over the matter.)

compiler/Mmakefile:
    Pass --use-msvc-setargv-extension to the ml script if we are using MSVC.

    Unrelated: Fix the identity of a compiler in a comment.

    Unrelated: Add an XXX about something that looks suspicious.

util/mkinit.c:
    Add a pointer to scripts/ml.in, saying that if the Windows entry
    point (currently wmain) is updated, then the script may need to
    be updated.
2026-01-06 21:45:53 +11:00
Julien Fischer
318b21ae48 Fix a problem with reading .module_dep files.
The source file name that is used as the second argument of a .module_dep file
may be directory qualified (e.g. if we are using source file mapping to
include source files from multiple directories). On Windows, such directory
qualified source file names may use '\' as a path separator. We use the term
parser to read the contents of .module dep files and that requires '\' to be
escaped. However, the code that writes module_dep files does not currently
do the required escaping. Fix that.

compiler/make.module_dep_file.m:
    Escape the source file name before writing it to a .module_dep file.
2026-01-05 19:41:41 +11:00
Julien Fischer
876a936358 Fix typo.
libary/rbtree.m:
   s/ip/up/
2026-01-04 03:07:21 +11:00
Julien Fischer
714d2ccd3e Support bootchecking in the MSYS2 MSYS environment.
MSYS2's MSYS environment is similar to Cygwin and shares a lot of its
underlying code. Executables in this environment are linked with
msys-2.0.dll, which is a POSIX-emulation layer similar to cygwin1.dll.
The change of configuration triple for this environment last year from
x86_64-pc-msys to x86_64-pc-cygwin means that we can trivially support
Mercury in it by virtue of the fact that we already support Cygwin.

This diff makes some changes required to allow Mercury to bootcheck in
the MSYS2 MSYS environment.

configure.ac:
    Modify the error message we print if we detect *-pc-msys
    architecture.

tools/bootcheck:
    Do not abort if we detect the MSYS2 MSYS environment.

    Extend the comment describing the handling of the different MSYS2
    environment.

    Give a variable a more accurate name.
2026-01-04 03:01:25 +11:00
Julien Fischer
0994f4ca23 Drop support for older versions of MSVC.
Drop support for versions of MSVC before version 19. We have never tested the
64-bit port with older versions and effort spent maintaining the 32-bit version
would be better spent elsewhere.

Rewrites and updates for README.MS-VisualC.md.

NEWS.md:
    Announce the above.

Documentation/README.MS-VisualC.md:
    Rewrite the introduction to

    Fix and adjust markup.

    Delete the post-installation instruction to modify the host and target env
    types in Mercury.config. This is unnecessary as of commit 6f2a3e69a.

    Delete an old section concerning Cygwin and network drives.
2026-01-03 18:59:14 +11:00
Julien Fischer
6167331f9e Improve coverage of the MINGW32 environment.
Documentation/README.MSYS2.md:
     As above.
2026-01-03 15:37:16 +11:00
Zoltan Somogyi
faa76a8c27 Some further code simplification. 2026-01-03 05:09:05 +11:00
Julien Fischer
5d73f4b0b9 Adjust markup.
Documentation/README.MSYS2.md:
    As above.
2026-01-03 04:16:30 +11:00
Julien Fischer
12f0e80e30 Further work on the MSYS2 README.
Documentation/README.MSYS2.md:
     Add a section on using Mercury compilers created in the MSYS2 environment
     at the Windows Command Prompt. As of rotd-2025-12-31, this now works
     out of the box, without requiring users to edit Mercury.config.

     Fix some markup errors.

     Minor adjustments to other sections.
2026-01-03 03:43:45 +11:00
Zoltan Somogyi
b0e1d74c3c Delete an unneeded parameter. 2026-01-03 03:14:25 +11:00
Zoltan Somogyi
fabec962cd Move predicate-specific comments to their decls. 2026-01-03 01:08:58 +11:00
Zoltan Somogyi
185443d791 Update the programming style of rbtree.m. 2026-01-02 20:36:10 +11:00
Zoltan Somogyi
03b07d8675 Expect a 2026 copyright year. 2026-01-02 20:31:48 +11:00
Julien Fischer
f66daeb1bf Update a link.
README.md:
   As above.
2026-01-02 16:08:20 +11:00
Julien Fischer
f2e270d87d Add missing word.
Documentation/README.MS-VisualC.md:
    As above.
2026-01-02 16:06:23 +11:00
Julien Fischer
95bb94753e Delete references to MSYS.
Documentation/README.MS-VisualC.md:
    As above.
2026-01-02 16:06:23 +11:00
Julien Fischer
6505453a78 Delete Windows 7 from list of tested versions.
Documentation/README.MS-Windows.md:
    As above.
2026-01-02 16:06:23 +11:00
Julien Fischer
c46a81f3be Rename README.MinGW to README.MSYS2.md.
Documentation/README.MinGW:
    As above.

Documentation/README.MS-Windows.md:
    Conform to the above change. Delete references to the original
    MSYS platform.
2026-01-02 16:06:23 +11:00
Julien Fischer
949d1d7354 Rewrite the MinGW / MSYS / MSYS2 README.
- Delete coverage of the old MSYS / MinGW platform, since it is dead
  at this point. Recommend that users do not use it. This README now
  describes the MSYS2 platform exclusively.

- Delete a note to developers about the bootcheck script not working.
  It has worked with MSYS2 since the beginning of 2025 and we no longer
  care about the old MSYS.

- Delete a section describing how to build a MinGW cross compiler
  in Cygwin using gcc's -mno-cygwin option. That has not worked
  in well over a decade. (In fact, I can't remember it ever having
  worked.)

- Describe MSYS2 environments and which ones we recommend for use
  with Mercury.

- Expand the description of how to use Mercury in the MSYS2 shell.

- Add a section on a common problem, Mercury compiler generated
  executables aborting due to the loader being unable to find
  libwinpthread-1.dll.

Documentation/README.MinGW:
    As above.
2026-01-02 16:06:23 +11:00
Zoltan Somogyi
c76d358766 Add uint versions of length and count operations.
Where possible, make the uint version the main version,
casting its result to int for the old length/count versions.

In a few places, apply simple speedups.

library/list.m:
library/one_or_more.m:
    Add ulength operations as uint versions of length operations
    for these sequence data structures.

library/edit_seq.m:
    Delete the local definition of what is now list.ulength.

library/diet.m:
library/ranges.m:
library/fat_sparse_bitset.m:
library/fatter_sparse_bitset.m:
library/set.m:
library/set_bbbtree.m:
library/set_ctree234.m:
library/set_ordlist.m:
library/set_tree234.m:
library/set_unordlist.m:
library/sparse_bitset.m:
library/test_bitset.m:
library/tree_bitset.m:
    Add ucount operations as uint versions of count operations
    for these set data structures.

library/bag.m:
    Add ucount operations as uint versions of count operations
    for this bag data structure.

library/map.m:
library/multi_map.m:
library/one_or_more_map.m:
library/rbtree.m:
library/tree234.m:
    Add ucount operations as uint versions of count operations
    for these map data structures.
2026-01-02 15:35:20 +11:00
Julien Fischer
ac642e9ef7 Update copyright notices for 2026.
LICENSE:
compiler/print_help.m:
doc/*.texi:
profiler/mercury_profile.m:
slice/mcov.m:
slice/mdice.m:
slice/mslice.m:
slice/mtc_diff.m:
slice/mtc_union.m:
trace/mercury_trace_Internal.c:
    As above.
2026-01-01 19:56:20 +11:00
Zoltan Somogyi
81e408ac75 Fix typo. 2026-01-01 18:01:39 +11:00