configure.ac:
Drop support for OSF/1.
Delete more IRIX stuff.
configure.ac:
runtime/mercury_conf.h.in:
runtime/mercury_thread.h:
Delete workarounds required when using the Digital Unix pthreads
library.
Mmake.common.in:
runtime/mercury_wrapper.c:
Delete stuff for IRIX.
README.OSF1:
Delete this file.
.README.in:
Delete the pointers to the readme files for IRIX and OSF/1.
NEWS:
Announce the dropping of support for OSF/1.
IRIX itself is more or less dead and the Mercury support for it has not been
tested for many years.
configure.ac:
compiler/notes/overall_design.m:
doc/user_guide.texi:
scripts/mgnuc.in:
As above.
NEWS:
Announce the above.
The getopt and getopt_io modules use strings to describe errors that occur
during option processing. There are a couple of problems with doing this:
(1) it makes some assumptions about how client programs want to word, and to a
large extent, format these error messages.
(2) it assumes that the error messages are in English.
This diff changes the getopt and getopt_io modules to use structured
representations of errors instead of strings. This structured representation
is defined by the new option_error/1 type. We introduce new versions of the
various process_options predicates that are suffixed with "_se" (standing for
"structured error") that return values of type option_error/1 when an error occurs.
A new function, option_error_to_string/1, converts option_error/1 values into
the strings that the getopt and getopt_io modules previously generated. The
existing process_options predicates are just wrappers around all of this for
the purposes of backwards compatibility.
The new option_error/1 type returns more information than existing error
messages require, for example, where possible we return both the element of the
option enumeration involved and a string giving the option as it actually
appeared on the command line.
library/getopt.m:
library/getopt_io.m:
Add predicates and types for structured errors as described above.
Group function clauses together with the corresponding predicate
ones.
Avoid unnecessary differences between these two modules in a few
spots.
NEWS:
Announce the above changes.
README.md:
Remove references to lcc (hasn't been tried with Mercury for years)
and the old .NET backend from README.md (likely to cause confusion
more than anything else).
README.md:
README.IRIX-5:
Remove the references to IRIX-5 (including the file README.IRIX-5)
completely. IRIX is pretty much dead, this documentation is pretty
much clutter at this point.
README.AIX:
README.HPUX:
Replacing the contents of README.HPUX and README.AIX to say that
Mercury (to the best of our knowledge) hasn't been tried with recent
versions of those OSs.
MR_LOWLEVEL_DEBUG is set when compiling the no_refs_to_deleted_labels
test case to give MR_init_label macros some effect. However
MR_LOWLEVEL_DEBUG implies MR_DEBUG_GOTOS, and leads to link errors if
the runtime was not built with MR_DEBUG_GOTOS.
tests/hard_coded/Mercury.options:
Replace MR_LOWLEVEL_DEBUG with MR_DEBUG_LABEL_NAMES,
implying MR_INSERT_LABELS but not MR_DEBUG_GOTOS.
README.md:
Reorder the list or README files to that they occur from most relevant
to new users to least relevant. In particular put commonly-used
backends and platforms earlier in the list.
Provide some introductory text that introduce the user to the multiple
backends available.
Add further links to more information such as the documentation.
Add text so that the file reads more natrually.
(Commit log by Paul Bone)
Github will automatically format and display a file named README.md in the
root directory of any project. This can be helpful to, at a minimum, direct
anyone browsing github to the project's website. Sebastian has contributed
the following README.md.
README.md:
New markdown-formatted README file for github.
The internal representation of a character constant as an atom term
should not use escaped character syntax; the escaping should occur
when writing the external representation only.
compiler/hlds_out_mode.m:
compiler/intermod.m:
compiler/prog_util.m:
compiler/type_constraints.m:
compiler/typecheck.m:
Fix instances of the bug.
tests/valid/Mercury.options
tests/valid/Mmakefile
tests/valid/intermod_char.m
tests/valid/intermod_char2.m
Add test case. The .opt file was invalid because the character
in the clause head was doubly-escaped.
Merge recent changes on the release branch into the master branch. This
includes a couple of changes to the NEWS file plus a fix for resource leaks
in the dir standard library module.
Add a --parallel command line option to the mandelbrot benchmark that can be
given to use explicitly parallelised routines. This makes it easier to turn
on and off explicit parallelism, depending on your testing needs.
benchmarks/progs/mandelbrot/mandelbrot.m:
As above
When I added this test recently I forgot to make it condition on any grade
with a par component, or the java and csharp grades. This patch fixes this.
tests/hard_coded/Mmakefile:
As above.
The directory stream was not closed if dir.open succeeded in opening
the directory, but failing to read the first entry (which may be as
simple as an empty directory).
The directory stream was also not closed when dir.foldl2_process_dir2
returns an error value.
library/dir.m:
As above.
tests/hard_coded/Mmakefile:
tests/hard_coded/dir_fold.exp:
tests/hard_coded/dir_fold.m:
Add regression test.
NEWS:
Announce change.
configure.ac:
Pass -x to strip when linking an executable against Mercury shared
libraries on Mac OS X.
Make the up-to-date check require {14.01.-beta,rotd}-2014-05-05
or later.
scripts/Mercury.config.in:
Set the default values of --strip-executable-{shared,static}-flags.
lex_demo.m wasn't compiling because io.print_line doesn't exist. I also
found that drawing the "> " prompt wasn't working as expected. This patch
fixes both these issues.
extras/lex/samples/lex_demo.m:
As above.
/[a-z]{10}/ in this way: `Regex = range('a', 'z') * 10'.
extras/lex/lex.m:
Removed unused and unsafe str_foldr function,
added (T * int) = regexp function.
extras/lex/samples/lex_demo.m:
Removed whitespace in comments,
added an input prompt,
added a lexeme for '//' C++ comments using the new '*' operator.
This test case is based off Sebastian Godelet's work, which found a bug that
can occur when release/3 is called on a barrier and then other calls to
wait/3 are made. The final call to wait/3 tries to execute the normal
'unblock the barrier' code and deadlocks there because the barrier is
already unlocked, specifically a value is already present in the "Go" mvar.
Thanks Sebastian for your test case.
library/thread.barrier.m:
Handle release/3 properly: release/3 now sets the number of remaining
threads to reach the barrier to zero, and wait/3 will determine why this
iz zero (it's normally at least one), and if it is because release was
called then no error is raised. The other reasion why the number of
remaining threads may be zero is because wait has been called too many
times, in this case wait/3 will throw an exception.
tests/hard_coded/Mmakefile:
tests/hard_coded/thread_barrier_test.exp:
tests/hard_coded/thread_barrier_test.m:
Add new test case.
tests/hard_coded/thread_test_utils.m
This module contains code that may be useful for other concurrency
tests.
Mission Critical IT has maintained a library of code for concurrent
programming. We're happy to contribute this upstream to the Mercury
project starting with this module implementing barriers.
library/thread.barrier.m:
Add the new module implementing barriers.
library/thread.m:
library/library.m:
Add new module.
NEWS:
Announce the new module.
library/thread.semaphore.m:
Add a comment.
The directory stream was not closed if dir.open succeeded in opening
the directory, but failing to read the first entry (which may be as
simple as an empty directory).
The directory stream was also not closed when dir.foldl2_process_dir2
returns an error value.
library/dir.m:
As above.
tests/hard_coded/Mmakefile:
tests/hard_coded/dir_fold.exp:
tests/hard_coded/dir_fold.m:
Add regression test.
NEWS:
Announce change.
configure.ac:
Pass -x to strip when linking an executable against Mercury shared
libraries on Mac OS X.
Make the up-to-date check require {14.01.-beta,rotd}-2014-05-05
or later.
scripts/Mercury.config.in:
Set the default values of --strip-executable-{shared,static}-flags.
Stripping executables on Mac OS X that were built with --mercury-linkage=shared
was resulting in the symbols for the global variables introduced for runtime
trace goal env flags being incorrectly removed. We need to pass the "-x" flag
to strip to prevent this happening. This diff adds the ability to pass
different flags to strip depending on the value of --mercury-linkage.
compiler/options.m:
Add two new options, --strip-executable-{shared,static}-flags, that
specify what flags are passed to the strip command when --mercury-linkage
is set to shared or static respectively.
Add a new option to test that the compiler is sufficiently up-to-date.
compiler/compile_target_code.m:
Implement the new options.
doc/user_guide.texi:
Document the new options.
NEWS:
Adjust the entry for the --strip-executable-command option to mention
the additional two new options.
On MinGW system do not try to link against libpthread if that library is not
actually present on the system. This is an issue in the compiler directory
because we link the compiler against the thread libraries regardless of the
grade. This is due to the implementation of --make.
configure.ac:
On MinGW, if we cannot find pthreads then set THREAD_LIBS to empty.
Some versions of the MinGW system headers rely on the types off_t and off64_t
being defined, but they will not be defined if -ansi is enabled.
(This seems to affect MinGW systems using GCC 4.8; I haven't checked other
GCC versions yet.)
configure.ac:
scripts/mgnuc.in:
Do not compile with -ansi on MinGW systems.
Currently attempting to run dynamically linked executables that are stripped
fails in the presence of programs that use env runtime trace goal conditions.
This is because stripping such executables with just "strip" (as we currently
do) removes the global variable introduced by env runtime trace goal
conditions. (The long term fix is to invoke strip with the -x flag, but this
needs to be conditional on the value of --mercury-linkage and we currently
don't have the command line options to support that.)
configure.ac:
Disable stripping of executables on Mac OS X.
runtime/mercury_overflow.c:
As above: compiling this function in high-level C grades
will fail since it refers to fields of the MR_Context
structure that do not exist in those grades.
Also fix some bugs in related code, and improve the related debugging
infrastructure.
-------------------
runtime/mercury_stacks.[ch]:
Fix bug 314 for temp frames created by nondet procedures. The fix will
probably also work for *det* procedures that create temp frames on the
nondet stack, but I can't think of a way to test that, because det
procedures create such frames only in very specific circumstances,
and I cannot think of a way to nest a recursive call inside those
circumstances.
The problem was that when we were creating new temp frames on
the nondet stack, we did not check whether the current nondet stack segment
had room for them. We now do.
The stack trace tracing code needs to know the size of each nondet stack
frame, since it uses the size to classify frames as temp or ordinary.
The size is given by the difference in address between the address of the
frame and the address of the previous frame. This difference would yield
an incorrect size and hence an incorrect frame classification if a temp
frame were allowed to have a frame on a different segment as its
immediate predecessor.
We prevent this by putting an ordinary (i.e. non-temp) frame at the bottom
of every new nondet stack segment as a sentinel. We hand-build this frame,
since it is not an "ordinary" ordinary frame. It is not created by a call,
so it has no meaningful success continuation, and since it does not make
any calls, no other frame's success continuation can point to it either.
If backtracking reaches this sentinel frame, we use this fact to free
all the segments beyond the one the sentinel frame is in, but keep the
frame the sentinel frame is in, since we are likely to need it again.
Document the reason why MR_incr_sp_leaf() does not have to check
whether a new stack segment is needed. (See the fix to llds_out_instr.m
below.)
runtime/mercury_stack_trace.[ch]:
When traversing the nondet stack, treat the sentinel frame specially.
We have to, since it is an ordinary frame (i.e. it is not a temp frame),
but it is not an "ordinary" ordinary frame: it does not make calls,
and hence calls cannot return to it, and it does not return to any
other frame either. It therefore does not have the layout structures
(label and proc) that the nondet stack traversal expects to find.
Fix an old bug: the nondet stack traversal used a simple directional
pointer comparison to check whether it has reached the bottom of the nondet
stack. This is NOT guaranteed to work in the presence of stack segments:
depending on exactly what addresses new stack segments get, a stack frame
can have an address BELOW the address of the initial stack frame
even if it is logically ABOVE that stack frame.
Another old bug was that a difference between two pointers, which could
be 64 bit, was stored in an int, which could be 32 bit.
The nondet stack traversal code used a similar directional comparison
to implement optionally stopping at an arbitrary point on the nondet stack.
Fixing this facility (the limit_addr parameter of MR_dump_nondet_stack)
while preserving reasonable efficiency would not be trivial, but it would
also be pointless, since the facility is not actually used. This diff
deletes the parameter instead.
Move some loop invariant code out of its loop.
trace/mercury_trace_cmd_developer.c:
trace/mercury_trace_external.c:
Don't pass the now-deleted parameter to mercury_stack_trace.c.
runtime/mercury_wrapper.c:
Record the zone of the initial nondet stack frame, since the fix
of mercury_stack_trace.c needs that info, and it is much more efficient
to set it up just once.
tests/hard_coded/bug314.{m,exp}:
The regression test for this bug.
tests/hard_coded/Mercury.options:
Compile the new test case with the options it needs.
tests/hard_coded/Mmakefile:
Enable the new test case.
-------------------
runtime/mercury_wrapper.c:
The compiler knows the number of words in a stack frame it is creating,
not necessarily the number of bytes (though it could put bounds on that
from the number of tag bits). Since this size must sync with the runtime,
change the runtime's variable holding this size to also be in words.
Note that similar changes would also be beneficial for other sizes.
compiler/llds_out_instr.m:
Conform to the change in mercury_wrapper.c, fixing an old bug
(mercury_wrapper.c reserved 128 BYTES for leaf procedures, but
llds_out_instr.m was using that space for procedures whose frames
were up to 128 WORDS in size.)
compiler/mercury_memory.c:
Conform to the change in mercury_wrapper.c.
-------------------
runtime/mercury_memory_zones.h:
Instead of starting to use EVERY zone at a different offset, do this
only for the INITIAL zones in each memory area, since only on these
is it useful. When the program first starts up, it WILL be using
the initial parts of the det stack, nondet stack and heap, so it is
useful to make sure that these do not collide in the cache. However,
when we allocate e.g. the second zone in e.g. the nondet stack, we are
no more likely to be beating on the initial part of any segment
of the det stack than on any other part of such segments.
If a new debug macro, MR_DEBUG_STACK_SEGMENTS_SET_SIZE is set (to an int),
use only that many words in each segment. This allows the segment switchover
code to be exercised and debugged with smaller test cases.
runtime/mercury_conf_param.h:
Document the MR_DEBUG_STACK_SEGMENTS_SET_SIZE macro.
Convert this file to four-space indentation with tabs expanded.
-------------------
runtime/mercury_overflow.h:
Make abort messages from overflows and underflows more useful by including
more information.
runtime/mercury_overflow.c:
Add a new function to help with the better abort messages.
Since this file did not exist before, create it.
runtime/Mmakefile:
Add the new source file to the list of source files.
-------------------
runtime/mercury_debug.[ch]:
Fix problems with the formatting of the debugging output from existing
functions.
Add new functions for dumping info about memory zones.
Factor out some common code.
Convert the header file to four-space indentation.
-------------------
runtime/mercury_grade.c:
Generate an error if stack segments are specified together with stack
extension
-------------------
trace/.gitignore:
util/.gitignore:
tests/debugger/.gitignore:
List some more files.
-------------------
runtime/mercury_context.c:
runtime/mercury_engine.[ch]:
runtime/mercury_misc.h:
compiler/notes/failure.html:
Fix white space.
The abort was caused by the fact that when the parser found an item that
looks like a fact for an undeclared predicate, such as the predicate ','/,
it created a hlds_pred filled with a clause_info in which terms that the
user intended to be goals are instead taken to be terms. Any reference
to predicates in those terms are taken by purity-checking to be higher order
references, which need a mode declaration. If the reference is to a predicate
(such as ,/2) whose declaration is implicit, that mode declaration will be
missing.
The fix has two parts. First, do not generate an abort in purity checking
when finding the mode declaration of a predicate or function in (what seems to
be) a higher order term is missing. Second, do not generate implicit
declarations for ,/2, since this is NEVER what the user wants.
A third part of this diff is an improvement in the contexts we record
for terms, for better error messages. I noticed the need for this when
looking at the compiler's output for the new cases.
compiler/post_typecheck.m:
When finding an apparent reference to a predicate or function with
no mode declarations, do not abort; instead, report an error.
compiler/purity.m:
Record the error reported by post_typecheck.m.
compiler/add_clause.m:
If we see a clause for `,'/2, do NOT treat it as implicitly defining
a ,/2 predicate. Instead, generate a situation-specific error message that
mentions the usual cause of the error.
compiler/add_pred.m:
Clean up the predicates that add the implicit predicate declarations
by making them both update module_infos, and by putting their arguments
into a consistent order.
compiler/make_hlds_passes.m:
Do likewise for a couple of predicates here.
compiler/add_pragma.m:
Conform to the change to add_pred.m.
compiler/superhomogeneous.m:
When expanding a term such as
line 1: p(a,
line 2: p(b,
line 3: c))
associate line 2 with the unification of a fresh variable with b,
and line 3 with the unification of a fresh variable with c. We used
to use the context of the top level term, which in this case is line 1,
instead.
This makes the compiler generate better (less misleading) output for the
ref_to_implicit_pred.m test case below, as well as in many other cases.
compiler/state_var.m:
When replacing !.X or !:X with a fresh variable term, copy the context
of the original functor term to the new variable term. Before the change
to superhomogeneous.m, this wasn't needed since the context of that term
was ignored, but now we use it.
tests/invalid/ref_to_implicit_pred.{m,err_exp}:
New test case to test the first part of the fix.
tests/invalid/ref_to_implicit_comma.{m,err_exp}:
New test case to test the second part of the fix.
tests/invalid/Mmakefile:
Enable both new test cases.
tests/hard_coded/impl_def_literal.{m,exp}:
Update this expected output for the more accurate contexts we now
generate, and update the comment in the source code accordingly.
tests/invalid/ambiguous_overloading_error.exp:
tests/invalid/max_error_line_width.err_exp:
tests/invalid/transitive_import_class.err_exp:
tests/warnings/ambiguous_overloading.exp:
Update these expected outputs for the more accurate contexts we now
generate.
mmc --make prints a grave error message when the source file of a module
can no longer be found:
** Module `foo' is imported or included by module `bar'.
** dependencies for `Mercury/int3s/foo.int3' do not exist: foo.m
** This indicates a bug in `mmc --make'.
compiler/make.module_dep_file.m:
Check that the source file of a local `.module_dep' file still
exists. If it doesn't, delete the `.module_dep' file and ignore
the information it contains.
List files included by pragma foreign_decl and pragma foreign_code
declarations in the makefile dependencies file (`.d') generated for
a module.
The written dependencies are more conservative than necessary
(e.g. C target files should not depend on Java include files),
but I don't think any more effort is warranted.
compiler/module_imports.m:
Add get_foreign_include_files to return a list of include files
from a list of items.
compiler/modules.m:
Add foreign include files when initialising the module_imports
structure in grab_imported_modules. Otherwise it will be empty
when the `.d' file is automatically generated as a side-effect
of generating target code.
compiler/write_deps_file.m:
Write include files from the module_imports structure into the
`.d' file.
doc/reference_manual.texi:
Update manual.
tests/invalid/Mmakefile:
Make `missing_file' a phony target. This change makes `make'
aware of the dependency and report the error, instead of
running the test case that checks the compiler's reaction
to the missing file.
The generated shell script to launch C# executables did not use absolute
paths. The C# and Java shell scripts were missing some variable
quoting, leading to problems with paths containing spaces.
compiler/compile_target_code.m:
Assign the script directory to DIR and use that to launch the
CLI interpreter.
Quote the CLI_INTERPRETER and executable filename.
compiler/module_cmds.m:
Quote Mercury-generated CLASSPATH in case the directory contains
spaces.
Make DIR absolute in case the script is invoked from a
subdirectory.
mmc --make reports a duplicate error message when a dependency file
cannot be found, e.g.
** Error: file `./foo' not found: file `./foo' not found
make.dependencies.m:
Fix the problem.