Alias in Storage Allocation
Program data can be stored in memory in 2 ways:
- Storage in global area
- memory pages are allocated statically, i.e. all data is put at a fixed (virtual) address at load time
- loading such data takes often 2 instructions, since the load immediate instruction in MIPS is limited by 64 KB offset: ldadr R1,addr #load base pointer
- ldw R2,R1+offset #load base+offset
- COMMON block data, global data, SAVE data, malloc, mmap
- compilation with -static: all variables are allocated in global area
- Storage on the stack
- memory pages are allocated dynamically during program exec
- each subroutine gets new stack area for local data
- loading data from the stack requires single instruction ldw R2,TOS+offset #load TopOfStack+offset
- local (automatic) variables, temporary storage, alloca data
-
- Routines called from a parallel region :
- Allocate private stack area
- Variables allocated on private stack are private.
- Variables in global area are shared (aliases).