Closed Bug 1635534 Opened 4 years ago Closed 4 years ago

Remove funcref as subtype of anyref

Categories

(Core :: JavaScript: WebAssembly, task)

task

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: rhunt, Assigned: rhunt)

References

Details

Attachments

(8 files)

Follow-through with bug 1617825. This will depend on upstream work in wat and the reference-types spec.

I've filed [1] for the changes to wat. [2] has the changes to the reference-types spec.

I've written patches that use the new wat along with an import of the modified reference-types repo. I'm going to upload them for review now, although committing them will have to wait until both upstream changes are merged.

One notable difference from the upstream spec changes, anyref is still allowed as an alias of externref and the majority of code around this naming is unchanged for now.

[1] https://github.com/bytecodealliance/wat/pull/85
[2] https://github.com/WebAssembly/reference-types/pull/87

This commit does not stand entirely alone, the nullref type is still left
dangling in the ref.null validation and in the subtyping code. The next
two commits will fix that.

Assignee: nobody → rhunt
Status: NEW → ASSIGNED

The ref.null and ref.is_null instructions now take a reftype as a parameter.
This is encoded immediately after the instruction in the usual way for value
types. The only real change is to validation here.

Depends on D73957

This commit changes the subtyping algorithm so that:

T <: T
optref T <: anyref
optref T <: optref U (if U prefix T)

Notably, we're not allowing funcref <: anyref conditionally on GC types being
enabled as that complicates testing quite a bit. V8 is also not intending to
have funcref <: anyref in their MVA so this would align us with them.

Depends on D73959

This commit changes the error message for a type mismatch to include the type
index, if there is one.

Depends on D73961

This commit renames all user-exposed references of anyref to externref. The
codebase continues to use 'anyref' until there is suitable chance to make the
switch over.

Depends on D73963

This commit updates the jit-tests for the change to ref.null/is_null, removal
of nullref, and removal of funcref <: anyref.

Most changes are syntactic to include the type on ref.null/is_null. There are
several tests of subtyping that had to be inverted to test that funcref </: anyref.

Depends on D73965

There are two bulk-memory-operation tests that were marked as failing as that
spec hasn't been updated for the reference-types changes yet. I will re-enable
them as soon as bulk-memory-operations is updated, we should still have test
coverage in reference-types for the time being.

Depends on D74694

Pushed by rhunt@eqrion.net:
https://hg.mozilla.org/integration/autoland/rev/146fff883269
Remove the nullref type. r=lth
https://hg.mozilla.org/integration/autoland/rev/baebcd065671
Use reftype immediate on ref.null/ref.is_null. r=lth
https://hg.mozilla.org/integration/autoland/rev/9ec8e32625e0
Remove subtype relationship from funcref/anyref. r=lth
https://hg.mozilla.org/integration/autoland/rev/443cef6c1255
Improve error message for type mismatches. r=lth
https://hg.mozilla.org/integration/autoland/rev/4ba4ba0c830e
Rename anyref to externref in JS-API. r=lth
https://hg.mozilla.org/integration/autoland/rev/61a69a9af942
Update jit-tests. r=lth
https://hg.mozilla.org/integration/autoland/rev/9ab3b357f91d
Update wat to 1.0.17. r=lth
https://hg.mozilla.org/integration/autoland/rev/a9931c20cbfb
Update reference-types test import. r=lth
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: