灯下 登录
计算机科学 / SICP / 5.5.5 An Example of Compiled Code

Exercise 5.37 · 习题

Exercise 5.37: One way to understand the

compiler’s preserving mechanism for optimizing stack usage is to see

what extra operations would be generated if we did not use this idea. Modify

preserving so that it always generates the save and

restore operations. Compile some simple expressions and identify the

unnecessary stack operations that are generated. Compare the code to that

generated with the preserving mechanism intact.

练习 5.37:理解编译器用于优化栈使用的 preserving 机制的一种方式,是观察如果不采用这一思路会额外生成哪些操作。修改 preserving,使其始终生成 save 和 restore 操作。编译一些简单的表达式,找出其中生成的多余栈操作。将所得代码与保留 preserving 机制时生成的代码加以比较。