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.
Add a NEWS section for 14.01.2.

NEWS:
	As above.
Revert a fix for constrained polymorphic modes.

Commit 338b5cb98e8abd320aac6d3619f8ab98f773c846 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.
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.
Merge branch 'version-14_01-branch'

Mergeing:
    Fix bug #364: Add a specific cost analysis for nondet disjunctions.
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
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.