Disabled crash1callDestructorsMain.chpl for --no-local/gasnet/etc.

This test fails differently under --no-local/gasnet/etc.
so .bad does not match, giving an error.
For simplicity, I am disabling it for those cases, for now.

Once this test starts succeeding for --local,
please enable it for --no-local and re-test.


git-svn-id: svn+ssh://svn.code.sf.net/p/chapel/code/trunk@22672 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Added a missing newline in sub_test.

[reviewed by Kyle]

The lines 

  [Clean match against .bad file ...

were missing newlines at the end, apparently due to mis-indentation -
a couple of statements ended up in the "else" clause instead of being
outside the "if".

While fixing that, I factored out part of the string being printed. 


git-svn-id: svn+ssh://svn.code.sf.net/p/chapel/code/trunk@22673 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Use 'ref' intent on the LHS of most assignments [reviewed by bradc]

Assignment was originally implemented before the 'ref' intent was supported,
which gave rise to the idiom:
  proc =(a, b) return b : a.type;
The compiler automatically adds a 'move' primitive outside of assignment that
effectively overwrites the LHS with the RHS value.
  (= a b)  -->  ('move' a (= a b))

The downside of the old approach, especially with records (and -- by subsumption
-- tuples) is that it performs copies that would not otherwise be necessary:
Assignment between records can be written in terms of updating the fields
within the LHS record; once that is done, the LHS is updated and no copying is
necessary.

Now that the compiler supports the 'ref' intent, it is simple matter to update
an internally-defined type to use assignment-to-reference -- with a few
exceptions.  The transformation from the old style
  inline proc =(a:atomicflag, b:atomicflag) {
    a.write(b.read());
    return a;
  }
to the new style  
  inline proc =(ref a:atomicflag, b:atomicflag) {
    a.write(b.read());
  }
simply involves adding the ref intent to the LHS operand and removing the
return statement.  

It turns out that removing the return statement turns the compiler-added 'move'
primitive into dead code, so it is removed during optimization.  After all
implementations of "proc =()" have been updated to use ref intent with the LHS,
the normalization step which adds the extra 'move' should be removed.

There are a couple of cases where assignment-to-ref cannot yet be used.
My attempt to apply the new signture to internally reference-counted types
results in reference-counting errors, so I backed those changes out.


IMPLEMENTAION

Except for the special cases mentioned above, applying the new signature to
record types "just works".  

In applying the new signature to fundamental types, it was necessary to
describe the data transfer explicitly.  For this purpose, I created a new
'assign' primitive.  The backend translation of 'assign' is exactly the same as
for the matching case of 'move'.  However, creating a separate primitive
allowed me to judiciously add PRIM_ASSIGN (or not) to conditionals in the many
stages of translation -- thus providing an easy way to avoid adding in behavior
currently associated with PRIM_MOVE without first determining that it is
necessary or desirable.  

The ultimate plan is to remove the 'move' primitives that the compiler is
automatically adding around each call to an assignment operator, and then to
deprecate the 'move' primitive completely.

I added a semantic check in checkResolved.cpp, to ensure that the left operand
of an assignment operation ("=" and all of the "<op>=" operators) has 'ref'
intent.  To support this new check, I separated assignment operators from
others in the grammar and added a new flag "assignop".  This makes it easy
to filter for just assignment operators in later stages of compilation.

To satisfy the new semantic check, I had to add ref intent to the definition of
assignment to sync and single types.  This caused assignment to a sync variable
to fail in a few tests, due to the built-in coercion from a sync type to its
base type.  This coercion currently ranks above ref conversion, so given
    (call a:sync(foo) b:foo)
and function definitions
1)  proc =(ref a:sync(foo), b:foo);
2)  proc =(a:foo, b:foo);
The compiler prefers 2) over 1).  I resolved the problem by adding the 'ref'
intent to 2) in the code for the failing test cases, to make it
2)  proc =(ref a:foo, b:foo)
However, the check for the left operand of = having ref intent is conducted
after resolution completes, and the above failure causes resolution to halt
before completion.  This could be a bit confusing, so I recommend making ref
coersion rank above sync(foo) --> foo coersion.

The functions which create compiler-generated (default) versions of enum, union
and record assignment were updated to conform to the new signature.

