-
Notifications
You must be signed in to change notification settings - Fork 827
[WIP] Use Type instead of HeapType for functions #7971
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
Conversation
|
As discussed, I'll take a look at finishing this. |
|
@tlively this builds and has main merged in, but it has test errors. I actually am not sure how you were planning on fixing these. E.g. the We could give all function types inexact types for now..? Or just do the larger change as part of this one? |
|
That wasm-merge error should go away if we keep checking subtyping only on the heap types for now. |
|
I worry that might be a bit of a tightrope to walk here... may be better to fix it all in one PR. But I added that now. |
|
@tlively this should be good to go |
src/passes/StringLifting.cpp
Outdated
| auto type = func->type; | ||
| if (func->base == "fromCharCodeArray") { | ||
| if (type != Signature({array16, i32, i32}, refExtern)) { | ||
| if (type.with(Inexact).getHeapType() != |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we treat exactness as being a property of reference types rather than heap types, the .with(Inexact) here is not doing anything. Is it there so we remember to remove it along with the .getHeapType() in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I must have done this in two parts, and missed that the latter made the former redundant. Fixed.
src/wasm/wasm-validator.cpp
Outdated
| // TODO: Compare the full Type | ||
| shouldBeEqual(curr->type.getHeapType(), | ||
| func->type.getHeapType(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one
| // TODO: Compare the full Type | |
| shouldBeEqual(curr->type.getHeapType(), | |
| func->type.getHeapType(), | |
| // TODO: Compare the full Type | |
| shouldBeEqual(curr->type, | |
| func->type, |
If this change works as intended, both sides will always be non-nullable and exact here. Once we start making some imports inexact, this will help make sure everything stays internally consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, not sure why I thought this one must be deferred. Good point, it was a bug, in the fuzzer. Fixed.
Co-authored-by: Thomas Lively <tlively@google.com>
Co-authored-by: Thomas Lively <tlively@google.com>
Co-authored-by: Thomas Lively <tlively@google.com>
Co-authored-by: Thomas Lively <tlively@google.com>
Co-authored-by: Thomas Lively <tlively@google.com>
|
I cannot approve this in the GitHub UI since I'm the one who originally uploaded it, but LGTM. Thanks for taking this over! |
kripken
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
A few thousand fuzzer iterations without errors, landing. |

This will let us enforce that the type of a
ref.funcis equal to the type of the referenced function, even once we introduce inexact function imports.