Changes between Version 46 and Version 47 of Commentary/Compiler/StackAreas
- Timestamp:
- 06/30/08 08:28:14 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Commentary/Compiler/StackAreas
v46 v47 56 56 An `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. 57 57 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. 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`. 59 Notice that a `CmmStackSlot` is an ''address'', so we can say 60 {{{ 61 Sp = SS(a+0) 62 }}} 63 to make `Sp` point to an particular area. Use a `CmmLoad` to load from the stack. 64 65 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. 66 59 67 60 68 The 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. … … 65 73 Note: 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. 66 74 67 Notice that a `CmmStackSlot` is an ''address'', so we can say68 {{{69 Sp = SS(a+0)70 }}}71 to make `Sp` point to an particular area. Use a `CmmLoad` to load from the stack.72 75 73 76 '''More detail needed about which location in a `CallArea` is numbered 0'''
