Commit Graph

20829 Commits

Author SHA1 Message Date
Peter Wang
8d593a4c63 Fix structure assignment conflicts with global registers test.
configure.ac:
    As above. The test was inadvertently broken when MR_Spy_Point was
    renamed to MR_SpyPoint. However, it would only make a difference for
    anyone still using gcc < 3.
version-20_06_1
2020-10-15 21:31:49 +11:00
Peter Wang
5ae9de0c45 Fix implicit return types in configure tests.
configure.ac:
    As above.
2020-10-15 21:31:37 +11:00
Peter Wang
8e796d84f7 Fix an implicit declaration of exit() in configure test.
configure.ac:
    As above.
2020-10-15 21:31:23 +11:00
Julien Fischer
1ebf7fa744 Avoid warnings / errors in configure tests.
configure.ac:
    Avoid implicit declarations for exit().  Xcode 12 treats
    them as an error by default.
2020-10-15 21:30:58 +11:00
Peter Wang
c5a452f30b Delete unused MR_CAN_GET_PC_AT_SIGNAL macro.
runtime/mercury_conf_param.h:
    As above.
2020-10-15 21:30:20 +11:00
Peter Wang
ea84ab802c Simplify code to set SIGBUS/SIGSEGV handlers.
mercury_memory_handlers.c:
    Remove a layer of macros.
2020-10-15 21:30:07 +11:00
Peter Wang
504e612361 Fix access to PC from signal handler context.
configure.ac:
    Deduplicate checks for how to access the program counter from a
    signal handler context.

    Check REG_RIP for x86-64 and REG_EIP for i386.

    Define _GNU_SOURCE for the register constants (REG_RIP, etc.)

    Drop support for accessing the PC on Alpha as it doesn't fit easily
    into the "uc_mcontext.gregs[$reg]" pattern.
2020-10-15 21:29:52 +11:00
Peter Wang
a6b313c709 Delete unnecessary test for sa_sigaction field.
configure.ac:
    Delete check for sa_sigaction field. If a call to sigaction()
    has the SA_SIGINFO flag set then the handler must be specified in
    the sa_sigaction field, not the sa_handler field.

runtime/mercury_conf.h.in:
    Delete MR_SIGACTION_FIELD macro.

runtime/mercury_signal.c:
    Don't use MR_SIGACTION_FIELD macro.

    Don't define dummy value for SA_SIGINFO.

tools/configure_mingw_cross:
    Don't set now-unused variable.
2020-10-15 21:29:36 +11:00
Peter Wang
96fda643d0 Delete use of signal handlers taking sigcontext arguments.
The configure checks for sigcontext (aka sigcontext_struct) have failed
for a long time without anyone noticing. The MR_GET_FAULT_ADDR macro
that is also needed for the sigcontext code paths was only ever defined
for __i386__ and __mc68000__.

According to the sigaction(2) man page, the struct sigcontext
argument was obsoleted by the introduction of the SA_SIGINFO flag
(which we also have code for, though also not working either).

configure.ac:
    Delete checks related to struct sigcontext.

    Delete check for asm/sigcontext.h

runtime/mercury_conf.h.in:
    Delete macros that are no longer defined.

runtime/mercury_memory_handlers.c:
runtime/mercury_signal.c:
runtime/mercury_signal.h:
    Delete code for using signal handlers that take a sigcontext argument.

    Add XXX where native GC casts a context parameter to
    struct sigcontext * when it should be a ucontext_t *.
    Possibly never tested.

runtime/mercury_faultaddr.h:
    Delete this file containing only the MR_GET_FAULT_ADDR macro which is
    no longer used.

runtime/RESERVED_MACRO_NAMES:
ssdb/RESERVED_MACRO_NAMES:
trace/RESERVED_MACRO_NAMES:
    Delete macros that are no longer defined.

tools/configure_mingw_cross:
    Don't need to set variables mercury_cv_sigcontext_struct_2arg and
    mercury_cv_sigcontext_struct_3arg any more.
2020-10-15 21:29:15 +11:00
Peter Wang
1d6f8815fe Guard include <sys/siginfo.h> in configure tests.
configure.ac:
    As above.

    Note: as far as I know, sys/siginfo.h is a Linux specific header
    but I can't find it on any half recent Linux distribution.
