Changes between Version 122 and Version 123 of IR


Ignore:
Timestamp:
12/09/15 21:40:17 (10 years ago)
Author:
siegel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • IR

    v122 v123  
    246246* `tuple(S,<e0,e1,...>)` : value of tuple type `S` (tuple literal)
    247247* `tsel(e1,i)` : tuple selection of component i of e1.  i must be a literal natural number.
     248
    248249Unions
    249 
    250250* `union_inj(U,i,x)` : `x` is in `Ti`, result is in the union type `U`
    251251* `union_sel(U,i,y)` : `y` is in `U`, result is in `Ti` (or exception if `y` is not in image of injection from `Ti`)
     
    330330* `ATOMIC_ENTER;`
    331331* `ATOMIC_EXIT;`
    332 * `PARSPAWN p, d, f;` : spawn a sequence of procs
     332* `PARSPAWN p, d, f;` : spawn a sequence of procs, one for each element in a domain
    333333 * `p` has type `Pointer[Proc]`,  `d` has `Domain` type and `f` has `Function` type.
    334 
    335 The CIVL-C code `$parfor(int i,j: dom) S;` is translated into the following:
    336 {{{
    337   var p:Array[Proc];
    338 
    339   fun f(i: Integer, j: Integer)
    340   {
    341     S;
    342   }
    343 
    344   PARSPAWN addr(asub(p,0)), dom, f;
    345   WAITALL addr(asub(p,0)), domsize(dom);
    346 }}}
    347 
     334 * the new procs are entered into `p[0]`, `p[1]`, ..., `p[d-1]`, where `d` is the size of the domain.  Hence `p` must point into an array of `Proc` big enough to hold `d` elements.
     335 * the function `f` must have the following signature: it consumes `n` `Integer`s, where `n` is the dimension of the `Domain` `d`.  It returns nothing.
    348336* `NEXT <i,j,...>, dom, flag;` : move to next element in domain
    349337 * `i`,`j`,... have integral types
     
    354342 * `flag`=`false` in post-state indicates there is no next element
    355343 * `flag`=`true` in post-state indicates the next element is in `<i,j,...>`
     344
     345Notes on translation:
     346
     347The CIVL-C code `$parfor(int i,j: dom) S;` is translated into the following:
     348{{{
     349  var p:Array[Proc];
     350
     351  fun f(i: Integer, j: Integer)
     352  {
     353    S;
     354  }
     355
     356  PARSPAWN addr(asub(p,0)), dom, f;
     357  WAITALL addr(asub(p,0)), domsize(dom);
     358}}}
    356359
    357360The CIVL-C code `$for(int i,j: dom) S;` is translated into the following:
     
    412415}}}
    413416
    414 Function modifiers that may be placed in the brackets after fun:
     417Function modifiers that may be placed in the brackets after `fun`:
    415418* `pure` : the function has no side effects, but may be nondeterministic
    416 * `abstract`: function is a pure, mathematical function: deterministic function of inputs
    417 * `atomic`: function definition is atomic, and it never blocks
    418  * **ISN'T THIS TRUE OF EVERY SYSTEM FUNCTION?  IN WHICH CASE, IS THIS ONLY FOR NON-SYSTEM FUNCTIONS?**
     419 * **DO WE NEED TWO SEPARATE MODIFIERS?  One that says no side-effects, one that says deterministic?  For example, `choose_int` has no side-effects, but is not deterministic.  And a non-deterministic function can NOT be used as an expression.
     420* `abstract`: an uninterpreted function.  The result of a function call on such a function is a symbolic expression "`f(arg1, ...)`".
     421* `atomic`: function definition is atomic, and it never blocks.  A function call to such a function occurs in a single atomic transition.  It is slightly different than a function in which the entire body is atomic, because in the latter case the call and return happen as two separate transitions.
     422 * Since every system function is atomic, this option is only useful for non-system functions.
    419423* `package="..."`: the package where a system function is implemented
    420424* `lib="..."`: function is a system function defined in specified library