The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+15 votes
1.8k views

Faster access to non-local variables is achieved using an array of pointers to activation records called a 

  1. stack
  2. heap
  3. display
  4. activation tree
asked in Compiler Design by Veteran (59.6k points) | 1.8k views
0
anyone plz explain it!

1 Answer

+25 votes
Best answer

it is C

properties of displays    

  1. Use a pointer array to store the activation records along the static chain.
  2. Fast access for non-local but may be complicated to maintain.
  3. Calling a subprogram in the same level – simply replace and restore.
  4. Calling a subprogram in the higher level – add an entry and may need to save the old pointers.
  5. Calling a subprogram in the lower level – shrink the pointer and restore it when the subprogram returns.

http://users.dickinson.edu/~wahlst/356/ch10.pdf

answered by Active (2.1k points)
edited by
+27
If a variable or a code or block or anything, that is not in my function but in other function, Then my function will use "access link" of Activation record to access them.

Displays are an optimization technique that replaces access links. There are implemented as an array (of pointer) in this array each entry points to one of the activation records.
The size of the array is the maximum nesting depth in the program

use: if disp is the display, then disp[i] points to the activation record associated with the current
scope at nesting depth i.

Now if function j wants to access something that is in function i then
Step-1: go to the activation record pointed to by disp[i]
Step-2: find the nonlocal via an offset in this activation record
0
@sachin can you please provide some reference for display. I know nothing about them. But i'm seeing few question about them. Thank You.
0
@Hemant-Ullman 2ed compilers
+2
adding info to above comment ullman page 432
0
nice point sachin sir


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

41,146 questions
47,708 answers
147,671 comments
62,405 users