This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ¯ ¯ Store the value of y in its own stack frame before calling Q. When Q returns, it can then retrieve the value of y from the stack. Store the value of y in a callee save register. If Q, or any procedure called by Q, wants to use this register, it must save the register value in its stack frame and restore the value before it returns. Thus, when Q returns to P, the value of y will be in the callee save register, either because the register was never altered or because it was saved and restored.
GCC Most commonly, and reads. uses the latter convention, since it tends to reduce the total number of stack writes Practice Problem 3.15:
The following code sequence occurs right near the beginning of the assembly code generated by for a C procedure:
1 2 3 4 5 6 7 8 9 GCC pushl %edi pushl %esi pushl %ebx movl 24(%ebp),%eax imull 16(%ebp),%eax movl 24(%ebp),%ebx leal 0(,%eax,4),%ecx addl 8(%ebp),%ecx movl %ebx,%edx We see that just three registers (%edi, %esi, and %ebx) are saved on the stack. The pro...
View Full Document
- Spring '10
- The American