Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation...
28
1 Topic 5: Activation Records COS 320 Compiling Techniques Princeton University Spring 2018 Prof. David August
Transcript of Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation...
![Page 1: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/1.jpg)
1
Topic 5: Activation Records
COS 320
Compiling Techniques
Princeton University Spring 2018
Prof. David August
![Page 2: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/2.jpg)
2
Activation Records
![Page 3: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/3.jpg)
3
The Stack
![Page 4: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/4.jpg)
4
Example
![Page 5: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/5.jpg)
5
Example
![Page 6: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/6.jpg)
6
Example
![Page 7: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/7.jpg)
7
Recursive Example
![Page 8: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/8.jpg)
8
Recursive Example
![Page 9: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/9.jpg)
9
Recursive Example
![Page 10: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/10.jpg)
10
Functional Languages
![Page 11: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/11.jpg)
11
Functional Languages
![Page 12: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/12.jpg)
12
Functional Languages
![Page 13: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/13.jpg)
13
Stack Frame Organizations
![Page 14: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/14.jpg)
14
Typical Stack Frame
![Page 15: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/15.jpg)
15
Stack Frame Example
![Page 16: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/16.jpg)
16
Stack Frame Example
![Page 17: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/17.jpg)
17
Stack Frame Example
![Page 18: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/18.jpg)
18
Parameter Passing
![Page 19: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/19.jpg)
19
Parameter Passing
![Page 20: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/20.jpg)
20
Registers
![Page 21: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/21.jpg)
21
Registers
![Page 22: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/22.jpg)
22
Registers
![Page 23: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/23.jpg)
23
Return Address and Return Value
![Page 24: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/24.jpg)
24
Frame Resident Variables
![Page 25: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/25.jpg)
25
Static Links
![Page 26: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/26.jpg)
26
Static Links
![Page 27: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/27.jpg)
27
Static Links
![Page 28: Topic 5: Activation Records - Princeton University Computer Science · 2018. 5. 1. · Activation records must be allocated on heap, not stack. Concentrate on languages which use](https://reader033.fdocuments.in/reader033/viewer/2022060100/60b0b0cd0221544fc734b75d/html5/thumbnails/28.jpg)
28
Static Links