CSC448: Code Generation: Run-Time Storage Location II [70/133] Previous pageContentsNext page

Corin did not show

In addition, we need to know how much room to create for local variables in each block. The Frame class has this information. getLocalAllocInst returns an instructions that allocates room for the local variables of a block.

For example, if there are 5 local variables, getLocalAllocInst returns subl $20, %esp.

The Frame class has the form:

class Frame
{
  Frame (List stats, MethodSig methodSig) { ... }
  String getLocation (String varName) { ... }
  String getLocalAllocInst () { ... }
}

Previous pageContentsNext page