blob: 8c8bb39e1f2e4e810a827acabad53da4ce053f74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# Blocs d'activation
## Memory Hierarchy
| Type | Desc |
| ------------ | ----------------------------------- |
| Registers | Small memory units built on the CPU |
| L1 | Last main memory access results |
| L2 | MB |
| Memory (RAM) | RAM |
| Storage | Disks |
## Register overflow
**Memory allocation must be dynamic**
### Dynamic memory allocation
- *Global*
- *Automatic*
- *Heap*:
- User controlled
- Garbage collected
## `spim` Memory model
![[Pasted image 20250513142247.png]]
## Stack management
Function calls: stack process
Or: Call Tree dfs
## Activation blocks contents
- arguments : incoming
- local variables : user automatic variables
- return address : where to return
- saved registers : caller's environment to restore
- temp : compiler automatic variables, spills
- static links : when needed
Layout suggested by the constructor
## Frame & stack pointer
Frame : debut de bloc
Stack : fin de bloc
# Static links
A mechanism :
- Computed at compile time
- that produces code
- that will be used at runtime
$\rightarrow$ Sert à remonter au premier lien avant les appels recursifs pour chopper des variables
# Translating expressions
How to translate the expression $\alpha < \beta$ in HIR?
|