Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ply: Correct alignment of stack allocations #95

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

wkz
Copy link
Collaborator

@wkz wkz commented Sep 3, 2024

As entries are allocated on the stack the stack pointer is decremented and then adjusted to meet the requested alignment requirements. The current math does unfortunately not always provide the requested alignment.

One example is when the stack pointer is at -1 and an allocation of 4 bytes with alignment of 4 is performed, which results in an allocation at offset -6. A typical case where this happens is when working with tracepoints containing boolean fields.

Update the adjustment to properly round the stack pointer down to the requested alignment.

Fixes #91

As entries are allocated on the stack the stack pointer is decremented
and then adjusted to meet the requested alignment requirements. The
current math does unfortunately not always provide the requested
alignment.

One example is when the stack pointer is at -1 and an allocation of 4
bytes with alignment of 4 is performed, which results in an allocation
at offset -6. A typical case where this happens is when working with
tracepoints containing boolean fields.

Update the adjustment to properly round the stack pointer down to the
requested alignment.

Signed-off-by: Bjorn Andersson <[email protected]>
@wkz wkz merged commit 7df81b8 into master Sep 3, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants