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

Store all instructions in one Vec? #215

Open
Rua opened this issue Sep 4, 2021 · 0 comments
Open

Store all instructions in one Vec? #215

Rua opened this issue Sep 4, 2021 · 0 comments

Comments

@Rua
Copy link

Rua commented Sep 4, 2021

In my code I'm looking to make a lookup table of all ids in the module, with the place in the module where it's defined. But because the data representation splits instructions by section, it's not as easy to identify a specific instruction. You'd have to store the section, function and block along with the instruction index, then there's some fiddly logic to look the instruction up again.

I propose an alternative representation instead. All instructions go in a single large Vec, and the sections, functions and blocks are stored as Range<usize> instead. An instruction is then uniquely identifiable by an index, while it's trivial to create slices to any of these smaller pieces if needed. I can try to implement this if you want, but because it's a breaking change I wanted to ask if you're ok with it first. It may be more awkward to implement Builder with this scheme.

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