Object Code Accelerator Manual
Preparing Programs for Acceleration
Object Code Accelerator Manual—528144-003
3-10
Relationship Between Global and Local Data Blocks
};
struct TAG Foo (void); /* function returns type TAG */
struct TAG Foo (void)
{
struct TAG *ATagStruct;
ATagStruct = (struct TAG *) malloc ( sizeof (struct TAG));
ATagStruct->I = 1;
ATagStruct->L = 2;
return *ATagStruct; /* by value */
}
main ()
{
struct TAG TagStruct;
TagStruct = Foo();
printf ( "TagStruct is %d %ld, should be 1 2\n",
TagStruct.I, TagStruct.L);
}
Instead of recompiling, you can use the following RETURNVALSIZE option to produce
a correctly accelerated program:
RETURNVALSIZE 'Foo' 2
Relationship Between Global and Local Data Blocks
Do not assume that global and local data blocks have the same relation to one another
on TNS/E systems as they have on TNS systems. For example, on TNS systems it is
possible to write TAL code that accesses local variables by indexing global variables.
On TNS/E systems, the indexed global variables might not be equivalent to local
variables because of register optimization.
OCA does not detect when programs dangerously manipulate values between the
global and local data blocks. The accelerated code might execute, but the results
would be incorrect.
Required Change
•
You must remove this coding practice from all programs.
Example
•
In the following program, the global variable f, an integer, is accessed as an array
in the local block of the program. OCA does not see the address of the array
access, f[4], as equivalent to the variable c in the local data block.
INT f; ! Global variable
PROC Test MAIN;