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

Avoid unaligned stores/loads #584

Merged
merged 1 commit into from
Dec 7, 2018
Merged

Avoid unaligned stores/loads #584

merged 1 commit into from
Dec 7, 2018

Conversation

fdopen
Copy link
Contributor

@fdopen fdopen commented Dec 6, 2018

The result of Data_custom_Val(caml_alloc_custom(...)) is word
aligned. long double and long double complex are usually
bigger. Such usage is even wrong on x86/amd64. Compilers are free to
use e.g. the MOVDQA instruction, if you tell them that your pointers are
properly aligned.

The result of `Data_custom_Val(caml_alloc_custom(...))` is word
aligned. `long double` and `long double complex` are usually
bigger. Such usage is even wrong on x86/amd64. Compilers are free to
use e.g. the MOVDQA instruction, if you tell them that your pointers are
properly aligned.
mymemcpy(&c, p, sizeof(c));
#else
memcpy(&c, p, sizeof(c));
#endif
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we ask the Alpine people to compile using -fno-builtin instead of fixing the GCC problem here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alpine is used by various CIs, including the ones by https://github.com/ocaml/opam-repository. A solution that isn't enabled by default would lead to frustration. I could move the check to the build system and add -fno-builtin there, but it would probably lead to even more lines of code.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Since the fix is constrained to a specific GCC release, it should at least be clear when we can safely remove it.

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.

None yet

2 participants