Lab – Activation Records
When can a variable be in a register?
How does the compiler record this?
FindEscape – determining escapes
Using escape information
Note – these slides are available on the web

Consider these programs…
which variables escape?
let
  function f( x : string ) =
    print( x )
in
  f( “hello” )
end

If any of your code is shakey……
Remember that your CLASSPATH contains
.:$Tiger/java/classes
When running in your compiler directory
If your compiler is missing a particular packageName/blah.class
then it will look for blah.class in $Tiger/java/classes/packageName
I’ve installed correct versions of all executables in $Tiger/java/classes
If you know that any of your classes is not ok, or you want to see how a correct version operates, then simply delete the compiled version of the code for the moment

Preparation for today
Copy and compile files as suggested in the e-mail I sent you
Get Slide 2 up in a browser near you
Type in the top left program
And the others if you’ve got time
Attempt to compile it

Understanding the output
LetExp(
 DecList(
  FunctionDec(f
   FieldList(
    x,
    string,
    false,
    FieldList()),
   CallExp(print,
    ExpList(
     VarExp(
      SimpleVar(x))
     :NAME(string)
      =STRING))
   :VOID,
   FunctionDec())

Now, try program with escapes
What do you notice in the output?
Is it right?
Try again after deleting the file
FindEscape/FindEscape.class
Is that better?

FindEscape/FindEscape.java…
… is missing some crucial code
Uses an extra environment to manage ‘escape’ information
Find out what information is held in the env
How can this be used to determine the escapees?
And particularly – when can it be used?
Add in the necessary management code

The Semant phase
FindEscape is a quick sub-pass over the program, before any scope/type checking
Work out how the escapes information is used in the rest of the Semant phase?
Where is it accessed?
What effect does it have?