diff options
author | Thomas Lively <tlively@google.com> | 2024-08-21 10:39:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-21 10:39:09 -0700 |
commit | 7889abf8137291cc591cac8f38570789ebaf354d (patch) | |
tree | 135b0de5f6ab7c696cfe0796f4a2f4b98901aabe /src/wasm/literal.cpp | |
parent | adf53b3b7606a16988b548fe5423b0272913a05a (diff) | |
download | binaryen-7889abf8137291cc591cac8f38570789ebaf354d.tar.gz binaryen-7889abf8137291cc591cac8f38570789ebaf354d.tar.bz2 binaryen-7889abf8137291cc591cac8f38570789ebaf354d.zip |
Support `ref.extern n` in spec tests (#6858)
Spec tests pass the value `ref.extern n`, where `n` is some integer,
into exported functions that expect to receive externrefs and receive
such values back out as return values. The payload serves to distinguish
externrefs so the test can assert that the correct one was returned.
Parse these values in wast scripts and represent them as externalized
i31refs carrying the payload. We will need a different representation
eventually, since some tests explicitly expect these externrefs to not
be i31refs, but this suffices to get several new tests passing.
To get the memory64 version of table_grow.wast passing, additionally fix
the interpreter to handle growing 64-bit tables correctly.
Delete the local versions of the upstream tests that can now be run
successfully.
Diffstat (limited to 'src/wasm/literal.cpp')
-rw-r--r-- | src/wasm/literal.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 650318be3..d60e2f8a9 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -463,6 +463,9 @@ bool Literal::operator==(const Literal& other) const { if (type.getHeapType().isMaybeShared(HeapType::i31)) { return i32 == other.i32; } + if (type.getHeapType().isMaybeShared(HeapType::ext)) { + return internalize() == other.internalize(); + } WASM_UNREACHABLE("unexpected type"); } WASM_UNREACHABLE("unexpected type"); |