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

Improve internal register API #699

Open
eteran opened this Issue Mar 16, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@eteran
Copy link
Owner

commented Mar 16, 2019

A while ago I checked in the file RegisterRef with the goal of improving the Register API to make it more robust and involve less copying.

Essentially it is kinda analogous to what string_view is to strings. It is a non-owning view of part of the PlatformState object.

The idea is that we can unify all of the "get_xxx_register" functions to always return a RegisterRef regardless of the register type, since it will simply point to the right bytes in the State object and know how many bytes are part of that register.

The example I have checked in needs some work as it is clunky and requires a state object. I think a pointer can be even better and avoid this requirement. I think we don't even really have to worry about alignment issues since the underlying structures that we'd be pointing to would require that the data members be aligned.

@eteran eteran added the enhancement label Mar 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.