summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Update testsuite to 646b43e (#1555)Wouter van Oortmerssen2020-09-3020-2346/+119
| | | (this is HEAD~1 as of this writing, HEAD containing the Memory64 tests which I want to land separately)
* Disallow "64-bit" flag if memory64 is disabled (#1547)Paweł Bylica2020-09-1811-4/+33
| | | | Fixes regressions in binary reader introduced by the implementation of the memory64 extension: https://github.com/WebAssembly/wabt/pull/1500.
* Disallow non-zero memidx when bulk memory disabled (#1546)Paweł Bylica2020-09-173-0/+22
| | | | If bulk memory extension is disabled, do not allow memory index in the data segment other than zero.
* Fix up reloc-related tests after #1537 (#1545)Andy Wingo2020-09-173-13/+15
| | | | | | | | | * Fix up reloc-related tests after #1537 PRs #1527 and #1539 needed their test expectations updated after #1537 was merged; this patch does that. It also renames a test for consistency. * Adapt test to renaming
* wat2wasm: fix relocation offsets (#1527)sammax2020-09-163-8/+269
| | | | | | | | | | * fix reloc offsets * test long function section and long function bodies (relocation offsets depend on the length of the function size encoding but not on the length of the function section size encoding) * remove unused variable * add preceding function in test
* Fix reloc section references when --enable-bulk-memory (#1539)Andy Wingo2020-09-163-3/+61
| | | | | | | * Fix reloc section references when --enable-bulk-memory Fixes #1538. * Add assertions about successors to elided DataCount section
* Eager symbol tables (#1537)Andy Wingo2020-09-164-53/+202
| | | | | | | | | | | | | | | | | | | | | | | * Eagerly create symbol tables when writing relocatable binaries Instead of adding entries to the symbol table as they are referenced, when writing relocatable binaries, we're going to make symbols for all functions. This allows exported functions and globals to be written with the proper exported / no_strip flags, so that resulting files will link with wasm-ld. * Symbol table names are export names, without the dollar. In the previous commit, I wrongly assumed that the globally visible name for linking was taken from the exports section, whereas actually it's from the symbol table. Therefore this patch changes to strip off the dollar, and also to make all named bindings globally visible. The exported-to-the-host binding is mostly unrelated to the visible-to-other-compilation-units binding. Unnamed definitions aren't added to the symbol table. * Add symbol tables test * Rename Intern helper to EnsureUnique
* Fix RefPtr::empty() (#1544)Andrei Maiboroda2020-09-142-1/+4
|
* add missing case for R_WASM_GLOBAL_INDEX_I32 relocation (#1541)Dominic Chen2020-09-101-0/+1
|
* Refactor symbol table creation in binary writer (#1535)Andy Wingo2020-09-101-44/+157
| | | | This commit refactors the representations of symbols in the binary writer. It will allow us to fix #1534 in a followup.
* Fix bug when writing multi-value block type (#1533)Ben Smith2020-09-086-2/+182
| | | | | | | | | * Fix bug when writing multi-value block type The block type must be written as an SLEB, not an LEB. We also want it to be relocatable, so I added a way to write a fixed-size SLEB too (`WriteS32Leb128WithReloc` and `WriteFixedS32Leb128`). * Fix ubsan issue
* Implement simd bitmask instructions (#1530)Ben Smith2020-08-3110-529/+631
|
* blocktype relocations (#1526)sammax2020-08-222-1/+51
|
* wat2wasm: type relocations (#1525)sammax2020-08-203-32/+38
|
* Fix integer overflow in objdump name tracking (#1524)Sam Clegg2020-08-198-26/+46
| | | | Fixes: #1520
* Enable -Werror during CI (#1522)Sam Clegg2020-08-187-32/+35
| | | | Fixes: #1249
* Fix warnings generated in my system clang (9.0.1-12) (#1521)Sam Clegg2020-08-182-3/+3
| | | | I guess maybe we don't do CI with `-Werror` enabled? We probably should.
* Enable multi-core build on Windows (#1516)Wouter van Oortmerssen2020-08-101-0/+4
| | | This speeds up builds of WABT significantly
* Update README.md to include default-on proposals (#1515)Ben Smith2020-08-101-15/+16
| | | | | Some proposals are enabled by default now, so the README should reflect that. Also, the flag was flipped to disable (rather than enable), so change that here too. See issue #1513.
* Made the interpreter "type-safe" in debug mode (#1512)Wouter van Oortmerssen2020-08-107-75/+107
| | | | | Adds a type field to `Value` to verify the right union member is being read. A Wasm module that has been validated shouldn't need this, but any code reading the wrong value would trigger UB, but still often work (like a uint32_t read from a uint64_t on little endian machine), and mask bugs. Turning this on found bugs in the PR I just landed (as I suspected) but also in older code.
* wast2json: improved file error handling (#1511)Oliver Horn2020-08-101-4/+11
| | | | The result values of the `WriteToFile` calls for `json_stream` and `module_streams` are now evaluated and checked.
* Added initial "memory64" proposal support (#1500)Wouter van Oortmerssen2020-08-0757-287/+1489
|
* Add tools to use LLVM's libFuzzer (#1507)Ben Smith2020-08-034-16/+91
| | | | This is useful for reproducing bugs found by oss-fuzz (see https://bugs.chromium.org/p/oss-fuzz/issues/list?q=wabt)
* Fix linking section symbol name bugs (#1508)Ben Smith2020-07-315-0/+128
| | | Found by oss-fuzz.
* Reformat code in binary-reader.cc (#1506)Paweł Bylica2020-07-311-5/+3
|
* Detect malformed memory/table limits flag (#1505)Paweł Bylica2020-07-316-6/+59
| | | | | | | | | | | | | | * Read memory/table limits flags as uint8_t In the wasm spec the limits flag is a single byte, not a LEB128 encoded value. * Detect malformed memory/table limits flag * Disallow shared memory when threads are disabled This adds additional check to disallow "is_shared" (0x2) flag for memory limits when threads extensions is not enabled. Previously this flag was unconditionally accepted.
* Fix reading of section code (#1501)Paweł Bylica2020-07-312-2/+12
| | | | The section code is just a single byte, not a LEB128-encoded value. With this fix the section code is now read correctly with ReadU8().
* Print newline after rethrow instruction (#1503)Asumu Takikawa2020-07-302-1/+24
|
* Detect malformed import kind in binary reader (#1504)Paweł Bylica2020-07-302-0/+12
|
* Update testsuite; fix conversion errors (#1502)Ben Smith2020-07-2917-170/+9335
| | | | | | | | | | | | The interpreter and wasm2c were incorrectly handling some float-to-int conversions. For clarity, the wasm2c implementations of these conversions now matches the implementation in interp-math.h more closely (e.g. the numeric ranges are written as `x >= min && x <= max` in both cases). Quite a few wasm2c tests were previously being skipped, since wasm2c doesn't currently support multi-value; it's better instead to duplicate the tests here and disable the parts that are not supported so we don't lose test coverage.
* Fix assert when function has struct type (#1498)Ben Smith2020-07-253-1/+15
| | | | | | | Function types and struct types share an index space, but a function can only be defined using a function type. Since `Module::GetFuncType` already returns `nullptr` for an OOB index, it makes sense to return `nullptr` for an invalid type too.
* Print newline after ref.is_null instruction (#1495)Ben Smith2020-07-242-2/+3
|
* [decompiler] fixed blocks with params. (#1497)Wouter van Oortmerssen2020-07-234-16/+24
| | | | It would previously assume the blocktype is "simple" (at most a single result value), but now also supports function signatures. Also fixed it ignoring the validator result.
* Fix resolving local names w/ empty func signatures (#1494)Ben Smith2020-07-212-4/+2
| | | | | | | | | | | | | | This was originally landed in 6bff9f0, but was incorrect (the test didn't even do the right thing!) The problem was that the local index was correctly being updated, but it happened _after_ the names had already been resolved. To fix it, `ResolveFuncTypes` and `ResolveNamesModule` needed be called in that order. There was an erroneous assertion that fired as a result ("This should only be run after resolving names"), but that's incorrect -- the code works properly before resolving names too, since `Module::GetFuncType` can properly look up function types by name. Thanks to @alexcrichton for pointing this out.
* Completely disable signal handler on 32-bit (#1488)Ben Smith2020-07-211-8/+17
| | | | | The previous change prevented `WASM_RT_MEMCHECK_SIGNAL_HANDLER_POSIX` from being defined, but `WASM_RT_MEMCHECK_SIGNAL_HANDLER` was still defined, which would prevent the memory bounds check.
* Add missing includes to type.h (#1491)Ng Zhi An2020-07-201-0/+3
| | | | | | | - cassert for assert - confing.h for WABT_UNREACHABLE I think it was working because type.h was only included in common.h, both cassert and config.h was included prior to including type.h.
* Fix gcc warning in GetExprArity (#1489)Ben Smith2020-07-181-1/+2
| | | | | All enumeration values are handled in the switch, but it's still possible to produce an invalid value, which would not return.
* Use #warning instead of #warn (#1487)Ben Smith2020-07-161-1/+1
|
* Fix folding for *.load_splat and table.fill (#1486)Ben Smith2020-07-163-12/+879
| | | | Also remove default case from `ir-util.cc` so we get compile warnings in the future.
* Remove ref.is_null type parameter (#1474)Ben Smith2020-07-1526-89/+93
| | | | | | | | | See https://github.com/WebAssembly/reference-types/issues/99. This change also updates the testsuite, so the spec tests pass too. In addition, the behavior of `br_table` is no longer different from MVP, and has a text to confirm this. That is now fixed in `type-checker.cc` too.
* Revert br_table in reference types proposal (#1484)Ben Smith2020-07-153-17/+7
| | | | | | The reference types proposal originally modified the `br_table` behavior to only check arity, not the specific types. This was to remove a subtyping check, but now that subtyping has been removed, we can revert back to the original (MVP) br_table behavior.
* [wasm2c] Disable signal handling on 32-bit archs (#1483)Ben Smith2020-07-151-0/+4
|
* Fix some portability issues in interp-wasi.cc (#1480)Steven Johnson2020-07-131-32/+32
| | | | | _Static_assert and _Alignof aren't defined everywhere. Also use PRIu64 format specifier where needed. Co-authored-by: Ben Smith <binji@chromium.org>
* Tweak definition of ssize_t for MSVC compilation (#1479)Steven Johnson2020-07-121-0/+9
| | | This is designed to exactly mimic the definition that LLVM uses under MSVC; this allows use of both WABT and LLVM headers in the same codebase without having to work around compilation errors.
* Fix warning on comparison of void* to integer. fixes #1472 (#1473)Alon Zakai2020-06-221-1/+1
|
* Enable CMake policy CMP0077 (#1471)Steven Johnson2020-06-191-0/+4
| | | | | TL;DR: this makes it simpler and safer for projects including WABT via FetchContent to configure options via the CMAKE_ARGS argument. Importing projects may want to set (e.g.) BUILD_TESTS to "no". However, this doesn't work without creating an identical option() in the importing in the importing project. Enabling CMP0077 in supported versions of CMake allows importing projects to set default values for the variables without touching the cache.
* Update libwabt.js; fix some runtime issues (#1468)Ben Smith2020-06-182-18/+24
| | | | | | | libwabt.js is meant to be included in multiple environments (web, node.js, etc.) so it shouldn't be using NODERAWFS. A recent change to the build system include `-s NODERAWFS` for all link steps, but those are only needed for the wabt executables (e.g. wasm2wast.js).
* Improve CMakeLists.txt for when used via add_subdirectory() (#1467)Steven Johnson2020-06-181-2/+14
|
* Add install prefix for build releases [skip ci]Ben Smith2020-06-171-1/+1
|
* Update local bindings on function with type use (#1466)Ben Smith2020-06-162-3/+32
| | | | | | | | | | | | | | | | | | | | When a function is specified like this: (func (type $t) ...) the type can have any sequence of params and results, but it is not known what that signature is until it is resolved. However, locals that are parsed will be given a binding index under the assumption that the signature is empty, e.g. (func (type $t) (local $v0 i32) (local $v1 i32) ... ) So `$v0` will have index 0, and `$v1` will have index 1. If it turns out later that type `$t` has any parameters, then these indexes need to be updated.