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

update docs and tests for weak cas! and lock! operations #731

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

mflatt
Copy link
Contributor

@mflatt mflatt commented Oct 18, 2023

This PR is intended to close #720.

The vector-cas!, box-cas!, and ftype-lock! operations are "weak" in the sense that they may spuriously fail on an architecture (like AArch64) with a weak memory model. Also, those operation do not necessarily imply any overall memory ordering, so using memory-order-acquire and memory-order-release may be needed. The documentation did not make this clear, and some tests did not handle spurious failure.

As noted in the discussion for #720, a good case could be made that these operations should be "strong", which could mean both avoiding spurious failure and ensuring more memory ordering. The approach here is conservative: it keeps the current implementation and allows access to the underlying machine's behavior, but it's also compatible with the possibility that we decide to strengthen guarantees in the future.

mats/mat.ss Outdated Show resolved Hide resolved
csug/objects.stex Outdated Show resolved Hide resolved
csug/objects.stex Outdated Show resolved Hide resolved
csug/threads.stex Outdated Show resolved Hide resolved
The `vector-cas!`, `box-cas!`, and `ftype-lock!` operations are "weak"
in the sense that they may spuriously fail on an architecture (like
AArch64) with a weak memory model. Also, they do not necessarily imply
any overall memory ordering, so using `memory-order-acquire` and
`memory-order-release` may be needed. The documentation did not make
this clear, and some tests did not handle spurious failure.

Closes cisco#720
@burgerrg
Copy link
Contributor

One of the tests triggered the error near line 1176 of mats/misc.ms. The call (error 'compute-size-increments should be (errorf 'compute-size-increments

@mflatt
Copy link
Contributor Author

mflatt commented Oct 18, 2023

One of the tests triggered the error near line 1176 of mats/misc.ms. The call (error 'compute-size-increments should be (errorf 'compute-size-increments

Thanks - I'll work on that in another PR in the near future, since it's unrelated to the change here.

@burgerrg burgerrg merged commit 35013cf into cisco:main Oct 18, 2023
12 checks passed
@burgerrg
Copy link
Contributor

Thank you for this helpful update!

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.

Semantics of {vector, box}-cas! and ftype-lock!
2 participants