The Gateway to Computer Science Excellence
+19 votes

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
in Compiler Design by | 3.3k views
anyone plz explain it!

1 Answer

+35 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.

edited by
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
@sachin can you please provide some reference for display. I know nothing about them. But i'm seeing few question about them. Thank You.
@Hemant-Ullman 2ed compilers
adding info to above comment ullman page 432
nice point sachin sir

thnx @Sachin Mittal 1 sir


Related questions

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
52,345 questions
60,484 answers
95,290 users