-
Notifications
You must be signed in to change notification settings - Fork 832
Acquire/release memory ordering for loads #8169
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
Conversation
d634a16 to
39cd787
Compare
5e2de8f to
b92a217
Compare
b92a217 to
1bd821c
Compare
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.
Will update this to match the structure that we chatted about. In the meantime, this should cover all of the logic from this PR.
| o << int8_t(BinaryConsts::AtomicPrefix) << int8_t(BinaryConsts::AtomicNotify); | ||
| emitMemoryAccess(4, 4, curr->offset, curr->memory); | ||
| emitMemoryAccess( | ||
| 4, 4, curr->offset, curr->memory, MemoryOrder::SeqCst, /*isRMW=*/false); |
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.
It would be nice to have an emitRMWMemoryAccess helper to avoid the bool params here, too.
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.
What's wrong with the bool param here? My thinking is that RMW is a memory access but if we split the method into two it would be wrong to call emitMemoryAccess on a RMW, and instead the caller would have to know to call emitRMWMemoryAccess. The bool parameter ensures that the caller gets the right behavior without needing to know about the right function.
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.
That's fair. I was just coming at it from a readability standpoint. It's fine the way it is.
tlively
left a comment
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.
Nice!
Part of #8165. Adds support for parsing and serializing the text and binary formats for memory orderings for loads. The C and JS apis are left unchanged, they'll be updated for all atomic operations in the same commit later. test/passes was updated using
python3 scripts/auto_update_tests.py wasm-opt.