230 An Introduction to Compiler Construction in a Java World
Run-Time Stack
Our run-time stack conforms to the run-time convention described for SPIM in [Larus,
2009] and our Section 6.2.4. Each time a method is invoked, a new stack frame of the type
illustrated in Figure 6.5 is pushed onto the stack. Upon return from the method, the same
frame is popped off the stack.
When the caller wants to invoke a callee, it does the following:
1. Argument passing. The first four arguments are passed in registers $a0 to $a3. Any
additional arguments are pushed onto the stack and thus will appear at the beginning
of the callee’s stack frame.
2. Caller-saved registers. Registers $a0 to $a3 and $t0 to $t9 can be used by the callee
without its having to save their v