2020-10-15 21:27:45 +11:00
Julien Fischer
2078dbccd1 Update NEWS for 20.06.1.
NEWS:
    As above.
2020-10-04 03:37:58 +11:00
Julien Fischer
80ec466c7b Fix Mantis #519.
extras/graphics/mercury_tcltk/mltcltk.m:
    Delete an old workaround that has not been required for versions of Tcl
    from 8.1 (released in 1999) onwards

    Minor syntax and style updates.
2020-10-03 22:14:04 +10:00
Zoltan Somogyi
d7b3362d31 Fix the "level" command in mdb.
trace/mercury_trace_cmd_browsing.c:
    The "level" command was documented to reset the current ancestor level
    to the level of the current event (ancestor level 0) when invoked
    without arguments, but when invoked that way, it reported an error
    instead. Fix this.

tests/debugger/queens_rep.inp:
tests/debugger/queens_rep.exp:
    Add a test for the fix in this existing test case.
2020-10-03 22:13:31 +10:00
Zoltan Somogyi
ac4443acfa Fix typo. 2020-10-03 22:12:38 +10:00
Zoltan Somogyi
f16e64c087 Fix bootcheck in deep profiling grades.
The fix is in two parts.

compiler/disj_gen.m:
    The first is fixing a bug I introduced recently while fixing
    github issue #90. The fix involved flushing resume vars to the stack
    *before* executing the code of a non-last disjunct, but the state of
    the code generator while generating the code of that disjunct needs
    to reflect this having been done. The earlier change did not do this,
    but this one does.

library/exception.m:
    The second part is some needed declarations of entry labels
    were not visible when compiling exception.c. Give exception.m,
    and hence exception.c, access to the declarations of those labels
    by #including the files containing the declarations, and ...

library/profiling_builtin.m:
    ... include two such declarations in the .mh file of this module
    for use by exception.m.

tests/EXPECT_FAIL_TESTS.asm_fast.gc.profdeep:
    Expect the setenv test case to fail in deep profiling grades, since
    (in the absence of working tail recursion while deep profiling)
    its million-calls-deep recursion to construct a million cons cells
    allocates *much* more memory per recursive call than in other grades,
    and thus running out of memory is the expected result.

Conflicts:
	compiler/disj_gen.m
2020-09-07 01:44:06 +10:00
Julien Fischer
7fc483ff53 Add a section for 20.06.1 NEWS
NEWS:
    As above.
2020-07-30 00:04:46 +10:00
Julien Fischer
59f47c3442 Set the version for the 20.06.1 betas.
tools/build_srcdist:
    As above.
2020-07-29 23:57:44 +10:00
Zoltan Somogyi
ccaffb8d0d Fix compiler abort on typeclass accesses in lambdas.
compiler/modecheck_unify.m:
    User-written lambdas always include a mode declaration. However,
    the compiler can also construct lambdas from curried calls, and these
    do not have a mode declaration. These converted, non-mode-declared
    lambdas always start out containing *only* the curried call, but
    the polymorphism transformation can insert other code before this call,
    e.g. to pick up the typeinfos and/or typeclass infos to be passed
    to that call from other typeclass infos, so don't abort if the lambda
    contains calls to the builtin predicates that do these things besides
    the original call.

tests/valid/undetermined_mode_lambda.m:
    A regression test for the bug.

tests/valid/Mmakefile:
    Enable the new test case.
2020-07-29 23:25:40 +10:00
Zoltan Somogyi
5286517299 Flush resume vars to stack before entering a disjunct.
compiler/disj_gen.m:
    When generating code for a non-final disjunct, if the resume point
    across that disjunct may require the resume variables to be
    in their stack slots, flush them to those stack slots *before*
    entering the code of the disjunct, not after. Flushing them
    too late was the cause of Mantis bug #513, which this diff fixes.

    Fix indentation.

compiler/code_gen.m:
compiler/ite_gen.m:
    Flush debug output as soon as it is finished being written,
    that this output appears in the expected order relative to
    mdb events when the compiler is executed in the debugger.

compiler/code_loc_dep.m:
    Add conditionally-compiled debug code to hekp debug the generation
    of code for failures.

    Make some debug output more readable.

    Give a predicate and a bunch of variables a more meaningful names.

