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

Type entity #57

Closed
wants to merge 1 commit into from
Closed

Type entity #57

wants to merge 1 commit into from

Conversation

emhane
Copy link
Contributor

@emhane emhane commented Sep 5, 2024

Impl cranelift_entity::EntityRef for Type. This enables using cranelift_entity::SecondaryMap for error stack in verifier.

Copy link
Collaborator

@Y-Nak Y-Nak left a comment

Choose a reason for hiding this comment

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

We shouldn't implement EntityRef for Type just because Type is not a reference(rather, it's an entity itself).
Also, I'm not sure why we want to use entity pattern for Type because we don't need to distinguish instances of type when they are the "same" type(e,g,. do we want to distinguish two Type::i8 and Type::i8?).
I think we should use HashMap or FxHashMap in this case if you don't have a special reason.

@emhane
Copy link
Contributor Author

emhane commented Sep 9, 2024

We shouldn't implement EntityRef for Type just because Type is not a reference(rather, it's an entity itself). Also, I'm not sure why we want to use entity pattern for Type because we don't need to distinguish instances of type when they are the "same" type(e,g,. do we want to distinguish two Type::i8 and Type::i8?).

this impl doesn't distinguish between between instances of same type variant. as the test shows, a SecondaryMap would be indexed by type variant.

I think we should use HashMap or FxHashMap in this case if you don't have a special reason.

sgtm

@emhane emhane closed this Sep 9, 2024
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