The final exam will be cumulative.
For sample questions for the material covered for Midterm 1 you should look
at this page.
For sample questions for the material covered for Midterm 2 you should look
at this page.
Sample questions concerning material covered since Midterm 2:
- BRIEFLY define the following terms and give an example of how each term is used:
- Interpreter
- Activation/call of a function
- Lifetime of a function
- Activation record
- Access link
- Control link
- Display (of AR pointers)
- Alignment (to words)
- Dynamic dispatch of object methods
- Dispatch table
- Basic block (for optimization)
- Local optimization
- What are some of the key questions that must be answered in order to
implement an interpreter that works by first parsing an entire file
and then executing the resulting AST (you may indicate other steps of
compilation you think should be included before intepretation occurs)?
- How is memory generally laid out for a program? What are the various
parts of the memory associated with the program used for?
- What are the components of an activation record? How is an AR used?
- How does a display of AR pointers work and what process(es) does it make
more efficient? What are the drawbacks of a display?
- Data can be allocated statically, on the stack, or in the heap. What
types of variables are the different sections of the program used for?
- How is an AR created during code generation? Which parts of the code
are responsible for generating the AR? Explain how the different parts
of a function call interact during creation of the AR.
- Assume you are in the process of writing a function codegen that does
code generation for compiling a simple language to an intermediate
language similar to the one discussed in class.
What would your codegen routine generate for an addition operator?
- How are objects represented in memory during code generation when
inheritance occurs? What are the key issues for code generation and
inheritance?
- Explain how dynamic dispatch works for code containing objects
with respect to inheritance. Give an example that illustrates your
explanation.
- Compilers often generate intermediate code from an AST rather than
generating machine code? Why? Are there disadvantages to this
approach?
- What are some of the optimizations that can be done on our code that is generated. Give an example of each.
- It is often the case that local optimizations are very simple. How
then can they have such profound effects on code? Give an example to
illustrate your point.