Changes between Version 46 and Version 47 of Commentary/Compiler/StackAreas


Ignore:
Timestamp:
Jun 30, 2008 3:28:14 PM (6 years ago)
Author:
dias
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/StackAreas

    v46 v47  
    5656An `Area` represents space on the stack; it may use either the `RegSlot` constructor to represent a single stack slot for a register or the `CallArea` constructor to represent parameters passed to/from a function call/return. In a `CallArea`, the `BlockId` is the label of the function call's continuation, and the two integers are the sizes of the outgoing and incoming parameter-passing areas. 
    5757 
    58 To name a specific location on the stack, we represent its address with a new kind of `CmmExpr`: the `CmmStackSlot`. A `CmmStackSlot` is just an integer offset into an `Area`. Each stack area grows down, with offset 0 pointing to the old end of the area. If we wanted to place a 4-byte object at the old end of the area, we would address it using the offset 4. 
     58To name a specific location on the stack, we represent its address with a new kind of `CmmExpr`: the `CmmStackSlot`. A `CmmStackSlot` is just an integer offset into an `Area`.  
     59Notice that a `CmmStackSlot` is an ''address'', so we can say 
     60{{{ 
     61  Sp = SS(a+0) 
     62}}} 
     63to make `Sp` point to an particular area.   Use a `CmmLoad` to load from the stack. 
     64 
     65Each stack area grows down, with offset 0 pointing to the old end of the area. If we wanted to place a 4-byte object at the old end of the area, we would address it using the offset 4. 
     66 
    5967 
    6068The following image shows the layout of a `CallArea` for both the outgoing parameters (function call) and incoming results (continuation after returning from the function call). Note that the incoming and outgoing parameters may be different, and they may overlap. 
     
    6573Note: If the `Area` is a `RegSlot`, we might still use a non-zero offset: for example, we might want to load the low word from a long integer. 
    6674 
    67 Notice that a `CmmStackSlot` is an ''address'', so we can say 
    68 {{{ 
    69   Sp = SS(a+0) 
    70 }}} 
    71 to make `Sp` point to an particular area.   Use a `CmmLoad` to load from the stack. 
    7275 
    7376'''More detail needed about which location in a `CallArea` is numbered 0'''