diff options
author | Thomas Lively <tlively@google.com> | 2024-08-26 10:15:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-26 10:15:00 -0700 |
commit | dacc6e57048dc9af133c98ea3c843f8b912c9980 (patch) | |
tree | 8148a61bb1109a1661c7f1800047bcdbc2dc5619 /src/wasm | |
parent | 95a280f70ef529c3c506d628648a96f2d267f4c1 (diff) | |
download | binaryen-dacc6e57048dc9af133c98ea3c843f8b912c9980.tar.gz binaryen-dacc6e57048dc9af133c98ea3c843f8b912c9980.tar.bz2 binaryen-dacc6e57048dc9af133c98ea3c843f8b912c9980.zip |
Support more reference constants in wast scripts (#6865)
Spec tests use constants like `ref.array` and `ref.eq` to assert that
exported function return references of the correct types. Support more
such constants in the wast parser.
Also fix a bug where the interpretation of `array.new_data` for arrays
of packed fields was not properly truncating the packed data. Move the
function for reading fields from memory from literal.cpp to
wasm-interpreter.h, where the function for truncating packed data lives.
Other bugs prevent us from enabling any more spec tests as a result of
this change, but we can get farther through several of them before
failing. Update the comments about the failures accordingly.
Diffstat (limited to 'src/wasm')
-rw-r--r-- | src/wasm/literal.cpp | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 65c2b4e62..6a4614a90 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -294,24 +294,6 @@ Literal Literal::makeFromMemory(void* p, Type type) { } } -Literal Literal::makeFromMemory(void* p, const Field& field) { - switch (field.packedType) { - case Field::not_packed: - return makeFromMemory(p, field.type); - case Field::i8: { - int8_t i; - memcpy(&i, p, sizeof(i)); - return Literal(int32_t(i)); - } - case Field::i16: { - int16_t i; - memcpy(&i, p, sizeof(i)); - return Literal(int32_t(i)); - } - } - WASM_UNREACHABLE("unexpected type"); -} - Literal Literal::standardizeNaN(const Literal& input) { if (!std::isnan(input.getFloat())) { return input; |