Closed Bug 1649247 Opened 4 years ago Closed 4 years ago

Add support for GC type eqref

Categories

(Core :: JavaScript: WebAssembly, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: volker.berlin, Assigned: rhunt)

References

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:79.0) Gecko/20100101 Firefox/79.0

Steps to reproduce:

I try to use eqref from the M2 of the GC prototype. I compile the follow code with the function wasmTextToBinary:

(module
  (func $test(local $val eqref)
  )
)

And then I try to instanciate it with WebAssembly.instantiate. I run the script with js --wasm-gc test.js

Actual results:

The text is compiled but the binary was not loaded. I receive:

CompileError: wasm validation error: at offset 25: bad type

Blocks: 1625595
Severity: -- → S3
Priority: -- → P3
Status: UNCONFIRMED → NEW
Ever confirmed: true

I have patches for this after bug 1669784.

Assignee: nobody → rhunt
Depends on: 1669784

This commit adds support for the eqref value type. It shares the same
representation as externref, with the restriction that all values must
be TypedObject's. Dynamic type checks similar to funcref are added to
stubs.

As fallout from anyref removal, struct types were left as subtypes of
externref. This commit switches them to be subtypes of eqref.

As a small tweak, the ordering on cases when switching on refTypeKind()
were standardized to binary order (i.e. funcref, externref, eqref).

I think we can refactor some code to simplify the process of adding
new reftypes and would like to do that in the future.

Give ref.eq type of [eqref, eqref] : [i32], closing a corner case where boxed
JS values could be compared for equality.

Restrict struct.narrow to operate on eqref, as that's the super type of structs.
This also allows us to drop an unboxing from externref -> typed object as that
is now done in all wasm entries.

Depends on D93000

The existing gc tests relied on struct <: externref in various ways,
this commit fixes this.

Additionally a new test is added for checking we have dynamic tests
for eqref on all wasm value entry points.

Depends on D93001

Pushed by rhunt@eqrion.net:
https://hg.mozilla.org/integration/autoland/rev/8a41359f69f9
wasm: Implement eqref. r=lth
https://hg.mozilla.org/integration/autoland/rev/b8c11e84c63e
wasm: Refine struct.narrow and ref.eq to use eqref input types. r=lth
https://hg.mozilla.org/integration/autoland/rev/2d25e9f9b077
wasm: Fix tests and add new one for eqref. r=lth
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: