next up previous contents index
Next: Floodable Regions Up: Regions Previous: Restrictions on Regions

Dynamic Regions

     

Dynamic regions are anonymous regions whose index sets need not be known until runtime. In the example below, i and M are integers:

    procedure f(i: integer);
    begin
[i, 1..M]  A := B;              -- copy the i_th row of B to the i_th row of A
    end;
The bounds of a dynamic region are fixed before its corresponding body of code is executed. Thus, in the following procedure the dynamic region is set to the 3 tex2html_wrap_inline2337 row of the index space even though the variable i is modified in the body of the code.

    procedure g();
    var i: integer;
    begin
        i := 3;
[i, 1..M] 
        begin
            i := i+1;           -- this does not affect the dynamic region
            A := B;             -- copy the 3_rd row of B to the 3_rd row of A
        end;
    end;
The bounds of a dynamic region can be arbitrary expressions that evaluate to integers. In particular, region bounds cannot be parallel arrays, so the following is illegal:

    var A : [R] integer;

    . . .
[i, 1..A]  B := C;              -- illegal because A is a parallel array.
The of operator may not be used in conjunction with dynamic regions.

Dynamic regions incur somewhat higher cost than statically defined regions, so static regions should used be whenever possible.



Kay Nettle
Fri Feb 21 21:14:29 CST 1997