| OCR Text |
Show The code for the compiled evaluation is straightforward which is shown in Figure 4.20. The calculation of D consists of two major parts. These two parts are the calculation of four comparisons and the calculation of three Boolean AND operations. Since the compiled evaluation uses a short cut evaluation of AND operations, which does not perform all comparisons, another type of compiled evaluation was added. This compiled evaluation precalculates comparisons. In this way, the evaluation time for comparisons and the evaluation time for Boolean operations themselves can be distinguished. The code for the compiled evaluation with precalculated comparisons is shown in Figure 4.21. The third method is the interpreted evaluation. The code is shown in Figure 4.22. Array f represents the logical AND operation. It is initialized to f [0] = 0, f [1] = 0, f [2] = 0, and f [3] = 1. Since array f can be initialized to any Boolean operation, f is evaluated in an interpreted fashion. The code for the Unison algorithm is shown in Figure 4.23. Values for fx, fy, D = (PC >' addr_0) && (PC < addr_l) && (memory = addr_2) && (value != 0); Figure 4.20. Compiled Evaluation cl = PC > addr_0; c2 = PC < addr.l; c3 = memory = addr_2; c4 = value != 0; D = cl && c2 && c3 && c4; 112 Figure 4.21. Compiled Evaluation with Precalculated Comparisons |