compiler/opt_debug.m:
    When dumping instructions for debugging purposes, indent it by four spaces
    instead of tabs. Use more readable code to do the dumping.
2020-07-29 23:14:17 +10:00
Zoltan Somogyi
ab888e7f3a Improve programming style.
compiler/hlds_llds.m:
    Give some function symbols more meaningful names.

compiler/code_loc_dep.m:
    Give some function symbols and variables more meaningful names.

    Replace list(prog_var) with set_of_progvar in the signatures
    of some predicates to express the invariant that the argument
    should not contain any duplicates.

    Provide a utility predicate for ite_gen.m.

    Generate more readable debug output.

compiler/ite_gen.m:
    Factor out some common code.

    Optimize some tests.

    Break up a predicate to reduce the level of indentation.

    Add some module qualifications to reduce type ambiguity.

compiler/var_locn.m:
    Separate the two use cases of init_var_locn_state_2, since one needs
    more work than the other. Factor out the parts that are common to both.

compiler/llds.m:
    Define a bespoke type to control whether auto-comments are printed or not.

compiler/code_gen.m:
compiler/disj_gen.m:
compiler/frameopt.m:
compiler/hlds_out_goal.m:
compiler/layout_out.m:
compiler/live_vars.m:
compiler/live_vars.m:
compiler/liveness.m:
compiler/liveness.m:
compiler/llds_out_file.m:
compiler/llds_out_instr.m:
compiler/llds_out_util.m:
compiler/lookup_switch.m:
compiler/lookup_switch.m:
compiler/opt_debug.m:
compiler/optimize.m:
compiler/use_local_vars.m:
    Conform to the changes above.
2020-07-29 23:07:05 +10:00
Zoltan Somogyi
18aba304db Put foreign_codes before foreign_procs for LLDS.
This fixes a bug reported by Keri Harris on m-users.

compiler/llds_out_file.m:
    Output foreign_codes before the C modules that may contain
    foreign_procs, since those foreign_procs may need to refer
    to entities defined in the foreign_codes.

compiler/mercury_compile_llds_back_end.m:
    Improve some comments.

tests/hard_coded/foreign_code_before_proc.{m,exp}:
    A regression test for this bug.

tests/hard_coded/Mmakefile:
    Enable the regression test.
2020-07-29 23:01:40 +10:00
Zoltan Somogyi
cad30e0f9d Make require_tailrec_N pass with deep profiling.
tests/invalid/require_tailrec_1.err_exp3:
tests/invalid/require_tailrec_2.err_exp3:
tests/invalid/require_tailrec_3.err_exp3:
    Add these expected output files for deep profiling grades. They
    differ from the expected output files for both the LLDS and MLDS
    backends because deep profiling does not support *any* tail calls.

tests/invalid/require_tailrec_1.m:
tests/invalid/require_tailrec_2.m:
tests/invalid/require_tailrec_3.m:
    Update the source code of these test cases to document
    what circumstances each expected output file is for.

tests/invalid/require_tailrec_1.err_exp:
tests/invalid/require_tailrec_1.err_exp2:
tests/invalid/require_tailrec_2.err_exp:
tests/invalid/require_tailrec_2.err_exp2:
tests/invalid/require_tailrec_3.err_exp:
tests/invalid/require_tailrec_3.err_exp2:
    Update the existing expected output files to account for the
    changes in line numbers caused by the new documentation.
2020-07-29 22:25:09 +10:00
Zoltan Somogyi
c5d4245fdf Fix the declarations of builtin proc layouts.
This should fix Mantis bug #514.

runtime/mercury_builtin_types_proc_layouts.h:
    Fix the first problem: refer to four type constructors defined
    in private_builtin.m by their correct arities, so that the proc layout
    structures we generate for their unify and compare predicates
    get generated with the correct names and contents.

    The arities were probably correct when the code was written;
    we changed them from 1 to 0 at some point, and simply forgot
    to update all the affected places.

runtime/mercury_stack_layout.h:
    Fix the second problem: add "extern" to the declarations of those
    proc layout structures. Without the "extern", compilers defaulting
    the -fcommon will place these structures into common storage,
    which can be used as *definitions*. With the "extern", compilers
    should do the right thing whether or not they default to -fcommon.

