Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Remove subtyping #87

Merged
merged 6 commits into from
May 7, 2020
Merged

Remove subtyping #87

merged 6 commits into from
May 7, 2020

Conversation

rossberg
Copy link
Member

@rossberg rossberg commented Apr 29, 2020

Per the vote on #69, this PR removes subtyping from the proposal. List of changes:

  • Syntax:
    • remove nullref type
    • rename anyref type to externref
    • extend ref.null and ref.is_null instructions with new immediate of the form func or extern (this will later have to generalise to a constype per the typed references proposal)
  • Typing rules:
    • ref.null, ref.is_null: determine reference type based on new immediate
    • select, call_indirect, table.copy, table.init: drop subtyping
    • br_table: revert to rule requiring same label types
    • elem segment: drop subtyping
    • global import: drop subtyping (link time)
  • Remove subtyping rules and bottom type.
  • Revert typing algorithm (interpreter and spec appendix).
  • JS API:
    • remove "nullref"
    • rename "anyref" to "externref"
  • Scripts:
    • rename ref result to ref.extern
    • rename ref.host value to ref.extern
    • drop subtyping from invocation type check
  • JS translation:
    • extend harness with separate eq functions for each ref type
  • Adjust tests:
    • apply syntax changes
    • remove tests for subtyping
    • change tests exercising subtyping in other ways

Copy link
Member

@binji binji left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -902,9 +898,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
1. If |valuetype| equals [=𝗂𝟨𝟦=], return [=𝗂𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] 0.
1. If |valuetype| equals [=𝖿𝟥𝟤=], return [=𝖿𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] 0.
1. If |valuetype| equals [=𝖿𝟨𝟦=], return [=𝖿𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] 0.
1. If |valuetype| equals [=nullref=], return [=ref.null=].
1. If |valuetype| equals [=anyref=], return [=ToWebAssemblyValue=](undefined, |valuetype|).
Copy link
Member

Choose a reason for hiding this comment

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

externref

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

offset: offset=<nat>
align: align=(1|2|4|8|...)
cvtop: trunc | extend | wrap | ...

num_type: i32 | i64 | f32 | f64
ref_type: anyref | funcref | nullref
ref_kind: any | func
Copy link
Member

Choose a reason for hiding this comment

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

s/any/extern/

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -47,8 +46,8 @@ Notes:

Typing extensions:

* Introduce `anyref`, `funcref`, and `nullref` as a new class of *reference types*.
- `reftype ::= anyref | funcref | nullref`
* Introduce `funref` and `externref` as a new class of *reference types*.
Copy link
Member

Choose a reason for hiding this comment

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

funcref

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

(global (import "Mref_ex" "g-const-func") funcref)
(global (import "Mref_ex" "g-const-func") anyref)
(global (import "Mref_ex" "g-const-any") anyref)
(global (import "Mref_ex" "g-const-any") externref)
Copy link
Member

Choose a reason for hiding this comment

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

might want to rename these to "g-const-extern" too

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -9,8 +9,8 @@
(i32.add (local.get $x) (i32.const 1))
)

(global anyref (ref.func $f))
(global anyref (ref.func $g))
(global externref (ref.null extern))
Copy link
Member

Choose a reason for hiding this comment

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

can be removed now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@rossberg rossberg merged commit 551e876 into master May 7, 2020
@rossberg rossberg deleted the nosub branch May 7, 2020 07:38
alexcrichton added a commit to alexcrichton/wasmparser.rs that referenced this pull request May 12, 2020
Update the implementation given WebAssembly/reference-types#87 which
removed subtyping and renamed "anyref" to "externref"
alexcrichton added a commit to alexcrichton/wasmparser.rs that referenced this pull request May 12, 2020
Update the implementation given WebAssembly/reference-types#87 which has
a number of changes to the reference types implementation:

* Subtyping is removed
* `nullref` as a type was removed
* `anyref` was renamed to `externref`
* `ref.null` and `ref.is_null` take immediate type arguments as to what
  kind of `null` they're producing.

The spec testsuite repo has not yet updated with this change yet, so the
tests are temporarily vendored here in the `tests/wast` directory.
alexcrichton added a commit to alexcrichton/wasmparser.rs that referenced this pull request May 12, 2020
Update the implementation given WebAssembly/reference-types#87 which has
a number of changes to the reference types implementation:

* Subtyping is removed
* `nullref` as a type was removed
* `anyref` was renamed to `externref`
* `ref.null` and `ref.is_null` take immediate type arguments as to what
  kind of `null` they're producing.

The spec testsuite repo has not yet updated with this change yet, so the
tests are temporarily vendored here in the `tests/wast` directory.
alexcrichton added a commit to alexcrichton/wasmparser.rs that referenced this pull request May 12, 2020
Update the implementation given WebAssembly/reference-types#87 which has
a number of changes to the reference types implementation:

