Added other task intents.
Follow-up on reviewer comments and a tweak to a test
Merge pull request #1042 from vasslitvinov/more-task-intents

Added other task intents.
Specifically: blank, const, in, const in, const ref.
Also, changed how 'ref' intent is implemented.

HIGHLIGHTS

* Task intents are now implemented via passing the outer variables
as arguments to task functions during createTaskFunctions().
Before this change 'ref' intents were implemented by hiding
the corresponding variables from task intents altogether.
They remained references to Symbols in the outer scopes
and converted to arguments during flattenNesteFunctions().

* The contents of byrefVars changed to allow the parser to
convey the intents to createTaskFunctions() and implementForallIntents.

* For now, only 'ref' forall intents are allowed.
This is to stage my work, as I am not sure that those other
forall intents work correctly.

COMPILER DETAILS

* I am using "tiMarkXXX" ArgSymbols to pass the contents of with-clauses
  from the parser to createTaskFunctions and to resolution,
  where that information is consumed.

  The parser builds byrefVars as a CallExpr, as before. The change
  in this commit is that the CallExpr has twice as many actuals.
  If the with-clause is (INTENT1 VAR1, INTENT2 VAR2), then the actuals are:
    tiMarkForIntent(INTENT1), VAR1, tiMarkForIntent(INTENT2), VAR2

Reviewer comment: I'm not enthused about this re-use of PRIM_ACTUALS_LIST with a different internal format. I think it would be cleaner to invent a different primitive to represent this construct. That way, the format of each can be documented with precision.
    Mike Noakes has been going about representing loop constructs more directly in the AST, rather than the somewhat crafty and hidden way of representing them using a blockInfo CallExpr. So you might think about assisting this effort by converting the taskIntentList to a first-class AST element.

* I placed tiMarkForIntent() in symbol.h.
  This is to make it is accessible in chapel.ypp.

* I added code to avoid counting variables in with-clause as "outer"
  for forall intents. That way the variables referenced in a with-clause
  and not in the loop body are not considered. This is a nicety,
  should not affect the semantics, and should be rarely noticeable.

TEST CHANGES

* I replaced sleep() with sync variables in the following test:

    test/parallel/begin/deitz/test_global_for_begin.chpl

  to comply with our memory consistency model, which our compiler
  optimizations started to rely on more aggressively. E.g. in this code:

    var j = 0;
    cobegin with (ref j) {
      { sleep(1); writeln(j); }
      j = 3;
    }

  the compiler can legally optimize writeln(j) to writeln(0).
  See the spec for details.

* I deleted the following test:

    test/multilocale/vass/coforall-ref-private.chpl

This test verified that updating a pragma-"private" global variable
within a coforall+on worked as expected. I.e. that locale-private
copies of that variable get updated. This was needed to initialize
rootLocale.

This, correctly, no longer works that way. Thankfully, we do initialize
rootLocale in that manner any more, making this test irrelevant.

Reviewed by Tom.