Runtime Organization

Management of runtime resources

Execution of a program is initially under the control of the operating system

Draw a picture of memory with "code" and "other space". Code is usually loaded at one end of the memory space (e.g., low or high end).

Activations

Two assumptions:

Activation Records

What information to keep in an activation? That is what we will call the activation record.

Globals and Heap

Heap objects

Usually

Both heap and stack grow. Must take care they don't grow into each other. Simple solution: put them at opposite ends of memory and let them grow towards each other. If the two regions start touching each other, then the program is out of memory (or it may request more memory, etc.). This design allows different programs to use these different areas as they see fit, e.g., some programs may have large stacks, other may have large static data regions.

Alignment

Low-level but important detail that every compiler writer needs to be aware of.

Stack machines

Begin talking about code generation. Stack machines are the simplest model of code generation

In a stack machine