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

fix(memory) BinaryVector fixes for M1 Mac #1429

Merged
merged 2 commits into from
Aug 3, 2022
Merged

fix(memory) BinaryVector fixes for M1 Mac #1429

merged 2 commits into from
Aug 3, 2022

Conversation

amolnayak311
Copy link
Contributor

@amolnayak311 amolnayak311 commented Aug 2, 2022

Issue
On Mac M1, incNumBytes has a quirk. The operation fails with SIGBUS when a getAndAddInt is invoked on an address offset that is one of the three preceding every multiple of 16. For e.g when addrs is 13, 14, 15, 29, 30, 31, 45, 46, 47 byte offset from the base address, the operation UnsafeUtils.unsafe.getAndAddInt(UnsafeUtils.ZeroPointer, addr, inc) fails. However, when we do a get and put non atomically, it works. The fix is done to currently unblock developers from using M1 Mac. However, the fix is far from ideal as the data written to the block of memory by FiloDB is application specific and the block of memory is opaque to the operating system, in other words, the OS should not be interpreting this data as long as the application is working on the block it is allocated.

IMPORTANT
The PR is built on top of this PR #1428 by @kvpetrov.

Next steps
Once the issue with UnsafeUtils.unsafe.getAndAddInt(UnsafeUtils.ZeroPointer, addr, inc) is identified, the changes to BinaryVector.incNumBytes will be reverted.

@amolnayak311 amolnayak311 changed the title fix(memory) BinaryVector fixes for Mac M1 fix(memory) BinaryVector fixes for M1 Mac Aug 2, 2022
Copy link
Member

@vishramachandran vishramachandran left a comment

Choose a reason for hiding this comment

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

Approved, Thanks for digging into this!

@amolnayak311 amolnayak311 merged commit 905b799 into develop Aug 3, 2022
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.

3 participants