runtime/mercury_unify_compare_body.h:
    Conform to the change in mercury_builtin_types_proc_layouts.h:
    refer to the affected four types using the correct arities.
2020-07-29 22:24:32 +10:00
Zoltan Somogyi
45607570a8 Add test case for newly reported bug. 2020-07-29 22:23:49 +10:00
Peter Wang
f6e4f440f3 Improve wait_pid and wait_any.
compiler/process_util.m:
    Make do_wait always assign all output variables.

    Make do_wait return an error message if waitpid() fails.
    Do not use MR_perror.

    Make wrappers wait_pid and wait_any return errors from waitpid().

    Change wait_any to return maybe(pid) in case waitpid() does not
    return a child process id.
2020-07-29 22:23:30 +10:00
Peter Wang
b3d391378b Fix some uninitialised variables in error paths.
browser/util.m:
compiler/equiv_type_hlds.m:
compiler/inst_test.m:
library/construct.m:
library/io.m:
    Ensure output variables are initialised in all code paths.
2020-07-29 22:23:19 +10:00
Julien Fischer
b719864b35 Fix problem building stage 1 compiler in Java grade.
scripts/Mercury.config.bootstrap.in:
    Pass --restricted-command-line to the bootstrap compiler.  On Windows, the
    command lines with which we invoke the Java compiler in the compiler
    directory are apparently "too long".
version-20_06
2020-06-29 18:19:39 +10:00
Julien Fischer
31e10d0f83 Fix a typo.
extras/odbc/Mmakefile:
    As above.
2020-06-29 00:31:15 +10:00
Julien Fischer
3797cada33 Adjust markup
README.MacOS:
    As above.
2020-06-27 23:03:22 +10:00
Zoltan Somogyi
a8c53667ac Further improve the documentation of MacOS. 2020-06-27 23:03:09 +10:00
Julien Fischer
62cf9388b5 Improve configure test for broken Xcode 11.
Update README.MacOS.

configure.ac:
    Only emit a warning about Xcode 11 being broken for versions 11.0 - 11.3.

README.MacOS:
    Shift the note about broken versions of Xcode 11 to a more
    prominent position.

    Mention that the deep profiler set up instructions given here
    only apply to 10.8 or earlier; after that users will need to
    install their own web server.

    Mention that the building 32-bit Mercury installations on Catalina
    does not work since 32-bit code is no longer supported there.

    Convert this file from sort-of Markdown to actual Markdown.

    Various minor cleanups.
2020-06-27 23:02:51 +10:00
Julien Fischer
8098244346 Add mercury script to .gitignore.
scripts/.gitignore:
    As above.
2020-06-27 23:02:39 +10:00
Julien Fischer
5288eae5ed Fix minor errors in user's guide.
doc/user_guide.texi:
   As above.
2020-06-24 21:55:23 +10:00
Julien Fischer
90f8aaa0ab Delete a doubled-up word.
doc/user_guide.texi:
   As above.
2020-06-24 21:55:09 +10:00
Zoltan Somogyi
4aed427693 Clarify some points. 2020-06-24 21:54:59 +10:00
Julien Fischer
8f3d921464 Fix inverted redirections in my last change.
m4/mercury.m4:
    As above.
2020-06-24 21:51:28 +10:00
Julien Fischer
d32b53cccd Avoid unwanted output in configure script.
m4/mercury.m4:
    Recent versions of the Java compiler print the output of -version
    to the standard output instead of the standard error. Account for
    this in order to avoid unwanted noise in the configure script.
2020-06-24 21:51:18 +10:00
Julien Fischer
2084a50631 Minor restructuring of the user's guide.
doc/user_guide.texi:
     Separate out the lists of generated files into separate paragraphs
     by target language.
2020-06-24 21:51:01 +10:00
Julien Fischer
49f62ef093 Updates for non-C grades in user's guide.
doc/user_guide.texi:
    mmake now assumes the use of GNU make.

    Document the .dll and .exe files generated when we target C#.

    Document that the .exe extension will be used for executables
    when targeting C on Windows.

    Add paragraphs describing what is generated for executables
    by the C#, Java and Erlang backends.

    Despite its name, mgnuc works with all (supported) C compilers
    not just GNU C.

    Mention the .dylib extension used for shared libraries on macOS.

    Uncomment the documentation for C# libraries.

    Update the section on Java libraries; the existing text describes
    a very old state of affairs.

