proj4 - Project 4: Activation Records CSC 4351, Spring 2011...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Project 4: Activation Records CSC 4351, Spring 2011 Due: 1 April 2011 Augment the Semant package to allocate locations for local variables, and to keep track of the nesting level as described on pp. 150–151, including the options for finding escapes and handling functions with more than k formal parameters. For a detailed description of MIPS Frames, see the SPIM Manual on the course web page. The necessary changes are the following: 1. Escape Analysis Implement the methods traverseVar , traverseExp and traverseDec in FindEscape.FindEscape . The idea is to maintain a depth counter for the depth of each function declaration. For escape analysis, we will again construct a symbol table as for Project 3 and tear it down when we’re done with escape analysis. When traversing a function, traverse the formals and the function body in a new depth + 1 escape scope. When you traverse a variable or parameter declaration put a VarEscape or FormalEscape entry for it into the escape environment. When you traverse a variable reference ( SimpleVar ) get its escape entry from the environment, check if the entry depth is less than the current depth. If so, then set the escape. While we’re at it we also find out which functions are leaf functions and which ones are not. For remembering the result of escape analysis, there is a boolean field escape in Absyn.FieldList and Absyn.Vardec . There’s also a boolean field leaf in Absyn.FunctionDec . The files you’ll need to modify are these three classes from
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

proj4 - Project 4: Activation Records CSC 4351, Spring 2011...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online