Question: For the following problems, consider the following program: void main) int x; double y; float f; //some computations f = foo(x y) ; f +-

For the following problems, consider the following program: void main) int x; double y; float f; //some computations f = foo(x y) ; f +- bar(x, y); //some computations float foo(int a) 0 double g; g bar (a, a) ; return g; double bar(int r, int s) t float h; h=1.0 * (r + s); if (r == s) { double q = 2.0; return h; 1. Assume your program is running on a machine with 4 registers, using callee saves Assume addresses (i.e., pointers) are 8 bytes, floats are 4 bytes, ints are 4 bytes, and doubles are 8 bytes. Draw the complete stack (i.e., the stack including all active activation records) for the program right after foo has called bar, and before bar returns. For each slot in the stack, indicate what is stored there, and how much space that slot takes up 2. Now assume that the call signature for bar is double bar (int &r, int &s) (in other words, bar is now a pass-by-reference call). Draw the call stack right after main calls bar, and before bar returns For the following problems, consider the following program: void main) int x; double y; float f; //some computations f = foo(x y) ; f +- bar(x, y); //some computations float foo(int a) 0 double g; g bar (a, a) ; return g; double bar(int r, int s) t float h; h=1.0 * (r + s); if (r == s) { double q = 2.0; return h; 1. Assume your program is running on a machine with 4 registers, using callee saves Assume addresses (i.e., pointers) are 8 bytes, floats are 4 bytes, ints are 4 bytes, and doubles are 8 bytes. Draw the complete stack (i.e., the stack including all active activation records) for the program right after foo has called bar, and before bar returns. For each slot in the stack, indicate what is stored there, and how much space that slot takes up 2. Now assume that the call signature for bar is double bar (int &r, int &s) (in other words, bar is now a pass-by-reference call). Draw the call stack right after main calls bar, and before bar returns
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