README.Java:
    Add a missing word.
2020-06-24 21:50:54 +10:00
Julien Fischer
026148c907 Update and fix copyright notices in the scripts directory.
scripts/*:
    As above.
2020-06-16 17:26:02 +10:00
Julien Fischer
93d7059457 Support 'mercury' as a synonym for 'mmc' on all platforms.
On Windows the name 'mmc' is also used for the executable for Microsoft
Management Console.  For the MSVC port on the Windows command line we have long
provided a batch file named 'mercury' as an alternative to `mmc' in order to
avoid this clash.  (Re-arranging your PATH to avoid the clash is not always an
option.)

Provide a shell script named 'mercury' that serves the same purpose elsewhere.
Its main use is to avoid the name clash on MinGW/MSYS, Cygwin etc., but
making the name available everywhere should avoid unnecessary changes in build
scripts and alike.

Document the issue with the name clash in the appropriate chapter of the user's
guide and also in the top-level Windows README file.

scripts/mercury.in:
     Add a template for the 'mercury' script.

configure.ac:
     Create the 'mercury' wrapper script.

scripts/Mmakefile:
     Add 'mercury' to the list of scripts.

doc/user_guide.texi:
     Add a paragraph describing the 'mmc' name clash on Windows and what
     to do about it.

     Unrelated change: ':' is no longer a module qualifier.

README.MS-Windows:
     Point users to the relevant chapter of the user's guide for ways
     to deal with the `mmc' name clash.

NEWS:
     Announce the addition.
2020-06-16 17:25:44 +10:00
Zoltan Somogyi
a23ea3e151 Make "mmake runtests" work again.
My commit afe2887882 broke the ability
to run the test suite outside of a bootcheck by executing "mmake runtests"
in the tests directory. This diff fixes that.

tests/Mmake.common:
    Don't define "TESTS_DIR = ..". While every single tests/*/Mmakefile
    defined it as such, I overlooked the fact that tests/Mmakefile itself
    defined it ".", referring to the same directory from a different starting
    point. Document this easily-overlooked fact.

    Rename the old runtests target, which after afe2887 runs the tests
    in a single directory, as runtests_dir, to leave the target name
    "runtests" itself free for tests/Mmakefile to use.

tests/Mmakefile:
    Define "TESTS_DIR = .", and add a target "runtests" which invokes
    "mmake runtests_dir" in each test directory.

tools/bootcheck:
    Invoke "mmake runtests_dir" instead of "mmake runtests" in each
    test directory.

    Initialize a variable just before it is used.

tests/*/Mmakefile:
    Add back the definition "TESTS_DIR = .."
2020-06-11 22:28:02 +10:00
Julien Fischer
1f3a9fb1b0 Replace a call to an obsolete predicate.
tests/hard_coded/version_hash__table_test2.m:
    As above.
2020-06-08 16:31:33 +10:00
Julien Fischer
8cba9908ae Set the version for 20.06 betas.
tools/build_srdist:
   As above.
2020-06-02 21:22:36 +10:00
Julien Fischer
9f23ac15b8 20.06 release preparations.
NEWS:
HISTORY:
    Shift 20.01.X NEWS into the HISTORY file.

RELEASE_NOTES:
    Bump version.
2020-06-02 16:23:22 +10:00
Julien Fischer
c4b10b7b21 Be consistent about whether "semicolon" is hyphenated.
doc/reference_manual.texi:
compiler/mlds_to_c_stmt.m:
compiler/parse_type_defn.m:
    Use the non-hyphenated form of semicolon.
2020-06-02 15:08:36 +10:00
Julien Fischer
3de326befd Fix a typo.
tests/hard_coded/unsigned_lt_le.m:
    As above.
2020-05-31 20:40:24 +10:00
Zoltan Somogyi
733d20ba36 Fix bit-rot in comments. 2020-05-31 00:52:27 +10:00
Zoltan Somogyi
fe44a831bd Remove a workaround for NFS. 2020-05-30 23:35:53 +10:00
Zoltan Somogyi
85ad74d501 Delete mentions of hl grades. 2020-05-30 23:20:57 +10:00