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: update atomic register to u64::MAX-2 to avoid collisions #557

Merged
merged 2 commits into from
Sep 1, 2021

Conversation

austinabell
Copy link
Contributor

When using env and sys calls within the same method, it feels like a foot gun to have the register used for temporary operations to be 0, as most examples and usages I've seen of syscalls use this register.

@ChaoticTempest
Copy link
Member

How does this register work usually? I only see it being used for reads so I'm not sure if changing it has any effect besides reading from a different location. Or does the read do something special like create a lock?

@austinabell
Copy link
Contributor Author

How does this register work usually? I only see it being used for reads so I'm not sure if changing it has any effect besides reading from a different location. Or does the read do something special like create a lock?

Nah, this register is just used as a temporary buffer to be used within the same method call. This changes nothing functionally. The only negative is that someone could potentially be using u64::MAX-2 register with one of these calls sandwiched in between and it would break, but I think this is unreasonably unlikely, and much more of a common pattern for people to use register 0

Copy link
Member

@ChaoticTempest ChaoticTempest left a comment

Choose a reason for hiding this comment

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

LGTM

@austinabell austinabell merged commit d69e905 into master Sep 1, 2021
@austinabell austinabell deleted the austin/atom_op_reg branch September 1, 2021 21:28
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.

2 participants