In Section 2.8, we mentioned that local variables in a procedure are allocated on the stack. While this description is convenient for keeping the exposition simple, modern compilers work quite differently. This exercise is for you to search the Internet and find out how exactly modern compilers allocate space for local variables in a procedure call. [Hint: Recall that registers are faster than memory. So, the objective should be to keep as many of the variables in registers as possible.]

What will be an ideal response?


As we have already seen many local variables which technically if located in memory would be found on the stack are in reality maintained in registers because of the significant advantage in speed enjoyed by the registers. We have already seen saved and temporary register conventions, argument registers, return value and return address registers. All of these are an attempt to increase speed and efficiency. In addition, modern optimizing compilers employ sophisticated register allocation strategies designed to maximize use of registers. However, arrays and structures are maintained on the stack and not in registers.

Computer Science & Information Technology

You might also like to view...

Photoshop keeps track of all your edits in the ____ panel.

a. Tracking b. Edit c. History d. Redo

Computer Science & Information Technology

What kind of tool can you use to measure voltage on a cable length?

a. continuity tester b. multimeter c. time domain reflectometer d. light meter

Computer Science & Information Technology

What might a dim display mean?

A. The memory is low. B. There is a problem with the display panel. C. An update is available. D. There are too many apps open.

Computer Science & Information Technology

Which of the following is the path to the Compress Media button?

A. (INFO tab | Media Size and Performance section) B. (VIEW tab | Compression group) C. (FILE tab | Media Adjustment area) D. (INFO tab | Video section)

Computer Science & Information Technology