Exercise 5.31: In evaluating a procedure
application, the explicit-control evaluator always saves and restores the
env register around the evaluation of the operator, saves and restores
env around the evaluation of each operand (except the final one), saves
and restores argl around the evaluation of each operand, and saves and
restores proc around the evaluation of the operand sequence. For each
of the following combinations, say which of these save and
restore operations are superfluous and thus could be eliminated by the
compiler’s preserving mechanism:
(f 'x 'y)
((f) 'x 'y)
(f (g 'x) y)
(f (g 'x) 'y)
练习 5.31:在对过程应用求值时,显式控制求值器总是在对运算符求值的前后保存和恢复 env 寄存器,在对除最后一个运算对象之外的每个运算对象求值的前后保存和恢复 env,在对每个运算对象求值的前后保存和恢复 argl,并在对运算对象序列求值的前后保存和恢复 proc。对于以下每个组合式,请说明其中哪些 save 和 restore 操作是多余的,因而可以被编译器的 preserving 机制消除:
(f 'x 'y)
((f) 'x 'y)
(f (g 'x) y)
(f (g 'x) 'y)
(f 'x 'y)
((f) 'x 'y)
(f (g 'x) y)
(f (g 'x) 'y)