CSCI 310 Spring 2005 Day 25
- Administrivia
- PL: 10:30?
- Project 4 demos
- Frames
- Given code, walk through the
process and layout the frames.
- Using registers and doing parameter passing.
- We try to pass everything in registers instead of using the stack.
- so the stack is a "dump as necessary" area.
- What we can put in registers depends on the architecture.
- MIPS has, among others, registers
- function result (V0)
- arguments (A0 - A3)
- caller-saved registers (registers you need to dump if you don't want to lose the info) T1-T8
- callee-saved registers S0-S8
- static link (for the this parameter) (SL)
- stack pointer (SP)
- Frame pointer (FP) (callee-save)
- return address (RA)
- Implementing the Frame class
- The issues
- want it to be semi-architecture independent
- there's a Frame class holding info about
- Accesses which represent space for locals and
params.
- Accesses may be stored in the frame, or in the
registers. [When *must* it be in the frame rather than
register?]
- but we don't want to commit particular registers
yet!
- and that means we just track "temporary"
addresses/registers, and "labels" to track labels
we'll want in machine language (like method names).
- Walk through some code; turn it into an AST; decide how
to visit it and assign Frames to each method.
Gary Lewandowski
Last modified: Wed Mar 16 09:49:09 EST 2005