sp05-sw-efa - ECE 3035A 11:00am 5 problems 7 pages Computing Mechanisms Final Exam Spring 2005 2 May 2005 Instructions This is a closed book closed note

# sp05-sw-efa - ECE 3035A 11:00am 5 problems 7 pages...

This preview shows page 1 - 4 out of 7 pages.

ECE 3035A 11:00am Computing Mechanisms Spring 2005 5 problems, 7 pages Final Exam 2 May 2005 1 Instructions: This is a closed book, closed note exam. Calculators are not permitted. If you have a question, raise your hand and I will come to you. Please work the exam in pencil and do not separate the pages of the exam. For maximum credit, show your work. Good Luck! Your Name ( please print ) ________________________________________________ 1 2 3 4 5 total 28 32 24 28 28 140
ECE 3035A 11:00am Computing Mechanisms Spring 2005 5 problems, 7 pages Final Exam 2 May 2005 2 Problem 1 (2 parts, 28 points) Activation Frames Part A (20 points) The function Bar (below left) calls function Foo after completing code block 1 . Write MIPS assembly code that properly calls Foo . You should include all instructions between code block 1 and code block 2 . Symbolically label stack entries (below right). int Bar() { int A, B, C; (code block 1) A = Foo(A, &B) (code block 2) } Bar’s FP 9900 9896 A 9892 B 9888 C 9884 9880 9876 9872 9868 label instruction comment Part B (8 points) short answer: Explain why an activation frame cannot be fully allocated by a called function. Give two reasons why a function’s local variables cannot be statically allocated. 1. 2.
ECE 3035A 11:00am Computing Mechanisms Spring 2005 5 problems, 7 pages Final Exam 2 May 2005 3 Problem 2 (4 parts, 32 points) Heap Manager Implementation Consider the following fragment from the HeapManager baseline implementation. Recall that \$2 is the freed object pointer and \$3 is the free list. beq \$3, \$0, Label1 # I01 add \$6, \$3, \$0 # I02 lw \$4, -4(\$2) # I03 lw \$5, -4(\$3) # I04 slt \$5, \$5, \$4 # I05 bne \$5, \$0, Label3 # I06 Label1: sw \$3, 0(\$2) # I07 add \$3, \$2, \$0 # I08 beq \$0, \$0, Label5 # I09 Label2: add \$6, \$7, \$0 # I10 Label3: lw \$7, 0(\$6) # I11 beq \$7, \$0, Label4 # I12 lw \$5, -4(\$7) # I13 slt \$5, \$5, \$4 # I14 bne \$5, \$0, Label2 # I15 Label4: sw \$7, 0(\$2) # I16 sw \$2, 0(\$6) # I17 Label5: Part A (8 points) Describe the conditions when I07-I09 execute and what they accomplish in terms defined in the project specification (e.g., object deallocation, requested size, free list)

#### You've reached the end of your free preview.

Want to read all 7 pages?

• Fall '08
• Staff
• Virtual memory, Mechanisms Final Exam