summaryrefslogtreecommitdiff
path: root/src/wasm
Commit message (Collapse)AuthorAgeFilesLines
* Return to more structured type rules for block and if (#1148)Alon Zakai2017-09-052-26/+45
| | | | | | | | * if a block has a concrete final element (or a break with a value), then even if it has an unreachable child, keep it with that concrete type. this means we no longe allow the silly case of a block with an unreachable in the middle and a concrete as the final element while the block is unreachable - after this change, the block would have the type of the final element * if an if has a concrete element in one arm, make it have that type as a result, even if the if condition is unreachable, to parallel block * make type rules for brs and switches simpler, ignore whether they are reachable or not. whether they are dead code should not affect how they influence other types in our IR.
* wasm-reduce tool (#1139)Alon Zakai2017-09-012-7/+22
| | | Reduce an interesting wasm to a smaller still interesting wasm. This takes an arbitrary command to run, and reduces the wasm as much as it can while keeping the behavior of that command fixed. This can be used to reduce compiler bugs in an arbitrary VM, etc.
* set the type of a set_local properly when it is unreachableAlon Zakai2017-08-251-0/+4
|
* Add support for atomic wait and wake operators (#1140)Derek Schuff2017-08-244-0/+105
| | | According to spec at https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wait-and-wake-operators
* Initial asm.js output for binaryen-c / binaryen.js (#1136)Daniel Wirtz2017-08-241-0/+7
| | | | * Added BinaryenModulePrintAsmjs (using wasm2asm) + Module#emitAsmjs JS binding
* Ignore unreachable code in wasm binaries (#1122)Alon Zakai2017-08-221-8/+60
| | | Ignoring unreachable code in wasm binaries lets us avoid corner cases with unstructured code in wasm binaries that is a poor fit for Binaryen's structured IR.
* wasm2asm test generation (#1124)Thomas Lively2017-08-161-1/+1
| | | | | | | | | | | | | | | | | * Translate assert_return invokes to asm * Translate assert_trap tests to JS * Enable wasm2asm tests * Fix wasm2asm translation of store * Update ubuntu nodejs in Travis * Free JSPrinter buffer * Use unique_ptr for Functions to prevent leaks * Add tests for assert translation
* Emit optimal-size LEBs in section/subsection/function body sizes (#1128)Alon Zakai2017-08-151-8/+20
| | | | * emit optimal-size LEBs in section/subsection/function body sizes, instead of preallocating 5 bytes
* emit an unreachable if an unreachable block context does not end in an ↵Alon Zakai2017-08-051-0/+5
| | | | unreachable
* fix reading of stacky unreadable code with elements we need to dropAlon Zakai (kripken)2017-08-051-16/+16
|
* fix proper wasm emitting of untaken br_tablesAlon Zakai2017-08-011-1/+9
|
* Merge remote-tracking branch 'origin/master' into fuzzAlon Zakai (kripken)2017-07-311-1/+33
|\
| * Polymophic stack support (#1117)Alon Zakai2017-07-311-1/+33
| | | | | | | | | | | | | | Emit valid wasm binaries even for corner cases of unreachable code. * emit an unreachable after a node that pushes a value that has unreachable type (where wasm type checking would have pushed a concrete type) * conversely, as a hack, emulate the wasm polymorphic stack mode by not emptying the stack when it has one element and that element is unreachable. this lets further pops work (all returning an unreachable element)
* | review commentsAlon Zakai (kripken)2017-07-311-1/+1
| |
* | fix binary emitting of untaken branches, and also handle reading of ↵Alon Zakai (kripken)2017-07-291-3/+10
|/ | | | unreachable stacky code which may introduce concrete elements in non-final block positoins
* ignore untaken branches in determining block typeAlon Zakai2017-07-221-1/+3
|
* improve WasmValidator::validateMemBytes, check for unreasonable sizes even ↵Alon Zakai2017-07-191-6/+6
| | | | type is unreachable (#1102)
* Merge pull request #1095 from WebAssembly/fuzz-3Alon Zakai2017-07-181-2/+5
|\ | | | | More fuzz fixes
| * fix validation of memBytes, if the load type is unreachable, we can't and ↵Alon Zakai (kripken)2017-07-131-2/+5
| | | | | | | | shouldn't try to validate
* | Validation for AtomicRMW and cmpxchg (#1092)Derek Schuff2017-07-141-1/+25
|/ | | | Also fix cases where fail() had the arguments backwards. Wasn't an error because lol templates. Also fix printModuleComponent template to SFINAE on Expression* so we properly get the specialized version.
* Merge pull request #1087 from WebAssembly/fuzz-2Alon Zakai2017-07-124-22/+32
|\ | | | | Fuzz fixes
| * changing a set to a tee or vice versa needs to take into account the value ↵Alon Zakai (kripken)2017-07-111-0/+1
| | | | | | | | may be unreachable
| * fix Const finalization and use it properly in br finalization in PrecomputeAlon Zakai (kripken)2017-07-111-0/+4
| |
| * add the option to seek named breaks, not just taken breaks; refactor headers ↵Alon Zakai (kripken)2017-07-113-7/+8
| | | | | | | | to make this practical
| * refactor and improve break validation. breaks names are unique, so we don't ↵Alon Zakai (kripken)2017-07-111-15/+19
| | | | | | | | need a stack, and break targets must exist even if they are not actually taken
* | Refactor validation failure and printing, validate atomic memory (#1090)Derek Schuff2017-07-121-10/+42
| |
* | add docs and error hints when a Call should be a CallImport (#1081)Alon Zakai2017-07-111-1/+6
|/ | | | | | * add docs and error hints when a Call should be a CallImport * fix binaryen API docs in docs/
* Factor wasm validator into a cpp file (#1086)Derek Schuff2017-07-102-0/+640
| | | Also small cleanup to CMake libraries
* Add IR, parsing, printing, and binary for atomic cmpxchg (#1083)Derek Schuff2017-07-103-5/+95
|
* Add IR, parsing and binary support for AtomicRMW instructions from wasm ↵Derek Schuff2017-07-063-60/+165
| | | | | threads proposal (#1082) Also leave a stub (but valid) visitAtomicRMW in the visitor template so that not all visitors need to implement this function yet.
* show a clear error on nulls in inline strings in binary format (#1068)Alon Zakai2017-07-051-1/+5
| | | | * show a clear error on nulls in inline strings (which we don't support, and in general are not seen in practice, but are technically valid wasm) in binary format reading
* Add atomic loads and stores (#1077)Derek Schuff2017-06-282-76/+175
| | | | | Add IR, wast and binary support for atomic loads and stores. Currently all IR generated by means other than parsing wast and binary files always generates non-atomic accesses, and optimizations have not yet been made aware of atomics, so they are certainly not ready to be used yet.
* Add shared memories (#1069)Derek Schuff2017-06-272-26/+46
| | | | | Begin to implement wasm threading proposal in https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md This PR just has shared memory attribute with wast and binary support.
* Change char to auto to avoid type-limits warn on some arches (#1066)Jakub Jirutka2017-06-221-1/+1
| | | Fixes #1059
* Support new result syntax for if/loop/block (#1047)Sam Clegg2017-06-121-18/+28
| | | | | | Support both syntax formats in input since the old spec tests still need to be parsable.
* Output inf/-inf rather than infinity/-infinitySam Clegg2017-06-091-1/+1
| | | | | wast2wasm wes recently updated to only support the former: https://github.com/WebAssembly/wabt/pull/482
* Update binaryen-c/binaryen.js, fixes #1028, fixes #1029 (#1030)Daniel Wirtz2017-06-071-0/+11
| | | This PR adds global variable support (addGlobal, getGlobal, setGlobal), host operations (currentMemory, growMemory), a few utility functions (removeImport, removeExport, getFunctionTypeBySignature with the latter being scheduled for removal once a better alternative is in place) and it introduces an additional argument to specify the result type in BinaryenBlock (effectively breaking the C-API but retaining previous behaviour by introducing the BinaryenUndefined() type for this purpose). Additionally, it enables compilation with exception support in build-js.sh as exceptions are thrown and caught when optimizing endless loops, intentionally resulting in an unreachable opcode. Affected test cases have been updated accordingly.
* clean up unnecessary spacingAlon Zakai2017-06-011-1/+1
|
* use atoll in getCheckedAddress string parsingAlon Zakai2017-06-011-1/+1
|
* refactor s-expr parsing code to remove duplication and unnecessary thingsAlon Zakai2017-06-011-33/+17
|
* handle out of range memory size values in s-expr parsingAlon Zakai (kripken)2017-06-011-2/+10
|
* handle out of range break offset parsingAlon Zakai2017-06-011-0/+2
|
* verify s-expr parsing of alignmentsAlon Zakai2017-06-011-2/+6
|
* validate memory/table Address values in s-expr parsingAlon Zakai (kripken)2017-06-011-4/+20
|
* host op parsing error handlingAlon Zakai (kripken)2017-06-012-2/+11
|
* handle duplicate functions in s-expr parsingAlon Zakai (kripken)2017-06-011-0/+1
|
* handle duplicate function types in s-expr parsingAlon Zakai (kripken)2017-06-011-0/+2
|
* handle duplicate imports and globals in s-expr parsingAlon Zakai (kripken)2017-06-011-0/+6
|
* handle a parse error of a function declaration with mixed import insideAlon Zakai (kripken)2017-06-011-0/+1
|
* s-expr parsing: handle empty switchAlon Zakai (kripken)2017-06-011-0/+1
|