-
Notifications
You must be signed in to change notification settings - Fork 451
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
Implement has_feature. #120
Conversation
e1a223d
to
a43d0c4
Compare
a43d0c4
to
99088eb
Compare
This is now rebased on top of the host opcode grouping changes, which required teaching the host opcode code about host opcodes that don't need memory. |
It would be cool to add a known-always-present feature so we can test both the positive and negative case in the automated test. That's a pretty small thing though. Otherwise this LGTM. |
Good idea. I added a feature called "wasm" which is claimed to be unconditionally supported :-). |
@@ -90,10 +90,17 @@ let type_cvt at = function | |||
| DemoteFloat64 -> error at "invalid conversion" | |||
), Float64Type | |||
|
|||
type type_hostop_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.
Instead of introducing another variant of function type for a singular use, can't type_hostop
just return a pair func_type * bool
?
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.
That works.
I'm afraid I still don't understand how a feature test inside the language is supposed to make sense -- AFAICS it is utterly useless as long as there's no defined way to actually handle unsupported features inside the language as well. And I have no idea how that would be done or specced or implemented. The design docs don't explain that either, only how to do feature testing on the meta level (which doesn't require the operator). It seems to me that putting in the operator now is starting with a (useless) step 2 before we have a clue about step 1. But other than these fundamental doubts about the premise, and the nits above, LGTM. :) |
@rossberg-chromium The intended usage I'm anticipating in the MVP is described here. |
@lukewagner, yes, that's what I looked at, but as far as the MVP is concerned, the only workable suggestions there are doing meta-level feature detection (or am I misreading that?). So what still puzzles me is how in-language feature detection is useful before you also add the actual ability to "decode-through" unrecognised features? |
@rossberg-chromium Because we'd want implement layer 1 decoder (which also performed the polyfilling) in wasm (using only MVP features). That (tiny) module needs to learn what features are supported somehow, so might as well be from within wasm; otherwise we'd have to add it as a JS function and that seems weird. |
I see! Okay, sorry that I didn't get that from the description. I wouldn't mind clarifying this use case (and perhaps moving the explanation to the FeatureTest page itself). ;) |
@rossberg-chromium Will do; I forgot we even had FeatureTest.md :) |
For the record, my binary encoding proposal already covers being able to decode unrecognized AST nodes. |
The patch is updated to address the comments above. Any further comments? |
lgtm |
Integrate latest spec tests from WAVM
This implements
has_feature
as described in the design.