Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`val get: t * Type.t -> t * {offset: Bytes.t}` takes a stack allocation (list of allocated slots) and a type and returns a new stack allocation and an offset, such that the new stack allocation extends the old stack allocation with an allocated slot at `offset` suitable for an object of the given type. Previously, when the old stack allocation is non-empty, a search was made through the old stack allocation for an available slot. However, the search started after the first allocation in the old stack allocation. That is, the result `offset` was always greater than the offset of the head of the old stack allocation, even unallocated slots existed before the head of the old stack allocation. This could lead to larger than necessary stack frames. It suffices to simply initiate the search as though a dummy `{offset = Bytes.zero, size = Bytes.zero}` allocation were at the head of the old stack allocation. A small amount of logic is used to avoid including that dummy allocation in the result allocation in order to avoid accumulating unnecessary dummy allocations.
- Loading branch information
1 parent
4e02cf8
commit 31b6e29
Showing
1 changed file
with
33 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters