summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-binary.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Optimize wasm reading (#1202)Alon Zakai2017-09-281-2/+9
| | | * optimize wasm reading: use a set of the breaks we've seen, don't rescan blocks to see if they have breaks to them
* Avoid new blocks in binary reading/writing (#1165)Alon Zakai2017-09-121-21/+35
| | | | | | * don't emit a toplevel block if we don't need to, as in wasm it is a list context * don't create unnecessary blocks in wasm reading
* Add support for sign-extension operators from threading proposal (#1167)Derek Schuff2017-09-061-0/+11
| | | These are not atomic operations, but are added with the atomic operations to keep from having to define atomic versions of all the sign-extending loads (an atomic zero-extending load + signext operation can be used instead).
* clean up untaken => unreachable, as well as unnecessary named stuff in ↵Alon Zakai2017-09-061-6/+5
| | | | validation that was from when we differentiated reachable from unreachable breaks (#1166)
* Add support for atomic wait and wake operators (#1140)Derek Schuff2017-08-241-0/+55
| | | According to spec at https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wait-and-wake-operators
* 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.
* 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
* add the option to seek named breaks, not just taken breaks; refactor headers ↵Alon Zakai (kripken)2017-07-111-3/+4
| | | | to make this practical
* Add IR, parsing, printing, and binary for atomic cmpxchg (#1083)Derek Schuff2017-07-101-0/+64
|
* Add IR, parsing and binary support for AtomicRMW instructions from wasm ↵Derek Schuff2017-07-061-0/+90
| | | | | 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-281-71/+162
| | | | | 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-271-12/+24
| | | | | 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
* handle the wrong number of functions being provided in binary formatAlon Zakai (kripken)2017-06-011-0/+8
|
* Exporting/importing debug location information from .wast/.asm.js/.s formats ↵Yury Delendik2017-06-011-0/+206
| | | | | | | | (#1017) * Extends wasm-as, wasm-dis and s2wasm to consume debug locations. * Exports source map from asm2wasm
* afl-fuzz bug fixes (#1018)Alon Zakai2017-05-201-0/+4
| | | | | | | | * values cannot flow through an if without an else, they never return a value * check pass tests in pass-debug mode too * add missing finalization in binary reading
* Unreachable typing fixes (#1004)Alon Zakai2017-05-091-2/+9
| | | | | | | | | | | | * fix type of drop, set_local, set_global, load, etc: when operand is unreachable, so is the node itself * support binary tests properly in test/passes * fix unreachable typing of blocks with no name and an unreachable child * fix continue emitting in asm2wasm * properly handle emitting of unreachable load
* optimize duplication checks in binary format reading (#995)Alon Zakai2017-05-041-7/+5
|
* make function name duplicate testing handle the case of just some functions ↵Alon Zakai2017-05-031-5/+8
| | | | being named, and colliding with others' original names (#994)
* Parsing fixes (#990)Alon Zakai2017-05-021-34/+126
| | | | | | | | | | * properly catch a bunch of possible parse errors, found by afl-fuzz * clean up wasm-interpreter, use WASM_UNREACHABLE instead of abort * detect duplicate names in function names section * detect duplicate export names
* Extensible name section (#933)pipcet2017-04-131-19/+43
| | | | | | | | | | | | | See https://github.com/WebAssembly/binaryen/issues/914. * extensible name section support: read function names, too * c-api-unused-mem.txt: change expected size to match new name section * * check subsection size matches * print warning for unknown name subsections (including the local section)
* fix emitting of unreachable ifs (#944)Alon Zakai2017-03-141-13/+11
|
* Wasm h to cpp (#926)jgravelle-google2017-03-101-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | * Move WasmType function implementations to wasm.cpp * Move Literal methods to wasm.cpp * Reorder wasm.cpp shared constants back to top * Move expression functions to wasm.cpp * Finish moving things to wasm.cpp * Split out Literal into its own .h/.cpp. Also factor out common wasm-type module * Remove unneeded/transitive includes from wasm.h * Add comment to try/check methods * Rename tryX/checkX methods to getXOrNull * Add missing include that should fix appveyor build breakage * More appveyor
* read unknown users sections as binary data stored on the Module (#918)Alon Zakai2017-02-211-3/+13
|
* clean up raw pointer import->functionType, make it a Name like everything ↵Alon Zakai2017-02-171-4/+4
| | | | else (#915)
* Fix emitting of unreachable block/if/loop (#911)Alon Zakai2017-02-161-2/+38
| | | | | | | | | | | | | | | | | | | | | | * an unreachable block is one with an unreachable child, plus no breaks * document new difference between binaryen IR and wasm * fix relooper missing finalize * add a bunch of tests * don't assume that test/*.wast files print to themselves exactly; print to from.wast. this allows wast tests with comments in them * emit unreachable blocks as (block .. unreachable) unreachable * if without else and unreachable ifTrue is still not unreachable, it should be none * update wasm.js * cleanups * empty blocks have none type
* Merge pull request #865 from WebAssembly/fix-abAlon Zakai2017-01-101-6/+24
|\ | | | | Fix AngryBots parsing
| * handle a binary that breaks to returnAlon Zakai (kripken)2017-01-041-5/+22
| |
| * handle a module which has no globals at allAlon Zakai (kripken)2017-01-041-1/+2
| |
* | Merge pull request #871 from WebAssembly/fix-c-api-unused-memAlon Zakai2017-01-051-4/+5
|\ \ | |/ |/| Mark memory as existing when it is created in the C API
| * ensure exports are added deterministically from binariesAlon Zakai (kripken)2017-01-041-4/+5
| |
* | Handle stacky code (#868)Alon Zakai2017-01-041-21/+47
|/ | | | * handle stacky code in binaries, using a block+local
* Merge pull request #859 from WebAssembly/linkingAlon Zakai2016-12-271-1/+1
|\ | | | | Dynamic linking
| * fix the order of emitting the start sectionAlon Zakai2016-12-071-1/+1
| |
* | ignore unknown user sections, fixes #857 (#858)Alon Zakai2016-12-071-7/+12
|/
* emit entries in the Names section for imports as well, as was recently ↵Alon Zakai2016-11-091-3/+35
| | | | changed in the spec
* add a --symbolmap option to wasm-as, which emits a side file with the name ↵Alon Zakai2016-11-091-0/+13
| | | | mapping (similar to Names section, but external)
* Binary 0xd changes (#803)Derek Schuff2016-10-261-18/+27
| | | | | | | | | | | | | | | | | | | | | * Renumber opcodes for 0xd * Unified type encoding * Add reserved flags fields to host instructions and call_indirect * Rename flags->reserved * Fix line numbers in wast parser Also don't throw if the memory is defined in the same Element as the export of memory (the validity is checked later anyway). * Skip spec binary.wast The spec testsuite is still on 0xc, so 0xd doesn't match. In order to update to 0xd we need to implement some additional functionality for the import test, namely (register)
* fix binary format regression from 9afa80951a3e9e59d5348780370a8b67d829ded1 - ↵Alon Zakai2016-10-221-18/+10
| | | | we must handle float literals carefully to not change their sign bit on some platforms/compilers, and that commit made relevant functions non-inline which hit a bug (#801)
* Move wasm binary reader and writer from the header file into libwasm (#797)Derek Schuff2016-10-201-0/+1894