The Gateway to Computer Science Excellence
+1 vote
1.8k views
Can anybody explain me access link and control link in activation record?I am confused what is different between them

IF POSSIBLE GIVE EXAMPLE ALSO

THANKS A LOT
in Compiler Design by | 1.8k views
+4
control link is used to return back to the scope of caller function..

access link is used to access data from the scope where the function(the function whose activation record is currently processed) is defined..
0
Please can u explain by an example :)

THANKS
+1

@Himanshu Goyal,

main() {
    int x, y;
    #Calling a function
    fun();
}

fun() {
    #Function called from main()
    return;
}

During the function call fun(), if the function wants to access the variables x, y (statically scoped) of it's calling function i.e main(), it makes the use of access link.

Now when this function fun() terminates/returns, it's activation record is popped from the stack and the control is given back to the main() function. This is done using the control link.

Please correct me if I'm wrong anywhere.

0

@Akash Mishra Your first line is completely wrong.

Access link is defined for the static and not dynamic.

Read @joshi_nitish comment.

0

@`JEET, yes, thank you. I'll correct it.

1 Answer

+1 vote

control link from record A points to the previous record on the stack. The chain of control links traces the dynamic execution of the program.

An access link from record A points to the record of the closest enclosing block in the program. The chain of access links traces the static structure (think: scopes) of the program.

Source: https://www.cs.hmc.edu/~benw/teaching/notes/activation.html

by

Related questions

+1 vote
1 answer
2
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,375 questions
60,582 answers
202,000 comments
95,401 users