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 using naked memory accesses in the mock queues #123

Open
slp opened this issue Dec 3, 2021 · 0 comments
Open

Avoid using naked memory accesses in the mock queues #123

slp opened this issue Dec 3, 2021 · 0 comments

Comments

@slp
Copy link
Collaborator

slp commented Dec 3, 2021

Operations on the mock queues are usually done through the load and store methods of Ref. While this was initially convenient, it makes harder to implement checks or conversions (such as endianess transformations) for certain fields. It's also less readable, as the developer needs to identify what's being read or written by its location in the ring.

I see two options to improve this:

  1. Avoid returning Ref and ArrayRef from SplitQueueRing, implementing instead methods with concrete types for each data field being accessed.
  2. Avoid the use of primitive types in tests, always wrapping them in structs with descriptive names and accessor methods.

Option (1) sounds more reasonable to me, but I don't have an strong opinion about them.

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

No branches or pull requests

1 participant