12.2.4 Compiling a Procedure | Summary and Q&A

1.2K views
July 12, 2019
by
MIT OpenCourseWare
YouTube video player
12.2.4 Compiling a Procedure

TL;DR

This content explains how procedure calls work, including the actions taken by the caller and callee, as well as the management of activation records and stack frames.

Install to Summarize YouTube Videos and Get Transcripts

Questions & Answers

Q: What actions does the caller take during a procedure call?

The caller pushes argument values onto the stack in reverse order and branches to the callee's entry point, placing the return address in the linkage pointer.

Q: What actions does the callee take during a procedure call?

The callee performs the intended computation, leaving the result in R0, and removes any items it has placed on the stack. It then jumps to the return address to transfer control back to the calling procedure.

Q: What is the responsibility of the caller regarding argument values?

The caller is responsible for removing the argument values from the stack, as they were pushed onto the stack by the caller.

Q: What registers are preserved by the callee for the caller's use?

All registers except R0 are preserved by the callee, so the caller can assume that any values placed in registers before a nested call will remain there when the nested call returns.

Summary & Key Takeaways

  • Procedure calls involve the caller pushing argument values onto the stack in reverse order and branching to the callee's entry point, with the return address placed in the linkage pointer.

  • The callee performs the intended computation, leaving the result in R0, and removes any items it has placed on the stack.

  • The caller is responsible for removing the argument values from the stack, and all registers except R0 are preserved for the caller's use.

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Explore More Summaries from MIT OpenCourseWare 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on: