summaryrefslogtreecommitdiff
path: root/src/s2wasm.h
Commit message (Collapse)AuthorAgeFilesLines
...
* just use a simple vector in data segmentsAlon Zakai2016-04-271-21/+21
|
* Split construction, scanning, and building phases of S2WasmBuilder (#400)Derek Schuff2016-04-271-47/+62
| | | | | | | | | | | 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.
* add an ArenaVector for internal array allocations in expression nodesAlon Zakai2016-04-261-1/+1
|
* Defer creation of CallImports to link time (#395)Derek Schuff2016-04-261-20/+6
| | | 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.
* Separate LinkerObject from Linker (#383)Derek Schuff2016-04-251-21/+20
| | | | | 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.
* Simplify statics, segments, and relocations (#380)Derek Schuff2016-04-221-6/+11
| | | | Also defer address assignment until layout time in preparation for separating linker objects out from Linker
* Factor linker-related functionality of S2WasmBuilder into its own class (#372)Derek Schuff2016-04-211-376/+22
| | | | | This is the first of a couple of refactorings in for #370 No functionality change, and minimal code change to make it work.
* Parses more than one entry in the .init_array section.Yury Delendik2016-04-201-10/+14
|
* update MemorySize => CurrentMemoryAlon Zakai2016-04-181-1/+1
|
* create a UnifiedExpressionVisitor for passes that want a single visitor ↵Alon Zakai2016-04-181-1/+1
| | | | function, to avoid confusion with having both visit* and visitExpression in a single pass (#357)
* remove the AllocatingModule class, and just make Module have allocations. ↵Alon Zakai2016-04-181-2/+2
| | | | 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)
* index locals, so that get_local and set_local have just an index, and local ↵Alon Zakai2016-04-181-11/+12
| | | | names are kept on the Function object (#354)
* Function parallelism (#343)Alon Zakai2016-04-151-3/+2
| | | | * 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
* rename function locals, to params and vars, which together are all the ↵Alon Zakai2016-04-141-4/+4
| | | | locals. preparation for #336 (#349)
* Generate emscripten dynCall thunks in s2wasm (#342)Derek Schuff2016-04-131-13/+23
| | | | | | | | | | | * 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.
* Add a method to generate a dyncall thunk (#337)Derek Schuff2016-04-121-18/+35
| | | | | 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
* dyn_cast => dynCastAlon Zakai2016-04-111-1/+1
|
* De-recurse traversals (#333)Alon Zakai2016-04-111-1/+1
| | | | | | | | | | | | * 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
* Ensure that all static initializer functions are exportedDerek Schuff2016-04-061-10/+14
|
* Fix output of initializer list metadataDerek Schuff2016-04-061-1/+6
| | | | | | * Fix output of initializer list metadata Turns out trailing commas aren't valid JSON
* Fix s2wasm handling of aliased functionsDerek Schuff2016-04-061-2/+5
| | | | | | 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.
* Allocate __dso_handle in s2wasmDerek Schuff2016-04-061-0/+5
| | | | | | 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 pointerDerek Schuff2016-04-061-33/+26
| | | | | | | | | | | | * 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
* Handle static initializersDerek Schuff2016-04-061-2/+32
| | | | | | | 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.
* refactor printingAlon Zakai2016-04-041-1/+1
|
* add apis for accessing module elementsAlon Zakai2016-04-041-6/+6
|
* Merge pull request #295 from tzik/grow_memory_fixAlon Zakai2016-03-301-2/+2
|\ | | | | Fix grow_memory translation on s2wasm
| * Fix grow_memory translation on s2wasmtzik2016-03-301-2/+2
| | | | | | | | | | s2wasm used to mistranslate grow_memory operation in .s into memory_size in .wast, and this CL fixes it.
* | add explicit function types for indirect call targtets in s2wasmAlon Zakai2016-03-291-0/+6
| |
* | use ensureFunctionType in s2wasm, to ensure consistent function type namesAlon Zakai2016-03-291-10/+1
| |
* | Avoid the use of CRT pow(2, n) function to generate integer bit patterns, ↵Jukka Jylänki2016-03-281-3/+3
| | | | | | | | since pow() returns a double. Cleans VS build warnings C4244: '=': conversion from 'double' to 'size_t', possible loss of data.
* | Add rotate support to s2wasmDerek Schuff2016-03-231-0/+2
| |
* | Remove useless forwardDerek Schuff2016-03-221-1/+1
| |
* | Support --initial-size and --max-size to specify linear memory sizeDerek Schuff2016-03-211-8/+55
| | | | | | | | If not given, fall back to size calculated by the link step.
* | Make type of EqZ unary operators always i32Derek Schuff2016-03-211-1/+2
| | | | | | | | | | This makes them symmetric to binary relational operators. Also support eqz in the s2wasm parser.
* | add explicit memory export supportAlon Zakai2016-03-151-0/+1
| |
* | s2wasm: don't export functions unless they are marked with .globl.Dan Gohman2016-03-091-5/+12
| |
* | fix imports when arriving from wasm backend, which does not prefixAlon Zakai2016-03-091-1/+1
| |
* | Make initial and max memory sizes be in pages instead of bytesDerek Schuff2016-03-091-5/+12
| | | | | | | | | | | | | | 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.
* | Update s2wasm for tableswitch->br_table changeDerek Schuff2016-03-081-9/+10
| |
* | br_table, no more casesAlon Zakai2016-03-071-1/+1
| |
* | add a finalize() method for blocksAlon Zakai2016-03-071-0/+3
|/
* add wasm-printing.hAlon Zakai2016-02-171-0/+1
|
* move printing to a passAlon Zakai2016-02-171-1/+2
|
* fix s2wasm store parsingAlon Zakai2016-02-101-2/+4
|
* Align the stack allocation to 16 bytes to satisfy the aligment ABIDerek Schuff2016-02-081-0/+2
|
* Update binaryen and several tests for the new br_if operand order.Dan Gohman2016-02-081-2/+6
|
* Fix .s parser to accept new order of select operandsDerek Schuff2016-02-051-3/+3
| | | | Also update waterfall revision and LLVM-generated tests.
* Fix selectJF Bastien2016-02-051-1/+2
| | | | | | | | | 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.
* Review comments.JF Bastien2016-02-051-8/+8
|