Skip to content

Releases: WebAssembly/binaryen

version_49: Refactor stack writing code into a new StackWriter class (#1620)

16 Jul 19:50
e601522
Compare
Choose a tag to compare
This separates out the WasmBinaryWriter parts that do stack writing into a separate class, StackWriter. Previously the WasmBinaryWriter did both the general writing and the stack stuff, and the stack stuff has global state, which it manually cleaned up etc. - seems nicer to have it as a separate class, a class focused on just that one thing.

Should be no functional changes in this PR.

Also add a timeout to the wasm-reduce test, which happened to fail on one of the commits here. It was running slower on that commit for some reason, could have been random - I verified that general wasm writing speed is unaffected by this PR. (But I added the timeout to prevent future random timeouts.)

1.38.8

06 Jul 16:52
Compare
Choose a tag to compare
Fix out-of-tree install of wasm.js (#1616)

1.38.6

14 Jun 03:18
aab1613
Compare
Choose a tag to compare
Improve source map parsing to handle whitespace (#1598)

1.38.5: Add -g/--debuginfo flag to wasm-emscripten-finalize (#1584)

04 Jun 21:07
240c6bb
Compare
Choose a tag to compare
This brings this tool into parity with the existing s2wasm

1.38.4

29 May 23:21
91b90b7
Compare
Choose a tag to compare
allow --total-memory to be greater than a signed int32 (#1565)

1.37.38

23 Apr 19:12
Compare
Choose a tag to compare
refactor Set => Expr, as we will need more expressions, not just set …

1.37.36: Function pointer cast emulation (#1468)

13 Mar 18:46
d52213c
Compare
Choose a tag to compare
This adds a pass that implements "function pointer cast emulation" - allows indirect calls to go through even if the number of arguments or their types is incorrect. That is undefined behavior in C/C++ but in practice somehow works in native archs. It is even relied upon in e.g. Python.

Emscripten already has such emulation for asm.js, which also worked for asm2wasm. This implements something like it in binaryen which also allows the wasm backend to use it. As a result, Python should now be portable using the wasm backend.

The mechanism used for the emulation is to make all indirect calls use a fixed number of arguments, all of type i64, and a return type of also i64. Thunks are then placed in the table which translate the arguments properly for the target, basically by reinterpreting to i64 and back. As a result, receiving an i64 when an i32 is sent will have the upper bits all zero, and the reverse would truncate the upper bits, etc. (Note that this is different than emscripten's existing emulation, which converts (as signed) to a double. That makes sense for JS where double's can contain all numeric values, but in wasm we have i64s. Also, bitwise conversion may be more like what native archs do anyhow. It is enough for Python.)

Also adds validation for a function's type matching the function's actual params and result (surprised we didn't have that before, but we didn't, and there was even a place in the test suite where that was wrong).

Also simplifies the build script by moving two cpp files into the wasm/ subdir, so they can be built once and shared between the various tools.

version_45: Function pointer cast emulation (#1468)

13 Mar 17:15
d52213c
Compare
Choose a tag to compare
This adds a pass that implements "function pointer cast emulation" - allows indirect calls to go through even if the number of arguments or their types is incorrect. That is undefined behavior in C/C++ but in practice somehow works in native archs. It is even relied upon in e.g. Python.

Emscripten already has such emulation for asm.js, which also worked for asm2wasm. This implements something like it in binaryen which also allows the wasm backend to use it. As a result, Python should now be portable using the wasm backend.

The mechanism used for the emulation is to make all indirect calls use a fixed number of arguments, all of type i64, and a return type of also i64. Thunks are then placed in the table which translate the arguments properly for the target, basically by reinterpreting to i64 and back. As a result, receiving an i64 when an i32 is sent will have the upper bits all zero, and the reverse would truncate the upper bits, etc. (Note that this is different than emscripten's existing emulation, which converts (as signed) to a double. That makes sense for JS where double's can contain all numeric values, but in wasm we have i64s. Also, bitwise conversion may be more like what native archs do anyhow. It is enough for Python.)

Also adds validation for a function's type matching the function's actual params and result (surprised we didn't have that before, but we didn't, and there was even a place in the test suite where that was wrong).

Also simplifies the build script by moving two cpp files into the wasm/ subdir, so they can be built once and shared between the various tools.

1.37.35: Say "wat" instead of "wast". (#1430)

23 Feb 19:48
3262053
Compare
Choose a tag to compare
http://webassembly.org/docs/text-format/ says:

> The recommended file extension for WebAssembly code in textual format
> is .wat.

> Note: The .wast format understood by some of the listed tools is a
> superset of the .wat format that is intended for writing test scripts.

1.37.34: determinism fix: hash results may differ between runs (#1431)

16 Feb 19:00
27000a9
Compare
Choose a tag to compare
Hash results may differ between runs, as they can depend on pointers. In remove-duplicate-functions, that shouldn't matter, except that we only considered the first item in each hash group vs the others (to avoid O(N^2)), which is fine except for hash collisions (collisions mean 2 groups are merged into one, and considering just the first item vs the rest we miss out on the other duplicates in that single group). And hash collisions do occur (rarely) in practice. Instead, consider all comparisons in each hash group, which should be fine unless we have large amounts of hash collisions.