fix(internal/utils): fix clobbering BP#288
Merged
zeroshade merged 3 commits intoapache:mainfrom Feb 18, 2025
Merged
Conversation
lidavidm
approved these changes
Feb 17, 2025
| GLOBL LCDATA3<>(SB), 8, $8 | ||
|
|
||
| TEXT ·_int32_max_min_avx2(SB), $0-32 | ||
| TEXT ·_int32_max_min_avx2(SB), NOSPLIT, $8-32 |
Member
There was a problem hiding this comment.
Is the NOSPLIT only needed here and not in the other locations?
Member
Author
There was a problem hiding this comment.
ah, I can probably add it to the other locations for the benefits
lidavidm
approved these changes
Feb 18, 2025
kou
reviewed
Feb 18, 2025
| JMP LBB0_10 | ||
|
|
||
| TEXT ·_uint8_max_min_avx2(SB), $0-32 | ||
| TEXT ·_uint8_max_min_avx2(SB), NOSPLIT, $0-32 |
Member
There was a problem hiding this comment.
I'm not familiar with assembly but is $0 OK here? Should we use $8 like others?
Member
Author
There was a problem hiding this comment.
the $0 is the Frame Size. We only needed to update to $8 in the cases that included the LEAQ <something>, BP instruction since those were clobbering the BP. By updating the frame size the Go assembler will automatically insert instructions to save/restore the BP. In the cases where we weren't clobbering it, we don't need to update or change the frame size.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
Fixes #279
What changes are included in this PR?
In all instances where the generated assembly is clobbering the BP register, we insert a frame size so that the Go assembler will insert a save/restore of the BP, preventing the spurious crash discovered in #279
Are these changes tested?
There isn't really a consistent way to easily reproduce in a unit test, but I'm open to suggestions if anyone has one
Are there any user-facing changes?
No