Accelerator Manual (G06.27+, H06.04+, J06.03+)

Accelerator Performance Issues
Accelerator Manual527303-003
6-11
Dynamic Procedure Calls
Examples
The dynamic procedure calls in C:
void callbell (void (*bell) (void)) {
(*bell) ();
}
void callfun (int (*fun) (int val)) {
int result;
result = (*fun) (4);
...
}
The dynamic procedure calls in TAL:
PROC callbell (bell);
PROC bell;
BEGIN
CALL bell;
END;
PROC callfun (fun);
INT PROC fun;
BEGIN
INT result;
result := fun (4);
...
END;
The Accelerator emits the following note after processing the preceding procedures:
Note 3: The Accelerator was not able to determine return
value size of the following dynamic procedure calls in your
program:
Call at offset 01 in proc 'callbell'; guessed return size 0
Call at offset 04 in proc 'callfun'; guessed return size 1
The Accelerator predicts that the function Fun called in Callfun returns one 16-bit word
because the Accelerator finds a store to variable Result just after the call. The
procedure Bell called in Callbell is not followed by a store, so the Accelerator predicts
that it returns no value. These dynamic procedure calls remain in accelerated code
because the Accelerator can predict their return values. Likewise, if the function Fun
were used in a comparison, as in most arithmetic expressions, or as a return value, the
Accelerator would predict that it returns one 16-bit word.