: Modern machines try to execute many instructions at the same time, including branching instructions. Thus, there is a severe cost if the machine speculatively follows one branch, when control actually goes another way (all the speculative work is thrown away). It is therefore desirable to minimize the number of branches. Notice that the implementation of a while-loop in Fig. 6.35(c) has two branches per interation: one to enter the body from the condition B and the other to jump back to the code for B. As a result, it is usually preferable to implement whil e (B) S as if it were if (B) { repea t S until \(B) }. Show what the code layout looks like for this translation, and revise the rule for while-loops in Fig. 6.36.
Fig. 6.36
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here