| 124 | | * The STG stack: |
| 125 | | * Stores function arguments and continuations (i.e. the stack |
| 126 | | frames which are executed when a function returns) |
| 127 | | * Grows downwards in memory |
| 128 | | * The top of the stack is pointed to by the STG register `Sp`, and |
| 129 | | the maximum available stack pointer is stored in `SpLim`. There is |
| 130 | | no frame pointer. |
| 131 | | |
| 132 | | * The heap: |
| 133 | | * Used to store many different sorts of heap object: notably |
| 134 | | functions, thunks and data constructors |
| 135 | | * Grows upwards in memory, towards the stack |
| 136 | | * All allocation occurs using a bump-allocator: the heap pointer is |
| 137 | | simply incremented by the number of bytes desired (subject to to a |
| 138 | | check that this does not exhaust available memory). The garbage |
| 139 | | collector is responsible for moving objects out of the area of the |
| 140 | | heap managed by the bump allocator and into the care of its |
| 141 | | generational collector. |
| 142 | | * The last address in the bump-allocated part of the heap that has |
| 143 | | been used is pointed to by the STG register `Hp`, with `HpLim` |
| 144 | | holding the maximum address available for bump-allocation. |
| 145 | | |
| 146 | | |
| | 124 | 2. The STG stack: |
| | 125 | * Stores function arguments and continuations (i.e. the stack |
| | 126 | frames which are executed when a function returns) |
| | 127 | * Grows downwards in memory |
| | 128 | * The top of the stack is pointed to by the STG register `Sp`, and |
| | 129 | the maximum available stack pointer is stored in `SpLim`. There is |
| | 130 | no frame pointer. |
| | 131 | |
| | 132 | 3. The heap: |
| | 133 | * Used to store many different sorts of heap object: notably |
| | 134 | functions, thunks and data constructors |
| | 135 | * Grows upwards in memory, towards the stack |
| | 136 | * All allocation occurs using a bump-allocator: the heap pointer is |
| | 137 | simply incremented by the number of bytes desired (subject to to a |
| | 138 | check that this does not exhaust available memory). The garbage |
| | 139 | collector is responsible for moving objects out of the area of the |
| | 140 | heap managed by the bump allocator and into the care of its |
| | 141 | generational collector. |
| | 142 | * The last address in the bump-allocated part of the heap that has |
| | 143 | been used is pointed to by the STG register `Hp`, with `HpLim` |
| | 144 | holding the maximum address available for bump-allocation. |