Beyond the above, most of the changes were in response to assumptions in the
compiler that were violated as a result of going over to the new signature:
 - The post-resolution check that the return value variable obtains a value on
   all paths through a function did not take into account that the value can
   be assigned through a variable passed by reference.  Before, every
   assignment call was surrounded by a move, so all the compiler had to do was
   look for the move and treat that as a definition.  Now it also looks
   to see if the address of the return value variable is taken and passed to a
   function that can define it.  (This tests is weaker than definite assignment
   through a MOVE, because (non-const) 'ref' intent only says that the variable
   "may" be assigned.  For these purposes, fully supporting an 'out ref'
   intent is desirable because it can be used to signal definite assignment.
 - Moved the refPropagation pass after the copyPropagation pass.  An improper
   substitution was occurring in copyPropagation because it does not recognize
   that a variable can be updated through a reference.  This is a workaround.
   I am working on a better implementation of copyPropagation that will avoid
   the problem.
 - Reworked insertYieldTemps() so it works without expecting assignment calls
   to be wrapped in 'move' primitives.


[tested on / (std and --no-local), 
           domains/ distributions/ multilocale/ performance/ (gasnet)
           examples/ (memcheck)
]
There are three regressions in performance, due to increased comm counts for
assignment operations.


DETAILS

    test/demo/review_060130/history_accumulator.chpl
    test/classes/bradc/compilerErrorInMethod/testClear-workaround.chpl
    test/classes/bradc/compilerErrorInMethod/testClear-snap1.chpl
    test/classes/bradc/compilerErrorInMethod/testClear-snap2.chpl
    test/classes/bradc/compilerErrorInMethod/testClear2.chpl
    test/types/records/sungeun/classInRecord.chpl
    test/types/records/hilde/refCountedType.chpl
    test/users/ferguson/recordbug3.chpl
    test/users/ferguson/refcnt.chpl
    test/parallel/taskPar/sungeun/private.chpl
    test/functions/deitz/test_assign1.chpl
    test/functions/jplevyak/equal-9.chpl
    test/functions/jplevyak/equal_method-1.chpl
Updated assignment operators to conform to the new signature.

    compiler/passes/checkResolved.cpp
Rewrote isDefinedAllPaths to track reference variables that are aliases to the
"ret" variable being tracked.  If one of these references is passed through an
argument that has (non-const) 'ref' intent, that is considered a definition.
Specifically, the LHS argument of a new-style "=" operator has 'ref' intent, so
the case that was failing is corrected.
As part of the rewrite, I replaced the obscure recursive implementation with a
more straightforward encoding of the desired logic.  This will help with
debugging, and may also help that pass run a bit faster.  After recoding, I was
able to clearly state the meaning of the integer value that the routine
returns.
Added a check to ensure that the left operand of an assignment or assign<op>
operator has ref intent.
I reordered the functions in the file to be in bottom-to-top,
depth-first order.

    runtime/src/threads/pthreads/threads-pthreads.c
Moved the result returned from pthread_mutex_lock into a local variable, to aid
in debugging.  (This change will have no performance impact.)

    modules/standard/List.chpl
Added proc=(ref a:list, b:_nilType) to capture attempts to promote nil to list
type, and print an error message instead.

    modules-minimal/internal/ChapelBase.chpl
    modules/standard/Buffers.chpl
    modules/standard/Regexp.chpl
    modules/standard/IO.chpl
    modules/internal/ChapelArray.chpl
    modules/internal/ChapelRangeBase.chpl
    modules/internal/ChapelRange.chpl
Partially updated to the new signature for assignment.  ('ref' intent added,
but return statements retained.

    modules/standard/SysBasic.chpl
Updated signatures for syserr and err_t to the new signature.

    modules/dists/DSIUtil.chpl
Added a few comments regarding possible dead code or optimization opportunities.

    modules/internal/Atomics.chpl
    modules/internal/ChapelTuple.chpl
    modules/internal/NetworkAtomics.chpl
    modules/internal/ChapelSyncvar.chpl
Updated all assignment operators to the new signature.

    modules/internal/ChapelBase.chpl
Updated all assignment operators to the new signature.
Added the general proc _cast(type t, x:t) return x; to support using explicit
cast-to-self-type in generic functions.
Added _createFieldDefault(type t:integral, param init:real(?w)) to simulate a
compiler error that used to occur during initialization but now does not.  The
compiler examined the operands of 'move' to determine if a type mismatch
occurred, but now that 'move' is removed in some cases, the function performing
the actual initialization must supply the message.

    compiler/include/build.h
    compiler/AST/build.cpp
Added a new helper function buildFunctionSymbol() to remove verboseness from
the grammar where declarations are matched.

    compiler/include/flags_list.h
Added a new FLAG_ASSIGNOP, to mark each function whose name is one of the
assignment operators.  This permits properties peculiar to assignment operators
to be tested easily.

    compiler/include/primitive.h
    compiler/AST/primitive.cpp
    compiler/AST/expr.cpp
Added and implemented the new 'assign' primitive.

    compiler/include/flags_list.h
    compiler/parser/chapel.ypp
Added the new "assignop" flag.  This is applied in the parser, to distinguish
assignment operators from the others.

    compiler/include/checks.h
    compiler/main/checks.cpp
    compiler/include/log.h
    compiler/main/passlist.h
Moved copyPropagation before refPropagation as a temporary workaround for the
current implementation of copyPropagation failing to handle
definition-through-reference correctly.

    compiler/include/expr.h
Added a descriptive comment to methodTag.

    compiler/AST/astutil.cpp
    compiler/AST/checkAST.cpp
    compiler/AST/iterator.cpp
    compiler/passes/normalize.cpp
    compiler/passes/flattenFunctions.cpp
    compiler/passes/parallel.cpp
    compiler/optimizations/scalarReplace.cpp
    compiler/optimizations/loopInvariantCodeMotion.cpp
    compiler/optimizations/optimizeOnClauses.cpp
    compiler/optimizations/copyPropagation.cpp
    compiler/optimizations/deadCodeElimination.cpp
    compiler/optimizations/narrowWideReferences.cpp
Added PRIM_ASSIGN to predicates as needed.
Or added comments where they might be needed, but no compelling cases
encountered yet.

    compiler/AST/type.cpp
Added the "extern" flag to gFile and gOpaque to prevent the "&NULL" absurdity
in the generated C code.

    compiler/resolution/functionResolution.cpp
Removed the test that the LHS of an assignment is of value type.  This allows
the LHS argument to be passed (alternatively) by reference type.  I suppose
this would be the place to make it obligatory.
Work around the requirement that the LHS arg have a type at SysBasic.chpl:150.
Add a comment that field initialization should not involve assignment (part of UMM).

    compiler/resolution/callDestructors.cpp
Reimplemented insertYieldTemps() so it no longer expects assignment to the
yielded variable to be surrounded by a 'move'.


    compiler/optimizations/optimizeOnClauses.cpp
Removed dead code.  I added an assert earlier that this code is never reached,
and it has not fired during several months of testing.


TODOS
o Get assignment-to-ref to work with tuples and internally reference-counted
  types.  This means recoding the implementation of proc =() for those types so
  that none contain a "return" statement.  Cases that remain are
    proc =(ref a: _distribution, b: _distribution) {
    inline proc =(ref a: [], b) {
  and tuple assignment functions created during generic instantiation.
o Once those are done, remove the compiler-added 'move' primitives.
o Rework copy propagation so it handles references correctly. (This work is
  already in progress.)
o Add a new intent 'out ref' to indicate that an argument passed by reference
  will definitely be assigned.  Then, update all proc =() definitions so the
  left operand has this new intent.
o In disambiguation, make foo --> _ref(foo) coercion rank above sync(foo) -->
  foo coercion.


git-svn-id: svn+ssh://svn.code.sf.net/p/chapel/code/trunk@22674 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Use mkpath instead of make_path in nightly.

mkpath is deprecated, but we use an older version of perl on our linux servers that does not have make_path. Sigh.

git-svn-id: svn+ssh://svn.code.sf.net/p/chapel/code/trunk@22675 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Updating the release version of spectralnorm.  Now its config matches that of
the other shootouts, and the method declaration and for loop use style is
unified across the file.



git-svn-id: svn+ssh://svn.code.sf.net/p/chapel/code/trunk@22676 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Add a test to demo the errorDepth functionality of compilerErrors

This test demonstrates the use of the compilerError() errorDepth argument.


git-svn-id: svn+ssh://svn.code.sf.net/p/chapel/code/trunk@22677 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Removed the versions of mandelbrot which are not shootout candidates from the
performance graph and made a separate one for all versions, since the comparison
still remains interesting.



git-svn-id: svn+ssh://svn.code.sf.net/p/chapel/code/trunk@22678 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Fix parnodefile name for chap07.

git-svn-id: svn+ssh://svn.code.sf.net/p/chapel/code/trunk@22679 3a8e244f-b0f2-452b-bcba-4c88e055c3ca
Update paratest.server to terminate eventually, even if remote nodes hang. [reviewed by tvandoren]This version keeps track of when a worker was last fed, and considers it to be dead
if the timeout interval (initially 20 minutes) as elapsed with no reply.

[tested on examples/]


git-svn-id: svn+ssh://svn.code.sf.net/p/chapel/code/trunk@22680 3a8e244f-b0f2-452b-bcba-4c88e055c3ca