-
Notifications
You must be signed in to change notification settings - Fork 830
Restore the extern heap type
#4898
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
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
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.
Why are the tests changed here?
src/ir/possible-constant.h
Outdated
| auto lub = HeapType::getLeastUpperBound(type, otherType); | ||
| if (lub != type) { | ||
| value = Literal::makeNull(lub); | ||
| assert(lub && "TODO: Handle case without LUB"); |
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.
I think we should handle this in this PR, or else we'll get fuzzer failures. To handle it, if there is no LUB let's turn the result into Many().
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.
Shouldn't we turn it into a None, since the types are incompatible? Although once we implement bottom types, we'll be able to make it a Literal of that bottom type instead.
Edit: I guess the conservative thing to do here is use Many for now and Literal 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.
None means "no contents". Many means "many things are possible here", which can include many incompatible things.
| otherType.getHeapType()); | ||
| value = Literal::makeNull(lub); | ||
| assert(lub && "TODO: handle case where there is no LUB"); | ||
| value = Literal::makeNull(*lub); |
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.
Same as above, this can make a Many().
|
The tests changed because their input used "externref" or "(ref extern)", which previously was an alias for "anyref" and "(ref any)" but now is not. |
|
I see about the tests, thanks. |
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.
lgtm if this passes fuzzing.
aheejin
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.
Some places this didn't just add externref but replaced anyref with it. We don't need anyref in those places anymore?
| case HeapType::eq: | ||
| assert(x.isNull() && "unexpected non-null reference type literal"); | ||
| break; | ||
| case HeapType::any: |
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.
Why is any's behavior here different from that of ext? Is any not nullable?
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.
We only support the standardized reference types extern and func in this API and all the GC types are meant to hit that WASM_UNREACHABLE. Previously HeapType::any represented the standardized extern, but now it only represents the sepate any GC type.
src/passes/InstrumentLocals.cpp
Outdated
| Name get_v128("get_v128"); | ||
| Name get_funcref("get_funcref"); | ||
| Name get_anyref("get_anyref"); | ||
| Name get_extref("get_extref"); |
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.
We don't abbreviate externref to extref in other places, so how about just get_externref/set_externref here as well?
|
Note to self: I should also update the changelog. |
Right, these were places that were logically using externref all along, but because we had externref == anyref, they had to use anyref in the code. |
The GC proposal has split `any` and `extern` back into two separate types, so reintroduce `HeapType::ext` to represent `extern`. Before it was originally removed in #4633, externref was a subtype of anyref, but now it is not. Now that we have separate heaptype type hierarchies, make `HeapType::getLeastUpperBound` fallible as well.
ddbceb1 to
1761ae9
Compare
|
Fuzzer looks good when I hack it to use v8-10.5.117, which still has func <: any. The next PR will make it work with up-to-date v8. |
|
|
|
Bisected to confirm, the breakage indeed starts here. This type of error seems to happen every 1,000 or so fuzzer iterations now, but sometimes it's 100 or 10,000, so this type of rare issue is easy to miss... |

The GC proposal has split
anyandexternback into two separate types, soreintroduce
HeapType::extto representextern. Before it was originallyremoved in #4633, externref was a subtype of anyref, but now it is not. Now that
we have separate heaptype type hierarchies, make
HeapType::getLeastUpperBoundfallible as well.