| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
There is a spec test for this, but spectest-interp only runs the
validator in `binary-reader-interp.cc`, which is different than the
validator in `validator.cc`. This is necessarily so, since some
checks only make sense when the module is linked or instantiated.
This fixes issue #894.
|
|
|
|
|
| |
This demonstrates sharing memory between a WebAssembly module and the
embedder.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Importing from host modules used to be handled by a delegate, which is a
powerful enough solution to allow for all host import behaviors, but
makes the common case difficult and clunky.
It also assumed that every imported function/global/etc. needed to be
newly created and added to the environment, which is OK (though
wasteful) for functions, but is incorrect for mutable values like
memories and globals.
This change simplifies the common case by providing a set of functions
on `HostModule` that can be used to add exports, e.g.
AppendFuncExport("add", {{Type::I32, Type::I32}, {Type::I32}},
AddFunc);
A generic interface for functions is provided as well, to allow for
automatically generating functions as needed. This is currently used for
functions like "host.print" in `wasm-interp`.
|
| |
|
|
|
|
|
| |
The previous change fixed a bug that occurs if a host function traps.
This change adds a test for that case, both for when the host function
is called directly and via `call_indirect`.
|
| |
|
|
|
|
|
|
|
|
| |
The newest testsuite update enables mutable globals by default, which
matches the v1 WebAssembly spec.
This change changes the default for all wabt tools, and changes the flag
to `--disable-mutable-globals` in case you need the previous behavior.
This flag will likely be removed in the future.
|
|
|
| |
Resolves #872
|
|
|
| |
This was recently changed in emscripten. It seems that ssize_t can be used directly now, so defining it is only necessary for MSVC.
|
|
|
| |
Fixes #866.
|
|
|
| |
Resolves #864
|
|
|
| |
The maximum number of locals in a function is 2**32-1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use the `--enable-multi-value` flag to enable.
A lot of code already "worked" with multi-value, and just needed to
remove the restrictions. Most of the other changes are modifying the
callback APIs to be more general, e.g. taking more than 1 result type.
* Types are now stored as the negative values; this works nicely with
the encoding of inline function types (used for block signatures),
which are always positive values.
* Remove `BlockSignature` and use `BlockDeclaration` instead, which
is just a typedef to `FuncSignature`. This allows for explicit or
implicit type specifications on the block signatures.
* Allow for >1 "keep" values in the DropKeep interpreter instruction
|
| |
|
|
|
| |
Closes #857
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some type-checking only occurs at the end of a block, but the location
that is generated uses the last expression of that block. This can be
confusing if there are nested blocks, e.g.
```
1 block (result i32)
2 block
3 nop
4 end
5 end
```
This should produce an error at line 5, not line 3.
This PR stores the locations of the end of a block (either the `end` or
the closing parenthesis) so its easier to understand where the error
occurred.
|
|
|
|
|
|
|
|
|
| |
It's not correct to use `--pre-js` and `--post-js` to wrap the module in
a function instance; instead we're supposed to use `-s MODULARIZE=1`.
This still keeps the build as (almost) asm.js, as switching to wasm is a
bit more work (we need to preload the wasm binary module).
This fixes issue #853.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
`grow_memory` -> `memory.grow`
`current_memory` -> `memory.size`
This could have been a smaller change, but I took the opportunity to
rename the Token types, Expr types, and callback functions too. Many of
these are sorted alphabetically, so I resorted based on their new names.
|
|
|
| |
This fixes issue #844.
|
| |
|
|
|
|
|
|
|
| |
The previous message said "error", which makes it look like the output
is not created, so change the message to "warning" instead.
The error handling code is pretty ugly and can use a refactor, but that
would be a much larger change.
|
| |
|
| |
|
|
|
|
|
| |
If the `stop_on_first_error` flag was set, it would still stop
reading the wasm file, even if `--ignore-custom-section-errors` flag was
set.
|
|
|
| |
Also remove `WASM_RT_DEFINE_EXTERNAL`, as it doesn't seem to be used.
|
|
|
|
| |
Also Put `<>` around other names (functions, locals).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a wasm engine fails to parse a custom section, it must not be an
error. In wabt we often won't want to continue if a custom section can't
be parsed, but it still may be useful to be able to continue.
This change adds a new flag `--ignore-custom-section-errors` to
`wasm2wat` and `wasm-validate`, which will partially parse a custom
section with errors. This could lead to some strange behavior (partially
completed data structures), but generally should be safe to do.
See issue #378 and the discussion on pull #830 for more info.
|
|
|
|
|
|
|
|
|
| |
When converting v128.shuffle from wasm format to wat format, the '$' char
must be removed as the const value in v128.shuffle instruction expects
a valid simd v128 const format,
i.e. 0xXXX 0xXXX 0xXXX 0xXXX or Int32 Int32 Int32 Int32
otherwise it will encounter errors when converting
v128.shuffle from wat format back to wasm format again.
|
|
|
|
| |
Also add parsing of linking metadata version.
|
| |
|
|
|
|
|
|
| |
Also clean up `LocalTypes` a bit, so we can ensure that `decls_` never
has a count of 0.
Fixes issue #826. Thanks for finding @opticaliqlusion!
|
|
|
| |
None of the feature flags are currently supported. Fixes issue #823.
|
|
|
| |
See issue #823.
|
|
|
|
|
|
|
|
| |
See https://github.com/WebAssembly/wabt/issues/760 for more info.
We assume that a count precedes a list of items that are at least one
byte that are all contained in the same section. As a result, we can do
an up-front check to prevent over-allocation. This is the same technique
that the spec interpreter uses.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the binary format stores locals as Type+Count pairs, it is easy to
generate a function with a huge number of locals. The text format has
no way to compress this, so the resulting file will be huge.
However, if the binary file has an error, it would be useful to be able
to catch it without allocating a huge number of locals.
To do so, we store all locals as Type+Count pairs in the IR as well, and
provide accessor functions for getting the number of local types, the
type of a particular local index, etc.
This fixes issue #819.
|
|
|
|
| |
Remove _Check_Return_ annotation on Windows because that annotation must be a prefix to the function not a suffix which was breaking the code analysis on binary-reader.cc.
Couldn't find a way to reconcile clang/gcc/msvc to all use a prefix or suffix for that annotation, furthermore it is not used a lot in the project anyway.
|
|
|
|
| |
Also fix tracing for *.splat opcodes.
|
|
|
| |
This makes it easier to use outside of running wasm2c spec tests.
|
| |
|
|
|
|
| |
Non-functional change.
|
|
|
|
| |
I also fixed some for/if to use braces if I noticed it. This is a
non-functional change.
|
| |
|
|
|
| |
Also add a typecheck test.
|
| |
|
|
|
|
|
|
|
|
|
| |
Including:
i8x16.replace_lane
i16x8.replace_lane
i32x4.replace_lane
i64x2.replace_lane
f32x4.replace_lane
f64x2.replace_lane
|
|
|
|
| |
Fixes issue #807.
|
|
|
|
|
|
|
|
|
|
| |
Including:
i8x16.extract_lane_u
i16x8.extract_lane_s
i16x8.extract_lane_u
i32x4.extract_lane
i64x2.extract_lane
f32x4.extract_lane
f64x2.extract_lane
|
|
|
|
|
| |
Including:
1. All necessary code for SIMD lanes accessing.
2. i8x16.extract_lane_s implementation.
|