MCS-388 Homework 4 (Spring 2002)
Due: April 17, 2002
-
Do exercise 5.3 on page 336.
-
Do exercise 8.12 on page 509.
To generate concrete code, you need to know the answers to several questions:
-
How big are the arrays? Are they 10x20, like in the book's example,
or some other size?
-
Do the indices start at 1, 0, or some other lower
bound?
-
How large are the individual array elements? 4 bytes? 8?
Something else?
For all these questions, feel free to either pick some concrete
numbers (like the 10x20), state them, and then work using them, or
give symbolic names to the quantities (like saying the array is NxM,
with K bytes per element) and then give answers that have expressions
containing these symbolic names, even when they really would be
crunched down to a single constant.
-
Chapter 7 suggests using a control link in each activation
record on the stack, which points at the calling activation record.
It also suggests using two pointers: top_sp to point at the
current activation record, and top to point to the current
top of stack. By contrast, the simplified MIPS calling convention
we've been working with just uses a single pointer,
$sp
,
and doesn't save the calling activation record's location into the
current activation record. Explain why these simplifications are
possible.
Course web site: http://www.gac.edu/~max/courses/S2002/MCS-388/
Instructor: Max Hailperin <max@gac.edu>