Skip to content
This repository has been archived by the owner on Jul 16, 2020. It is now read-only.

Correct stack alignment calculation #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

haraldh
Copy link
Contributor

@haraldh haraldh commented Sep 26, 2019

Previously align_offset(STACK_ALIGNMENT) was substracted, which is
wrong, because the documentation states:

Computes the offset that needs to be applied to the pointer in
order to make it aligned.

This patch first substracts STACK_ALIGNMENT and then adds
align_offset(STACK_ALIGNMENT), if the stack was not yet aligned

@haraldh haraldh requested a review from npmccallum September 26, 2019 07:07
Previously align_offset(STACK_ALIGNMENT) was substracted, which is
wrong, because the documentation states:
   > Computes the offset that needs to be applied to the pointer in
   > order to make it aligned.

This patch first substracts STACK_ALIGNMENT and then adds
align_offset(STACK_ALIGNMENT), if the stack was not yet aligned

Also calculating the top with .add(stack.len() - 1) so the stack pointer
points initially to a valid memory address.
@haraldh
Copy link
Contributor Author

haraldh commented Oct 1, 2019

Update:

Also calculating the top with .add(stack.len() - 1) so the stack pointer points initially to a valid memory address.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant