summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-emscripten.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Expand asmConsts metadata to fit the shape of proxying async EM_ASMs (no ↵Jacob Gravelle2018-10-251-0/+6
| | | | actual support) (#1711)
* More #1678 fixes (#1685)Alon Zakai2018-09-201-0/+3
| | | While debugging to fix the waterfall regressions I noticed that wasm-reduce regressed. We need to be more careful with visitFunction which now may visit an imported function - I found a few not-well-tested passes that also regressed that way.
* fix an iterator invalidation regression from #1678 (#1684)Alon Zakai2018-09-201-5/+24
| | | Fixes the 3 regressions mentioned in a comment on #1678
* Unify imported and non-imported things (#1678)Alon Zakai2018-09-191-45/+44
| | | | | | | | | | | | | | Fixes #1649 This moves us to a single object for functions, which can be imported or nor, and likewise for globals (as a result, GetGlobals do not need to check if the global is imported or not, etc.). All imported things now inherit from Importable, which has the module and base of the import, and if they are set then it is an import. For convenient iteration, there are a few helpers like ModuleUtils::iterDefinedGlobals(wasm, [&](Global* global) { .. use global .. }); as often iteration only cares about imported or defined (non-imported) things.
* Remove assert that import names match (#1662)Jacob Gravelle2018-08-311-4/+0
| | | | | We're about to rewrite both names anyway. This fixes LLVM's c++ invokes, which get escaped to not match as of PR #1646
* Run legalize-js-interface during wasm-emscripten-finalize (#1653)Sam Clegg2018-08-291-1/+1
| | | | This ensures that 64-bit values are correctly handled on the JS boundary.
* wasm-emscripten-finalize: Don't allow duplicates in 'declares'/'invok… (#1655)Sam Clegg2018-08-291-2/+10
| | | | | Allowing duplicates here was causes emscripten to generate a JS object with duplicate keys.
* Remove s2wasm (#1607)Sam Clegg2018-06-281-26/+12
| | | | s2wasm is no longer used my emscripten and as far as I know now as no other users.
* Fix check in fixInvokeFunctionNames (#1588)Sam Clegg2018-06-061-1/+1
| | | | This check is supposed to check if rename is needed so it need to compare to the original.
* Ensure import and function names match during fixInvokeFunctionNames (#1587)Sam Clegg2018-06-051-1/+5
| | | | | | We ran into an issue recently where wasm-emscripten-finalize was being passed input without any debug names and this is not currently supported.
* Always incorporate the table segment offset when calculating ↵Jacob Gravelle2018-06-011-4/+4
| | | | jsCallStartIndex (#1579)
* wasm-emscripten: Don't use debug names in implementedFunctions (#1537)Sam Clegg2018-05-151-2/+4
| | | | | | | | | | | | | | implementFunctions should use the export names, not the internal/debug name for a function. This is especially imported with lld where the debug names are demanagled. implementFunctions should only contain functions that are accessible from outside the module. i.e. those that have been exported. There is no point in adding internal-only functions to this list as they won't be accessible from outside anyway. Tesed with emscripten using: ./tests/runner.py binaryen2.test_time
* Move the renaming of llvm-generated __invoke_XX functions from s2wasm into ↵Sam Clegg2018-05-101-8/+134
| | | | | | | | | wasm-emscripten (#1539) This allows the same functionality to be used also in wasm-emscripten-finalize (i.e. the lld path).
* Function pointer cast emulation (#1468)Alon Zakai2018-03-131-0/+664
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.