User`s guide
Developing an Application [3]
Continuations are normally allocated and deallocated from the heap. However, if
the associated future variable is a scalar variable that is located on the stack, the
compiler causes the continuation to be placed on the stack. This reduces the overhead
associated with allocation and deallocation operations.
The compiler does not do this when there is an array of future variables on the
stack because this requires an array of continuations. Continuations can be large
so an array of continuations might cause the stack size to become very large. You
can force the compiler to place an array of continuations on the stack by using the
stack_continuations attribute in your application. This may improve the
performance of the application.
The attribute has the following syntax:
__attribute__((stack_continuations))
You can add this attribute to any future-qualified stack-based array declaration in
your application.
void myFutures()
{
future int children[10] __attribute__((stack_continuations));
// ...
}
Another way to improve performance is by employing the autotouch compilation
mode. This compilation mode automatically applies the touch generic whenever a
future variable is referenced. There are three ways to use autotouch:
The -autotouch compiler flag enables autotouch for all source modules compiled
with the flag.
The pragma directive mta autotouch can be applied to a single source module.
The on option enables automatic touching, the off option disables automatic
touching, and the default option reverts the autotouch mode to the default mode
for that source module, which was determined by the compile-line flags.
The gcc-style attribute future int foo$ __attribute__ ((autotouch
(on|off))); allows you to change the autotouch mode on a per-variable
basis. For example, future int foo$ __attribute__ ((autotouch
(on))). The on option enables autotouch for all references to this variable,
regardless of the current command-line flags or pragmas. Similarly, the off option
disables autotouch for all references to the variable. This attribute generates a
warning if it is applied to a variable without the future qualifier.
S–2479–20 33