Commit Graph

17378 Commits

Author SHA1 Message Date
Sebastian Godelet
fcee76f671 Update .gitignore files.
Update .gitignore files to ignore Unix executables and intermediate files.

extras/.gitignore:
    ignore *.beams

extras/cgi/.gitignore:
extras/gator/.gitignore:
extras/graphics/mercury_cairo/tutorial/.gitignore:
extras/logged_output/.gitignore:
extras/monte/.gitignore:
extras/odbc/.gitignore:
extras/posix/samples/.gitignore:
extras/quickcheck/.gitignore:
extras/quickcheck/tutes/.gitignore:
extras/references/samples/.gitignore:
    ignore executable(s)

extras/references/tests/.gitignore:
extras/trailed_update/tests/.gitignore:
    ignore test *.res and *.out files,
    ignore executable

extras/windows_installer_generator/sample/.gitignore:
samples/concurrency/dining_philosophers/.gitignore:
samples/concurrency/midimon/.gitignore:
    ignore executables

tests/hard_coded/.gitignore:
    ignore *.o and *.obj object files
2014-11-06 22:33:48 +11:00
Paul Bone
70c8410260 vim/README fixes.
+ Expand tabs to spaces.
+ "set modeline" is optional.

vim/README:
    As above.
2014-11-05 15:20:05 +11:00
Sebastian Godelet
3f9ec5c79d Align the Vim syntax file to match the Mercury language more closely
vim/README:
    Removed warning about ~/.vim/after/filetype.vim,

    Add utf-8 encoding detection.

    Added more details to the Vim README and

vim/after/filetype.vim:
vim/ftdetect/mercury.vim.
    Renamed file type detection for Mercury to ftdetect/mercury.vim.  This
    allows one to install the vim configuration files with a single command:
    $ cp -r vim/ ~/.vim

vim/syntax/mercury.vim:
    Fixed escaping of the escape character in strings,
