|
|
|
|
|
|
The preceding dynamic instruction count represents the number of instructions between a procedure call instruction and a procedure return instruction. It is not the same as procedure size, since often procedures call other procedures before a return. |
|
|
|
|
|
|
|
|
Calls are expensive. For a simple load/store machine, the following instructions (call and corresponding return) are typically associated with each procedure entered: |
|
|
|
|
Call/return | | instructions | Local stack adjustment | | instructions | Parameter passing | | instructions | Register saves/restores | | instructions | | | instructions | Total cost per call/return pair | | instructions |
|
|
|
|
|
|
Thus, each time a call and return is invoked, about ten additional instructions are required to support it. These instructions are usually of the load/store/increment/register move type. The use of load multiple/store multiple instructions reduces the number of instructions for save and restore (but not necessarily the amount of time involved with this activity). It would, for example, reduce the 4.8 instructions to 2 instructions. Similarly, the use of register windows eliminates the register save and restore cycles as well as some time associated with parameter passing. The elimination of the time associated with register save and restore does not eliminate the time associated with the call activity, as the local stack adjustment must be done as before. Also as pointed out by Loboz [186], the use of techniques such as in-line expansion of procedures can significantly change the call frequency and resulting call overhead. He reports changes of about 40% in the mean number of instructions between procedure calls by using such techniques. |
|
|
|
|
|
|
|
|
The depth of procedure nesting can be important if the architecture includes register windows or a version of a stack cache buffer. Unfortunately, the degree of nesting is widely variable from program to program and even for different runs of the same program [186]. Additionally, operating system structure may have a significant impact on this depth as well. For one cited program Loboz found that the minimum nesting depth was 3 and the maximum depth was 1,004, with a dynamic profile depending strongly on the input. Fortunately, it appears that the relative call depth seems to be not nearly as volatile as the absolute depth [275], and this is the principle upon which register windows and similar techniques rest. (However, the success of register windows still depends on aspects of the operating system.) |
|
|
|
|
|
|
|
|
The net effect of all this on performance models can be summarized as follows: |
|
|
|
|
|
|
|
|
1. Call frequency generally is relatively low1 to 3% of HLL actions (i.e., about ½% to 1% of machine instructions). |
|
|
|
|
|
|
|
|
2. The variance, however, in frequency of calls is large, and thus some programs may exhibit frequencies as high as 10 or 12%, while others have frequencies of much less than 1%. |
|
|
|
|
|