* Subtyping is removed
* `nullref` as a type was removed
* `anyref` was renamed to `externref`
* `ref.null` and `ref.is_null` take immediate type arguments as to what
  kind of `null` they're producing.

The spec testsuite repo has not yet updated with this change yet, so the
tests are temporarily vendored here in the `tests/wast` directory.
yurydelendik pushed a commit to bytecodealliance/wasmparser that referenced this pull request May 12, 2020
* Update implementation of reference types

Update the implementation given WebAssembly/reference-types#87 which has
a number of changes to the reference types implementation:

* Subtyping is removed
* `nullref` as a type was removed
* `anyref` was renamed to `externref`
* `ref.null` and `ref.is_null` take immediate type arguments as to what
  kind of `null` they're producing.

The spec testsuite repo has not yet updated with this change yet, so the
tests are temporarily vendored here in the `tests/wast` directory.

* Update TypedSelect validation
rossberg pushed a commit that referenced this pull request May 14, 2020
Change the test generators to use `ref.func` and remove `passive`.

At some point we'll want to remove the generators, but for let's try to
maintain them.
Horcrux7 added a commit to i-net-software/JWebAssembly that referenced this pull request May 30, 2020
jayphelps added a commit to jayphelps/binaryen that referenced this pull request Jun 9, 2020
jayphelps added a commit to jayphelps/binaryen that referenced this pull request Jun 9, 2020
jayphelps added a commit to jayphelps/binaryen that referenced this pull request Jun 9, 2020
aheejin pushed a commit to WebAssembly/binaryen that referenced this pull request Jun 10, 2020
anyref future semantics were changed to only represent opaque host values, and thus renamed to externref.

[Chromium](https://bugs.chromium.org/p/v8/issues/detail?id=7748#c360) was just updated to today (not yet released). I couldn't find a Mozilla bugzilla ticket mentioning externref so I don't immediately know if they've updated yet.

WebAssembly/reference-types#87
aheejin added a commit to aheejin/binaryen that referenced this pull request Aug 31, 2020
This updates reference types proposal up-to-date, per
WebAssembly/reference-types#87.

Only maybe half of tests have been updated, so CI will not pass. I was
in the process of updating them fully, but I noticed WebAssembly#3084, so I'm not
sure if I continue to do this anymore. I asked him if he wanted to do it
himself to prevent this situation but apparently my questions weren't
answered and I didn't know that he was working on this at the same time.

I'm uploading this anyway in case this is necessary for discussions.
aheejin added a commit to aheejin/binaryen that referenced this pull request Aug 31, 2020
This updates reference types proposal up-to-date, per
WebAssembly/reference-types#87.

Only maybe half of tests have been updated, so CI will not pass. I was
in the process of updating them fully, but then I noticed WebAssembly#3084, so I'm
not sure if I should continue to do this anymore. I asked him if he
wanted to do it himself to prevent this situation but apparently my
questions weren't answered and I didn't know that he was working on this
at the same time.

I'm uploading this anyway in case this is necessary for discussions.
bertogg pushed a commit to Igalia/webkit that referenced this pull request Nov 19, 2020
https://bugs.webkit.org/show_bug.cgi?id=218885

Patch by Dmitry Bezhetskov <dbezhetskov@igalia.com> on 2020-11-18
Reviewed by Yusuke Suzuki.

Make funcref is not a subtype of externref.
The spec: https://webassembly.github.io/reference-types/core/
The PR for removing subtype from the spec:
WebAssembly/reference-types#87.

JSTests:

* wasm/references/func_ref.js:
(assert.eq.instance.exports.fix.fun):
(assert.eq.instance.exports.fix):
* wasm/references/validation.js:

Source/JavaScriptCore:

* wasm/WasmFormat.h:
(JSC::Wasm::isSubtype):
* wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parseExpression):
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::link):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@270015 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ryanhaddad pushed a commit to WebKit/WebKit that referenced this pull request Dec 22, 2020
https://bugs.webkit.org/show_bug.cgi?id=218885

Patch by Dmitry Bezhetskov <dbezhetskov@igalia.com> on 2020-11-18
Reviewed by Yusuke Suzuki.

Make funcref is not a subtype of externref.
The spec: https://webassembly.github.io/reference-types/core/
The PR for removing subtype from the spec:
WebAssembly/reference-types#87.

JSTests:

* wasm/references/func_ref.js:
(assert.eq.instance.exports.fix.fun):
(assert.eq.instance.exports.fix):
* wasm/references/validation.js:

Source/JavaScriptCore:

* wasm/WasmFormat.h:
(JSC::Wasm::isSubtype):
* wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parseExpression):
* wasm/js/WebAssemblyModuleRecord.cpp:
(JSC::WebAssemblyModuleRecord::link):

Canonical link: https://commits.webkit.org/231756@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270015 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants