-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
source2il: implement alignment support (#112)
## Summary Implement internal support for locations with an alignment requirement greater than 1 byte. This is a preparation for the source language gaining type alignment requirements. ## Details The alignment for numeric types (int and float) is equal to their size, while for aggregate types (other than `seq`) it's that of their most aligned constituent type. The size of aggregate types is padded to be a multiple of their alignment. This is so that their size matches the space they would take up within an array, while still allowing copying `size` bytes from a pointer to a location of said type to be valid, regardless of where the location is located. Record fields are placed such that their relative offset is a multiple of their alignment requirement. The allocator procedures `alloc` and `realloc` take an additional parameter specifying the allocation's required alignment. `grow` and `preparedAdd` also take an additional parameter, which specifies the alignment of the dynamic array's element type. The callsites of all four procedures are updated accordingly. Finally, the value rendering in `vmexec` is updated to take the new object layout into account.
- Loading branch information
Showing
2 changed files
with
135 additions
and
47 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
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