Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming language Program foo() {a, b integer; procedure bar(integer x, integer y) {z: integer;/* 0 */z = 3;/* 1 */x = x + y

C programming language

image text in transcribed

Program foo() {a, b integer; procedure bar(integer x, integer y) {z: integer;/* 0 */z = 3;/* 1 */x = x + y + z;/* 2 */y = 1;/* 3 */}//statement body of foo a = 2; b = 5; call bar(a, b); print a, b;} Use the RISC machine instructions load, loadI, loadI, storeAI, add to show the code that needs to be generated for the body of procedure bar (statement (/*1*/through/*3*/). Assume that Formal parameter x is call-by-reference, and formal parameter y is call-by-value. Assume that, bar's parameters x and y have been correctly initialized as part of the procedure call of bar. Use the stack frame layout as shown above. The figure shows the runtime stack when the program execution readies program point/*0*/in procedure bar. What values for a and b does the program print

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions