Skip to content

Improve internal register API #699

@eteran

Description

@eteran

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.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions