Skip to content

[Wasm GC] Allow subtyping in arguments to struct.get etc. - #3644

Merged
kripken merged 1 commit into
mainfrom
valsub
Mar 2, 2021
Merged

kripken merged 1 commit into
mainfrom
valsub

Conversation

@kripken

@kripken kripken commented Mar 2, 2021

Copy link
Copy Markdown
Member

Note that Binaryen "canonicalizes" the type, so in the test output here
we end up with $grandchild twice. This is a consequence of us not
storing the heap type as an extra field. I can't think of a downside to
this canonicalization, aside from losing perfect roundtripping, but I think
that's a worthwhile tradeoff for efficiency as we've been thinking so far?

Fixes #3636

@kripken
kripken requested a review from tlively March 2, 2021 23:07
}
if ((!child->type.isRef() && !child->type.isRtt()) ||
child->type.getHeapType() != heapType) {
!HeapType::isSubType(child->type.getHeapType(), heapType)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could this function be deduplicated to parsing.h? The Element argument could become an optional pointer.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It almost can, but the mechanisms they use to throw are also different, which is why this wasn't deduplicated before.

A larger refactoring to unify how they throw might make sense I think.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ahhh, I missed that difference. Refactoring at some point makes sense to me, but definitely not urgent 👍

@kripken
kripken merged commit 5f88277 into main Mar 2, 2021
@kripken
kripken deleted the valsub branch March 2, 2021 23:41
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.

Error on implicit upcast

2 participants