2014-11-05 15:11:28 +11:00
Zoltan Somogyi
fe785c668b Consistently use set.is_empty and set.is_non_empty.
compiler/*.m:
deep_profiler/*.m:
    As above.

library/set.m:
library/set_bbbtree.m:
library/set_ctree234.m:
library/set_ordlist.m:
library/set_tree234.m:
library/set_unordlist.m:
    Add is_non_empty to the set modules that did not already have it.
    (Some did, some didn't.)

    Make the documentation of empty, is_empty, non_empty and is_non_empty
    consistent.
2014-11-04 23:18:43 +11:00
Zoltan Somogyi
38dc676f18 Record each kind of error when reading in files.
compiler/prog_io_error.m:
    Replace the enum that used to record only whether we found no errors,
    some nonfatal errors or some fatal errors, with a type that records
    just what kinds of errors we found. Document each kind of error.

compiler/prog_io.m:
    Record any errors using the new type. In some cases, we used to
    forget fatal errors after finding nonfatal ones; now we don't.

compiler/read_modules.m:
    Do not generate error messages about not being able to open a file
    if we *could* open the file, but found other fatal errors inside it.

    Factor out some common code.

compiler/intermod.m:
    Ignore the error of not being able to open .opt files, but do not
    ignore any other errors inside them. This fixes a long-standing piece
    of strange-looking code.

compiler/module_imports.m:
    Do not ignore old fatal errors if reading a new interface file
    gets some new nonfatal errors. This fixes a long-standing XXX.

compiler/write_module_interface_files.m:
    Do not ignore fatal errors when considering whether to write out interface
    files. This fixes a long-standing XXX.

compiler/modules.m:
    Generate better error messages for fatal errors inside modules
    other than not being able to open the module.

compiler/deps_map.m:
compiler/make.module_dep_file.m:
compiler/mercury_compile.m:
compiler/module_deps_graph.m:
compiler/recompilation.check.m:
compiler/trans_opt.m:
compiler/write_deps_file.m:
    Conform to the change in prog_io_error.m.
2014-11-04 21:12:18 +11:00
Zoltan Somogyi
15abab79de Wrap some too-long lines in the library. 2014-11-03 21:03:26 +11:00
Julien Fischer
51b25b465b Remove documentation for --enable-dotnet-grades from configure.
The presence of the option --enable-dotnet-grades in the configure options
is confusing users.  Hide the documentation for it.

Delete the configure option --enable-minimal-hlc-trail-install which was
only ever added as a shortcut for members of the G12 project.  It's just
cluttering things up now.

configure.ac:
.INSTALL.in:
	As above.
2014-11-01 17:34:44 +11:00
Paul Bone
ad60ac4fcd extras/net: Fix syntax error.
sockets.m:
    Fix syntax error.
2014-10-29 23:34:38 +11:00
Julien Fischer
6ccdb280aa Add string.is_all_alnum/1.
library/string.m:
	Add a predicate for testing whether a string contains
	only alphabetic characters or digits.

	Avoid excessive module qualification.

NEWS:
	Announce the addition.
2014-10-29 11:39:20 +11:00
Zoltan Somogyi
cbc6268c67 Print precise contexts for duplicate field names.
compiler/add_type.m:
    Record the context of the field name, not the context of the data
    constructor as a whole. The more fields a constructor has, and the
    more extensive comments they each have, the more misleading the
    overall context will be. (The code that uses these contexts does not
    need changing.)

compiler/prog_data.m:
    To store the information that add_type.m needs, create a space for
    the context of each field name next to the name itself. This requires
    breaking an old type equivalence; most of the "conform" changes below
    result from this.

compiler/prog_io_type_defn.m:
    When parsing type definitions, record the context of each field name
    in the new space.

compiler/field_access.m:
compiler/hlds_data.m:
compiler/hlds_pred.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/ml_code_util.m:
compiler/prog_type.m:
compiler/recompilation.check.m:
compiler/type_ctor_info.m:
compiler/typecheck.m:
compiler/typecheck_errors.m:
compiler/xml_documentation.m:
    Conform to the changes above.

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

    Move some code out of a loop.

    Give a predicate a more meaningful name.

tests/invalid/repeated_field_name.{m,err_exp}:
    A new test case for this change, which defines a field named f2
    three times. Before this change, the compiler reported:

    repeated_field_name.m:008: Error: field `repeated_field_name.f2' multiply
    repeated_field_name.m:008:   defined.
    repeated_field_name.m:008:   Here is the previous definition of field
    repeated_field_name.m:008:   `repeated_field_name.f2'.

    which is a bit baffling. We now report

    repeated_field_name.m:011: Error: field `repeated_field_name.f2' multiply
    repeated_field_name.m:011:   defined.
    repeated_field_name.m:010:   Here is the previous definition of field
    repeated_field_name.m:010:   `repeated_field_name.f2'.
    repeated_field_name.m:012: Error: field `repeated_field_name.f2' multiply
    repeated_field_name.m:012:   defined.
    repeated_field_name.m:010:   Here is the previous definition of field
    repeated_field_name.m:010:   `repeated_field_name.f2'.

    which gives the correct contexts, and also reports BOTH duplicates.
    (Previously, we generated two identical error messages, but then sorting
    the list of errors removed one of them.)

tests/invalid/Mmakefile:
    Enable the new test case.
2014-10-24 02:39:48 +11:00
Zoltan Somogyi
fbfb5385fa Print more specific errors when creating an mdb breakpoint fails.
trace/mercury_trace_spy.c:
    When giving a command such as

        mdb> break badfilename.m:42

    and the debugger has no information about any file named "badfilename.m",
    print an error message that says just that. If the file exists but the
    line number doesn't, say that. Previously, the error message didn't tell
    the user whether it was the filename or the line number that was in error.

trace/mercury_trace_tables.[ch]:
    Collect the information that mercury_trace_spy.c needs for its new task.

tests/debugger/breakpoints.{inp,exp,exp2}:
    Add a test of both kinds of bad breakpoint specification to this test case.
2014-10-24 02:04:14 +11:00
Zoltan Somogyi
10732f58da Improve the cohesion of modules.m.
Once upon a time, modules.m contained all the code in the compiler that dealt
with interface files, and it was by far the biggest module in the compiler
(almost 9000 lines). Once before, I moved cohesive bunches of functionality
out of modules.m into new modules, such as file_util.m and module_cmds.m.
This diff does likewise, creating three new modules.

Besides that main task, it has two minor algorithmic changes that should
have no overall effect on correctness. First, it merges some traversals of
the item list, which should yield a very minor speedup, and second,
in order to avoid the need for an undesirable module import, it eliminates
an unnecessary sorting of the item list that we used to do when reading
in interface files. (The sorting makes sense only when *creating* interface
files).

This diff also gives more meaningful names to some predicates.

compiler/module_deps_graph.m:
    This new module defines the module dependency graph, and provides
    predicates for building it and using it.

compiler/write_module_iterface_files.m:
    This new module does what its name says it does.

compiler/item_util.m:
    This new module contains utility predicates that deal with items that are
    now needed in more than one module.

compiler/parse_tree.m:
compiler/notes/compiler_design.html:
    Include the new modules.

compiler/write_deps_file.m:
    Move some predicates here from modules.m, since they belong here.
    E.g. one prints .d files, and related code to print .dv and .dep files
    was already here.

compiler/mercury_compile.m:
    Move a predicate here from modules.m, since it was only called from here,
    and related code is also here.

compiler/prog_item.m:
    Move a predicate here from modules.m, since it is a utility predicate
    for a type that is defined here.

compiler/prog_type.m:
    Move a predicate here from modules.m, since it is a utility predicate
    for types, like all the other predicates in this module.

compiler/modules.m:
    Remove the code that is now in other modules. Impose some structure
    on the remaining code. (It used to be too jumbled up to make much sense of,
    which was one reason why working with this code was unnecessarily hard).

compiler/deps_map.m:
    Note the relationship to the new module module_deps_graph.m.

compiler/*.m:
    Import the new modules as well as (or instead of) modules.m, and/or conform
    to new names for predicates.
2014-10-23 19:20:33 +11:00
Paul Bone
78afce2ab7 Merge branch 'version-14_01-branch'
Merge boehm_gc changes.
2014-10-17 12:06:32 +11:00
Paul Bone
c934ccd149 boehm_gc: Enable the TSX bug workaround on x86
Jan Alexander Steffens made this change to upstream boehm_gc.

boehm_gc/include/private/gcconfig.h:
    As above.
2014-10-17 12:05:19 +11:00
Paul Bone
e0e6e09c85 boehm_gc: Fix declration of setup_mark_lock()
These patches have been applied to upstream boehm_gc by Ivan Maidanski.
We're applying them here as we're tracking their fixes for the TSX lock
elision bug.

boehm_gc/pthread_support.c:
    Rename GC_setup_mark_lock() to setup_mark_lock() and make it static.
    Add static declration of setup_mark_lock();
    Call setup_mark_lock() while setting up parallel marking.

boehm_gc/include/private/pthread_support.h:
    Remove declaration of GC_setup_mark_lock();

boehm_gc/misc.c:
    Remove call to GC_setup_mark_lock();
2014-10-17 12:05:19 +11:00
Paul Bone
da2cb4387f boehm_gc: Use PTHREAD_MUTEX_NORMAL in the lock elision bug workaround
Peter Wang found that PTHREAD_MUTEX_NORMAL is sufficient to disable lock
elision for a mutex and avoid comprimising performance with
PTHREAD_MUTEX_ERRORCHECK.

I'll be writing to Ivan to let him know about this change.

boehm_gc/pthread_support.c:
    As above.
2014-10-17 12:05:19 +11:00
Paul Bone
fe7fe7ab45 boehm_gc: Apply upstream BoehmGC changes for lock elision bug workaround
This code was written by Ivan Maidanski <ivmai@mail.ru> in response to my
patch to the the Boehm GC to work-around the lock elision bug in glibc.

Fix and code refactoring of lock elision workaround (Linux/x64)
3d342554dc

boehm_gc/private/gcconfig.h:
    + (GLIBC_2_19_TSX_BUG): New macro defined for Linux/x86_64 (if Glibc
      used) to workaround a bug in Glibc lock elision implementation.

boehm_gc/misc.c:
    + (GC_init): Reformat code.

boehm_gc/pthread_support.c:
    + Move include of gnu/libc-version.h to gcconfig.h (used to check
      whether lock elision workaround needed).

    + (mark_mutex): Initialize (to PTHREAD_MUTEX_INITIALIZER) even lock
      elision workaround is needed (revert change in previous commit).

    + (parse_version): New static function (defined only if
      GLIBC_2_19_TSX_BUG).

    + (GC_setup_mark_lock): Use parse_version to check target Glibc version
      properly; do not reinitialize mutex unless workaround needed; call
      ABORT (with the appropriate message) in case of a failure in
      pthread_mutexattr_init/settype, pthread_mutex_init.
2014-10-17 12:05:19 +11:00
Peter Wang
7277cd1790 Restore promise_pure declaration for catch_impl.
I inadvertently deleted a promise_pure declaration for catch_impl in
commit 3f220a0097.  It is necessary in
java and csharp grades as catch_impl is implemented with mode-specific
clauses in those grades so the compiler infers impure.

library/exception.m:
	Restore the promise_pure declaration.

	Add Zoltan's explanation for why catch_impl is impure.

	Explain why we currently pretend catch_impl is pure.
2014-10-15 18:11:41 +11:00
Peter Wang
856692110f Merge branch 'version-14_01-branch' 2014-10-15 14:50:00 +11:00
Julien Fischer
14a0867fe4 Avoid module qualification in the interface of the io module where possible.
library/io.m:
	Avoid module qualification in the interface where possible.
	I've left the module qualifiers on the types io.state/0 and io.error/0
	since they just look strange without them.  (We don't really use io.state/0
	much these days anyway.)

	Most the result types (e.g. io.res/0) still require module
	qualification in order to distinguish them from the result types
	in the stream module.

	s/input_stream/text_input_stream/ for the all uses of the type
	input_stream.  Similarly for output streams.  This was what was
	intended when the equivalences were originally introduced and the
	debugger has used the text_* names for many years now.

library/store.m:
	s/io\.state/io/ in a few spots.
2014-10-15 11:54:41 +11:00
Peter Wang
71edaf52e6 Fix problems with higher-order inst matching with polymorphic modes.
These changes allow the compiler to accept the contravariance_poly.m
test case that requires higher order pred insts to be contravariant in
the initial argument insts.  Previously the compiler would have rejected
it, if not for the hack that allows ground to match incomplete bound insts.

compiler/inst_match.m:
	pred_inst_argmodes_matches enabled the cs_reverse mode when
	matching initial insts, which causes handle_inst_var_subs to
	swap the insts for the inst var substitution calculation.
	The insts are swapped back for inst matching, but cs_reverse
	remained effective.  A recursive call to match two insts would
	swap the insts *again*, to the wrong order.  The fix is to
	invert cs_reverse to cs_forward when the insts are swapped back
	for matching.

	In pred_inst_argmodes_matches apply the incrementally calculated
	inst var substitution before matching.

compiler/modecheck_util.m:
	Make handle_implied_mode use inst_matches_initial_no_implied_modes_sub.
	The non-sub variant does not compute inst var substitutions and
	fails where the higher-order argument inst has an inst variable
	(as in contravariance_poly.m), then handle_implied_mode
	incorrectly deduces that the call is to an implied mode.
2014-10-10 16:13:35 +11:00
Peter Wang
686c2c93c6 Fix computation of bound variables in goal_info_to_atomic_goal_rep_fields.
instmap_changed_vars calls inst_matches_final_typed to compare the insts
of a variable between two instmaps.  Previously inst_matches_final_typed
contained a hack such that ground matches even incomplete bound(...) insts,
so variables changing instantiatedness from ground to bound(...) would
NOT be included in the result set of instmap_changed_vars.  With the
removal of that hack, the behaviour of instmap_changed_vars changed to
match its documentation.

goal_info_to_atomic_goal_rep_fields used instmap_changed_vars to compute
BoundVars.  Variables whose instantiation state changes from ground to
bound, but are not actually bound by the goal, would now be in BoundVars.
This bug led to changes in the goal representation (e.g. from
unify_deconstruct_rep to partial_deconstruct_rep) and caused some
declarative debugging test cases to fail.

compiler/prog_rep.m:
	Change goal_info_to_atomic_goal_rep_fields to exclude variables
	which are ground before the goal from BoundVars.

	Reorder some code to execution order.
2014-10-10 16:13:35 +11:00
Peter Wang
491bb0ab5f Do not allow ground insts to match incomplete bound insts.
The mode checker contains a hack where ground matches bound insts even
if the bound inst is incomplete for the type.  The stated reason is that
otherwise the mode checker is too conservative in the absence of alias
tracking.  However, it runs counter to the typical behaviour expected of
the compiler.

Disable the hack, thus rejecting more mode-incorrect code but also some
mode-correct code.

Some compiler-generated unify predicates would now be rejected.
We retain the hack only for those predicates.

NOTE: this change exposes some bugs which will be fixed in subsequent
changes.  A few test cases will fail for now: contravariance_poly.m and
some declarative debugging test cases.

compiler/hlds_pred.m:
	Add helper predicate `is_unify_pred'.

compiler/inst_match.m:
	Add a variant of `inst_matches_final_typed' to select if ground
	matches incomplete bound insts.

	Do not allow ground to match incomplete bound insts in
	`inst_matches_final_3' unless explicitly enabled.

	Do not allow ground to match incomplete bound insts in
	`inst_matches_binding_3'.

compiler/modes.m:
	Use lax `ground_matches_bound_always' behaviour for checking the
	final insts of compiler-generated unify predicates only.

NEWS:
	Announce change.
2014-10-10 16:13:35 +11:00
Peter Wang
8ad2428279 Modify solutions module for stricter mode checking.
library/solutions.m:
	Fix mode error in `solutions' predicate in the `multi' mode.
	Convince the compiler with a run-time check that the solution
	list will be non-empty.

	Similarly for `builtin_solutions'.

tests/debugger/declarative/solns.exp3:
tests/debugger/loopcheck.exp3:
	Update expected outputs.
2014-10-10 16:13:34 +11:00
Peter Wang
3f220a0097 Modify exception module for stricter mode checking.
library/exception.m:
	Fix errors that prevent the module from compiling following an
	upcoming change to the mode checker.

	Simplify code by creating higher-order terms from multi-moded
	predicates.  There is no need to switch on the determinism now.

tests/debugger/declarative/catch_retry.exp:
tests/debugger/declarative/catch_retry.inp:
	Update test case.
2014-10-10 16:13:34 +11:00
Peter Wang
f0032d3ae3 Modify code for stricter mode checking.
The following changes are necessary to compile the code following an
upcoming change to the mode checker.  Some of them are mode errors.

browser/declarative_oracle.m:
	The result of `query_oracle_kb' should be specific
	to avoid mode errors in callers.

compiler/accumulator.m:
	Help the compiler infer the declared inst.

compiler/mode_robdd.tfeirn.m:
	`zero' must be declared to return a normalised tfeirn value to
	avoid mode errors.  Change `one' for symmetry.

	`var_restrict_true' and `var_restrict_false' may return
	unnormalised tfeirn values (judging by the code).

	Modify `normalise' to help the compiler infer
	the declared inst.

compiler/tupling.m:
deep_profiler/autopar_find_best_par.m:
	Delete final insts that the compiler cannot verify.

library/tree234.m:
	Help the mode checker out using an explicit switch.

tests/hard_coded/bitmap_test.m:
tests/hard_coded/bitmap_tester.m:
	Add missing modes.
2014-10-10 16:13:34 +11:00
Peter Wang
22d31d95b1 Fix array.sort.
array.sort was broken since 2001 when the implementation was changed
from merge sort to SAM sort.

library/array.m:
	Fix the confusion as to which output argument of samsort_up is
	sorted.

	Add optional runtime checks of the pre- and post-conditions
	of samsort_up and samsort_down when built with a trace flag.

	Add array.sort_fix_2014.

tests/hard_coded/Mmakefile:
tests/hard_coded/array_sort.exp:
tests/hard_coded/array_sort.m:
	Add test program.

NEWS:
	Announce the fix.
2014-10-10 16:11:12 +11:00
Julien Fischer
bed96b93ff Avoid module qualification in library interfaces where possible.
NOTE: this change does not affect the io module -- I've left that for a
separate change.

library/*.m:
	As per the recent change to the coding standard, avoid module
	qualification in library interfaces where possible.

	Reformat declarations and descriptive comments to better utilise
	any space freed up by the above.
2014-10-10 15:08:24 +11:00
Julien Fischer
cd3540c975 Coding standard change: module qualification in library interfaces.
compiler/notes/coding_standards.html:
	Specify that library module interfaces should avoid module
	qualification where possible.

	Minor formatting improvements and (a few) rewordings.
2014-10-10 12:46:49 +11:00
Paul Bone
fea5959ab8 Add an impure_init/0 function to thread.mvar.m
This change renames the init/0 function in thread.mvar.m to impure_init/0;
deprecating the old function.  This makss this module more consistent with
thread.semaphore.m.

Remove the "mvar." prefix where it is unnecessary.

Add %----% separators between some definitions in the implementation
section.

library/thread.mvar.m:
    As above.
2014-10-10 00:57:58 +11:00
Paul Bone
e3c2dfa344 Add a future data type for concurrent and parallel programming
library/library.m:
library/thread.future.m:
library/thread.m:
    Add new future standard library module.

NEWS:
    Announce the new addition.

library/thread.semaphore.m:
    Add an impure interface to thread.semaphore.m.  Semaphores are used to
    implement our other concurrency primitives and an impure interface can
    often be useful to implement things such as futures, which don't require
    IO state threading.  The impure interface predicate names are prefixed
    with "impure_".

library/thread.semaphore.m:
NEWS:
    Deprecate the impure init/1 function.

library/thread.mvar.m:
    Conform to changes in semaphore.m.

benchmarks/progs/mandelbrot/mandelbrot.m:
    Add future example to mandelbrot benchmark.
2014-10-10 00:57:36 +11:00
Peter Wang
33be5c8f72 Restore a fix to handle_inst_var_subs_2.
A previous change improved the precision of inst matching by making
handle_inst_var_subs_2 recurse on the abstract unification of InstA and
SubInstB,

	Recurse(InstA, abstractly_unify_inst(InstA, SubInstB))

The change was temporarily reverted because it is susceptible to
infinite recursion when abstractly_unify_inst returns an inst containing
larger and larger "unify_insts" in each successive call.

compiler/inst_match.m:
	Restore the fix but avoid infinite recursion.

tests/EXPECT_FAIL_TESTS.all_grades:
	Enable invalid/constrained_poly_insts2 again.
2014-10-08 16:39:28 +11:00
Paul Bone
a2879c6837 Make MercuryThreadPool (java) notice when a thread blocks on a semaphore.
If threads are blocked while there is work in the queue extra threads may be
spawned to keep the processors busy.

Beginning now, tasks created with thread.spawn are use the thread pool.
(thread.spawn_native does not use the thread pool.)

java/runtime/Semaphore.java:
    Wrap Java's Semaphore class which call the current thread's blocked()
    and running() methods when a thread blocks and then runs after being
    blocked.

library/thread.semaphore.m:
    Use our own Semaphore class.

java/runtime/MercuryThread.java:
java/runtime/MercuryWorkerThread.java:
    Define blocked() and running() on our threads.

java/runtime/NativeThread.java:
    This class is used by spawn_native/4 and is required to define blocked()
    and running(), however it implements them as no-ops as it isn't included
    in the thread pool.

java/runtime/ThreadStatus.java:
    Define the BLOCKED status.

java/runtime/MercuryThreadPool.java:
    Count blocked threads seperatly and allow the creation of new threads
    when existing threads become blocked.

    Add some tracing code to help debug the thread management code.  This is
    disabled by default.

library/thread.m:
    Implement spawn for Java using the thread pool.  This was not enabled
    earlier because without using java/runtime/Semaphore.java it was
    possible to deadlock the system.

java/runtime/Task.java:
    Add some tracing code to debug thread state changes, this is disabled by
    default.
2014-10-03 19:22:32 +10:00
Paul Bone
bb6407adbe Add spawn and spawn_native parallelisations to the mandelbrot benchmark
The mandelbrot benchmark can now be used to benchmark concurrency support
using either spawn or spawn_native.  As before it can also use no
parallelism or the parallel conjunction operator.

benchmarks/progs/mandelbrot/mandelbrot.m:
    As above.

benchmarks/progs/mandelbrot/bench.sh:
    Update mandelbrot benchmarking script
2014-10-03 19:22:31 +10:00
Paul Bone
a062e9f508 Merge branch 'version-14_01-branch'
Mergeing:
    Fix bug #364: Add a specific cost analysis for nondet disjunctions.
2014-10-03 19:16:20 +10:00
Paul Bone
4a431556b5 Fix bug #364: Add a specific cost analysis for nondet disjunctions.
This bug was caused because we assumed that all disjunctions that the cost
analysis examined were semidet disjunctions.  This patch adds a separate
predicate to calculate the cost of nondet disjunctions, it simply sums up
the costs of the disjuncts.

deep_profiler/autopar_costs.m:
    As above.

deep_profiler/autopar_search_goals.m
    Conform to above changes.

deep_profiler/autopar_search_callgraph.m:
    When the auto-parallelisation analysis of a procedure throws an
    exception print out the identity of the procedure.

NEWS:
    Add news item.
2014-10-03 19:08:58 +10:00
Peter Wang
8e92031e02 Revert a fix for constrained polymorphic modes.
Commit 338b5cb98e changed a call in
handle_inst_var_subs_2, essentially from
	Recurse(InstA, SubInstB)
to
	Recurse(InstA, abstractly_unify_inst(InstA, SubInstB))

Unfortunately, it results in infinite recursion on some cases.

compiler/inst_match.m:
	Revert the change to handle_inst_var_subs_2.

tests/EXPECT_FAIL_TESTS.all_grades:
	Expect constrained_poly_insts2 to fail now.

tests/invalid/constrained_poly_insts3.err_exp:
tests/invalid/constrained_poly_insts3.m:
tests/invalid/constrained_poly_insts4.err_exp:
tests/invalid/constrained_poly_insts4.m:
	Add test cases.
2014-10-02 18:09:17 +10:00
Julien Fischer
8a449332da Use new-style C compiler type for MSVC.
It was intended that the C compiler type string for MSVC would eventually have
the form "msvc_<n>" (where <n> is the version number).  The configure script is
still generating the older form of  string, "cl_<n>"; we want to avoid this
because it's too easy to confuse with clang.  Make configure generate the new
kind of C compiler type string.

configure.ac:
	Generate the new sort of compiler type strings for MSVC.

scripts/mgnuc.in:
compiler/globals.m:
	Do not recognise the old sort any longer.
2014-09-29 17:46:53 +10:00
Julien Fischer
fbbe506c29 Drop support for lcc as a C compiler.
Drop support for lcc as a C compiler.  lcc itself does not seem to have been
updated since around 2010 and Mercury's support for it has not been updated for
quite a while before that.

Derivatives of lcc, for example lcc-win32, would almost certainly need to be
treated separately anyway, so this change doesn't affect them (i.e. they are
already not supported).

configure.ac:
m4/mercury.m4:
	Do not recognise lcc as a C compiler.

	Unrelated change: remove residual support for a.out executables on Linux.

scripts/mgnuc_file_opts.sh-subr:
	Do not define the macros __EXTENSIONS__ and _GNU_SOURCE if the mgnuc script
	is invoked with --no-ansi.  This was originally done to support lcc on Linux.
	Doing so on *all* systems as this code actually does is not a good idea.
	(If it becomes necessary to reinstate this behaviour on some system, it
	should be controlled from the configure script not here.)

runtime/mercury_wrapper.c:
	Delete a workaround for lcc.

scripts/mgnuc.in:
scripts/ml.in:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/globals.m:
compiler/ml_code_gen.m:
	Delete support for lcc.

README.lcc:
	Delete this file.
2014-09-29 17:22:17 +10:00
Paul Bone
89b66d0228 extras/ Update the net library
This library had been neglected for a while and came to my attention when it
used deprecated (or at least old) C interfaces rather than newer reentrant
ones.  I've started to improve this library by giving a more typesafe and
Mercury-esque API, using only reentrant C functions, and eventually adding
support for more protocols, (eg: IPv6 and UDP) better integration with
Mercury's io module and generally making it easier to use.

What's working now:

    + creating sockets,
    + binding and listening,
    + connecting (untested),
    + accepting,
    + closing.
    + The interface is generally more type-safe, using new types suck as
      "socket" and "address" rather than "int" and "c_pointer".

What's not working/incomplete:

    + I havn't yet touched the tcp.m module, but I intend to remove it and
      create a new high-level interface for various protocols.
    + Any kind of reading / writing over sockets at all.
    + Name lookups.
    + A lot of the interface is incomplete / missing useful functions and
      predicates.

This is a work in progress.

Makefile:
    New Makefile.

README.md:
    New Readme file.

net.m:
    net is now a module containing the other modules as submodules.

sockets.m:
    Many changes as described above.

netdb.m:
    This new module contains host and other name lookups.  Only service
    lookups are currently implemented.

types.m:
    Types shared by sockets.m and netdb.m.

echo.m:
    An example echo server.

errno.m:
    strerror functionality.

tcp.m:
    Conform to changes in net.m.
2014-09-29 09:47:49 +10:00
Peter Wang
cb2518ad11 Update expected output for condition_bug test case.
tests/debugger/declarative/condition_bug.exp:
	Update for more accurate context introduced in
	commit 91ce3a67a2
2014-09-25 17:43:43 +10:00
Julien Fischer
07ce739d13 Update bug reporting details in declarative debugger.
browser/declarative_debugger.m:
	Update the details of where to send bug reports.
2014-09-25 16:21:36 +10:00
Julien Fischer
61df175b5d Do not pass -ansi to GCC on any system.
Passing -ansi to GCC restricts us to the C90 dialect of C and prevents us from
using C99 library features with GCC.  Since every version of GCC we support
provides the relevant C99 features there is not much point to imposing this
restriction.  As already noted in the configure script the use of -ansi was
also causing problems with the header files on MinGW systems.  Finally, I do
think it is reasonable to require users to use the C90 dialect of C in
foreign_proc and foreign_code pragma bodies by default.

NOTE: this is *not* an invitation to start using C99 language features
throughout the runtime and library -- at this point, we (unfortunately) still
maintain compatibility with older versions of MSVC that don't support these
features.

configure.ac:
	Do not pass -ansi to GCC.  Add an explanation of why.

scripts/mgnuc.in:
	Update the description of the what the --no-ansi option does.
	(XXX there's _a lot_ of out-of-date stuff in this script.)
2014-09-23 16:03:01 +10:00
Julien Fischer
b0ad0fcb5c Fix broken merge.
NEWS:
	As above.
2014-09-23 15:02:09 +10:00
Julien Fischer
a7e592ba5f Add a NEWS section for 14.01.2.
NEWS:
	As above.
2014-09-23 12:07:52 +10:00
Peter Wang
13eef29826 Add type cast in construction of direct arg functor value.
Add a type cast to the code generated by ml_gen_direct_arg_deconstruct
to construct a value with a direct argument functor.  The cast exists in
the same code generated by ml_gen_direct_arg_construct.

compiler/ml_unify_gen.m:
	As above.
2014-09-23 12:06:41 +10:00
Julien Fischer
88322f59ac Add a NEWS section for 14.01.2.
NEWS:
	As above.
2014-09-22 12:33:14 +10:00
Julien Fischer
fff5759164 Fix problems with gcc -ansi.
runtime/mercury_float.h:
	Only define MR_is_{nan,infinite,finite} as macros on systems that
	support C99.
2014-09-19 20:50:14 +10:00
Peter Wang
62406851e2 Add type cast in construction of direct arg functor value.
Add a type cast to the code generated by ml_gen_direct_arg_deconstruct
to construct a value with a direct argument functor.  The cast exists in
the same code generated by ml_gen_direct_arg_construct.

compiler/ml_unify_gen.m:
	As above.
2014-09-19 17:45:22 +10:00
Peter Wang
fcf6c7971e Rename MR_is_inf_func to MR_is_infinite_func as intended.
runtime/mercury_float.c:
	As above.
2014-09-19 17:36:45 +10:00