-
Notifications
You must be signed in to change notification settings - Fork 699
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
Reference types changes to remove subtyping #1407
Conversation
This PR can't land as-is, since it fails all the spec tests (that need to be updated) |
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.
Cool! So it was decided to do with externref
as the name in the spec? (Over anyref
?)
@@ -157,8 +157,7 @@ The `reference-types` proposal adds three more valid types: | |||
|
|||
| type | JSON format | | |||
| - | - | | |||
| "nullref" | `{"type": "nullref", "value": ""}` | | |||
| "hostref" | `{"type": "hostref", "value": <string>}` | | |||
| "externref" | `{"type": "externref", "value": <string>}` | | |||
| "funcref" | `{"type": "funcref", "value": <string>}` | |
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 notice there that we are missing exnref
.. which is a little annoyingly close in name to externref
return true; | ||
} | ||
return false; | ||
return expected == actual; |
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.
Maybe a comment here as to why this a function at all still? Something like "we used to have subtyping and we expect we may again 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.
Done.
src/interp/interp-util.cc
Outdated
case Type::Funcref: | ||
return StringPrintf("funcref:%" PRIzd, tv.value.Get<Ref>().index); | ||
|
||
case Type::Externref: |
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.
What do you think about camel-casing these (as a followup). I find ExternRef
a little easier to read than Externref
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.
Done.
@@ -15,8 +17,7 @@ struct TokenInfo { | |||
}; | |||
}; | |||
%% | |||
anyref, Type::Anyref | |||
array, TokenType::Array | |||
array, Type::Array, TokenType::Array |
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 did this and other seemingly unrelated lines in this file change?
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.
Maybe another possible split out PR?
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.
Done.
Result BinaryReaderLogging::name(Index value, Type type) { \ | ||
LOGF(#name "(index: %" PRIindex ", type: %s)\n", value, type.GetName()); \ | ||
return reader_->name(value, type); \ | ||
} |
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 part could be split out if you feel like landing sooner.
Is there a PR in the reftypes proposal you can link to here? |
Here's the link to the reference-types PR: WebAssembly/reference-types#87. I'll add it to the commit too. |
Main changes: * Rename `anyref` -> `externref` * Remove `nullref` * Rename `hostref` -> `externref` * `ref.null` and `ref.is_null` now have "ref kind" parameter * Add ref kind keywords: `func`, `extern`, `exn`
Main changes:
anyref
->externref
nullref
hostref
->externref
ref.null
andref.is_null
now have "ref kind" parameterfunc
,extern
,exn