Download presentation
Presentation is loading. Please wait.
1
Programming Languages and Paradigms
Activations The figures in these slides are taken from the Sethi Textbook
2
Activation Records Revisited
Activation record (or frame): contains the data needed for the activation of a routine Layout conventions depend on the language Nested calls Recursion 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
3
Activation Records in C
6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
4
Activation Records in Pascal
6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
5
Nested Calls Suppose the functions main and f are defined as follows:
void main() { f(); g(); } void f() { g(); } There are two different activations of g() when the program executes g f main g main 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
6
Recursion Activation records using runtime stacks support recursion
Recursive calls create separate activations of the function Example: binary search 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
7
6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
8
6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
9
Links in Activation Records
Control links provide access to calling frames Used to restore to calling frame when the called routine completes Access links provide access to non-local data In the next example, take note of the data that the procedures need access to 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
10
6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
11
6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.