-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
core.int128 alignment is adjusted #14768
Conversation
|
Thanks for your pull request, @WalterBright! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#14768" |
|
Why is it explicitly aligned at all? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't match gdc or ldc.
Indeed, if a compiler has a specific requirement, then the alignment should be dictated by the compiler, not the library. As for your question, I expect to match native int128 alignment. Could be a |
|
I don't really know what change you are requesting. The compiler is using the predefined versions to tell it what alignment to use. |
91c743e
to
e803ccb
Compare
|
I changed it so the alignment that works best with D is under |
e803ccb
to
93de6b9
Compare
Made alignment changes only for DigitalMars
93de6b9
to
e3d02ae
Compare
|
@ibuclaw is this ok? |
|
Dmd would no longer be abi compatible with native int128 as a result of this. If everyone is fine letting dmd to continue shooting itself, then OK. |
|
I don't know why the native ABI would require it be aligned on 16 bytes anyway because the instructions to implement don't need it. Be that as it may, for someone who is trying to interface it with the native ABI, for those instances that need it, |
druntime/src/core/int128.d
Outdated
| version (D_SIMD) | ||
| private enum Cent_alignment = 16; | ||
| else version (X86_64) | ||
| private enum Cent_alignment = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like these last two cases are interchanged - this should be 8 and the else branch below should be 4. However, doesn't X86_64 imply D_SIMD anyway? X86-64 has SSE2 support in its base spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The layout exactly matches what the dmd compiler does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above:
is64bit ? 8 : 4
vs.
version (X86_64) private enum Cent_alignment = 4; else private enum Cent_alignment = 8;
looks to be in contradiction to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it now. Oops. good catch
To be ABI complaint. See System V spec on |
This isn't compliance should be noted in the file if this is intended. |
e3d02ae
to
adc976f
Compare
|
There is no reason for dmd to align this. This PR needs to be pulled. |
As alignment is now implemented per #14764 the code generated trying to align everything to 16 bytes when the stack is aligned to less is just terrible. I see no reason for alignment to be more than the stack alignment, so this changes the alignment of Cent to match the stack.