| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of doing all of the S2Wasm work in the constructor, split
construction, scanning (to determine implemented functions) and building
of the wasm module.
This allows the linker to get the symbol information (e.g. implemented
functions) without having to build an entire module (which will be
useful for archives) and to allow the linker to link a new object into
the existing one by building the wasm module in place on the existing
module.
|
| |
|
|
|
| |
s2wasm currently creates a Call AST node if the target is implemented in the current object (thus far assumed to be the final executable) and a CallImport node if not. In preparation for adding additional objects to the link before layout time, we make only Call nodes until link time, and then convert them to CallImport if they are undefined at that time.
|
|
|
|
|
| |
Create the LinkerObject class, which has a wasm Module and represents the module plus the information needed to relocate and lay it out. Each Linker owns a "main executable" LinkerObject, and S2WasmBuilder requires a LinkerObject instead of just a Module because LLVM asm files require relocation/linking before they represent a full wasm module.
No merging support yet, but the real functionality for #370 is coming soon.
|
|
|
|
| |
Also defer address assignment until layout time in preparation for
separating linker objects out from Linker
|
|
|
|
|
| |
This is the first of a couple of refactorings in for #370
No functionality change, and minimal code change to make it work.
|
| |
|
| |
|
|
|
|
| |
function, to avoid confusion with having both visit* and visitExpression in a single pass (#357)
|
|
|
|
| |
the distinction is not really that useful, and passes do need to allocate, so we would need to pass around AllocatingModules all around anyhow. (#361)
|
|
|
|
| |
names are kept on the Function object (#354)
|
|
|
|
| |
* allow traversals to mark themselves as function-parallel, in which case we run them using a thread pool. also mark some thread-safety risks (interned strings, arena allocators) with assertions they modify only on the main thread
|
|
|
|
| |
locals. preparation for #336 (#349)
|
|
|
|
|
|
|
|
|
|
|
| |
* Generate emscripten dynCall thunks in s2wasm
Part of the usual emscripten glue for asm.js is thunks for calling
functions on the module given a function pointer; aka a dynCall. This is
implemented via thunks generated on the Module called
'dynCall_<signature>'. This gives support to s2wasm to generate these
thunks in the wasm module along with other emscripten glue. It also
introduces a flag to s2wasm to make generation of emscripten glue
optional.
|
|
|
|
|
| |
Currently it's not called anywhere.
The bulk of this change is refactoring to add makeFunction, makeCallIndirect, and makeReturn
to wasm::Builder, and make S2wasmBuilder call it
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* refactor core walking to not recurse
* add a simplify-locals test
* reuse parent's non-branchey scan logic in SimpleExecutionWalker, reduce code duplication
* update wasm.js
* rename things following comments
|
| |
|
|
|
|
|
|
| |
* Fix output of initializer list metadata
Turns out trailing commas aren't valid JSON
|
|
|
|
|
|
| |
This fixes 2 bugs in s2wasm:
* Handle address-taken aliases (i.e. when they appear in relocations), by looking up and subsituting the address of the aliasee.
* Skip whitespace at the top of the scan() loop instead of requiring it to match. When there are multiple alias declarations in a row, the match("FUNCTION") at the end of an alias delcaration consumes the whitespace at the beginning of the next line, causing it to fail to match the tab character specified in the match pattern at the top of the loop.
|
|
|
|
|
|
| |
Unlike asm.js modules, wasm modules cannot have imported/extern
objects. So allocate __dso_handle (which is traditionally defined in
a crtbegin or similar toolchain file linked with the user code) in s2wasm.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Properly align the stack pointer
By default (if no global base is given) the global base is 1, which
seems wrong. In this case the stack pointer gets an address of 1, which
is unaligned and definitely wrong. So, start the global base at 0 instead of
1 by default and align the stack pointer. Also factor allocation of
statics into a function.
* unconditionally allocate stack pointer; explicitly reserve address 0
|
|
|
|
|
|
|
| |
LLVM emits static initializers in the ELF style, by placing pointers to
the constructor functions in a .init_array section. Handle this in
s2wasm for now by converting these to standard emscripten metadata.
|
| |
|
| |
|
|\
| |
| | |
Fix grow_memory translation on s2wasm
|
| |
| |
| |
| |
| | |
s2wasm used to mistranslate grow_memory operation in .s into memory_size
in .wast, and this CL fixes it.
|
| | |
|
| | |
|
| |
| |
| |
| | |
since pow() returns a double. Cleans VS build warnings C4244: '=': conversion from 'double' to 'size_t', possible loss of data.
|
| | |
|
| | |
|
| |
| |
| |
| | |
If not given, fall back to size calculated by the link step.
|
| |
| |
| |
| |
| | |
This makes them symmetric to binary relational operators.
Also support eqz in the s2wasm parser.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
The AST and everything that uses it treats the values as
pages. Javascript continues to use bytes.
This matches v8 and sexpr-wasm, and the consensus from live discussion
and PR209 in the spec.
|
| | |
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Also update waterfall revision and LLVM-generated tests.
|
|
|
|
|
|
|
|
|
| |
The ordering changed in: https://github.com/WebAssembly/spec/pull/221
Which changed the spec tests, breaking sexpr-wasm because it pulls in the spec tests. This was then fixed:
https://github.com/WebAssembly/sexpr-wasm-prototype/commit/23dc368148fc7827a603e3853f5a40287eb9effe
Which in turn breaks when binaryen feeds sexpr-wasm .wast files with the old select operand ordering.
Note that this PR has new failures when running the torture tests in binaryen-shell: the order of evaluation is correct in binaryen-shell but isn't emitted properly by LLVM in the .s files. This will require another patch to fix LLVM.
|
| |
|