Sunday, October 7, 2012

Rev 3.5 alpha 0.5 release of ParaSail

We just released a new version (3.5 alpha 0.5) of the ParaSail compiler and virtual machine, available at the same URL as before:

We have added some improved statistics to the virtual machine interpreter related to work stealing and region usage, and a command "stats" to view the statistics without exiting the interpreter, and "stats clear" to view and zero-out the statistics.  We will shortly be posting another blog entry about some of the more interesting results of these new statistics.

Additional updates in this release:
  • The conditional expression "(if X then Y)" is now equivalent to "(if X then Y else null)"
  • We now use the "<|=" operator, if available, when building up an aggregate with an iterator inside, such as "[for I in 1..10 => I*5]".  Before we used the "var_indexing" operator instead if both "<|=" and "var_indexing" were available, using the value of "I" as the index.  This didn't make much difference when building up a vector, but was somewhat limiting in other cases.
  • We now allow "reverse" when defining an aggregate with an iterator, such as "[for I in 1..10 reverse => I * 5]," allowing the creation of a reverse-order vector, for example.
  • We have fixed a bug which meant that certain annotations were ignored if they immediately preceded or followed a call on an operation.

1 comment:

  1. We just replaced this with rev 3.5.1, which backs out the change preferring "<|=" over "var_indexing" when building an aggregate using an iterator. This caused problems with existing code such as:

     var Flags : Array<Boolean, Indexed_By => Integer> :=
      [for I in 2..100 => #false];

    An explicit "forward" or "reverse" preceding the "=>" will give a preference to use of "<|=".

    Note that it is always possible to specify the desired index to use explicitly in such an aggregate, such as:
      [for I in 2..100, I => #false]

    in which case "var_indexing" (with Index of "I") will necessarily be used.

    This can be particularly useful when building up a more general map rather than a simple array, e.g.:
      [for I in 1..10, Keys[I] => Values[I]]

    A little background here might help: "<|=" adds a value onto the end of a container (be it a vector, a set, or some similar structure). "var_indexing" is called when using container indexing on the LHS of an assignment, such as:

      C[I] := E;

    The difference between "var_indexing" which is used in this context (and when building up a container aggregate using "named" rather than positional notation), and "indexing" which is used when doing a "normal" indexing into a container (e.g. simply "C[I]" not on the LHS) is that "var_indexing" will add the element to the container using the given index if it doesn't exist, while "indexing" requires an element with the given index already exist in the container. (Note that if there is no "var_indexing" operator provided for a given type, then a call on the "indexing" operator will be generated by the compiler, even on the LHS of an assignment, and the container must already have an element with the given index.)

    As part of this minor update, we also removed the "var_indexing" operator from Vector and ZVector, as the normal "indexing" operator is generally adequate, and the "<|=" (or "|=") operator is a less confusing way to add new elements to the end of a vector.