summaryrefslogtreecommitdiff
path: root/src/wasm-io.h
Commit message (Collapse)AuthorAgeFilesLines
* Poppy IR wast parsing and validation (#3105)Thomas Lively2020-09-091-0/+4
| | | | | Adds an IR profile to each function so the validator can determine which validation rules to apply and adds a flag to have the wast parser set the profile to Poppy for testing purposes.
* Binary format code section offset tracking (#2515)Alon Zakai2019-12-191-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optionally track the binary format code section offsets, that is, when loading a binary, remember where each IR node was read from. This is necessary for DWARF debug info, as these are the offsets DWARF refers to. (Note that eventually we may want to do something else, like first read the DWARF and only then add debug info annotations into the IR in a more LLVM-like manner, but this is more straightforward and should be enough to update debug lines and ranges). This tracking adds noticeable overhead - every single IR node adds an entry in a map - so avoid it unless actually necessary. Specifically, if the user passes in -g and there are actually DWARF sections in the binary, and we are not about to remove those sections, then we need it. Print binary format code section offsets in text, when printing with -g. This will help debug and test dwarf support. It looks like ;; code offset: 0x7 as an annotation right before each node. Also add support for -g in wasm-opt tests (unlike a pass, it has just one - as a prefix). Helps #2400
* Convert to using DEBUG macros (#2497)Sam Clegg2019-12-041-10/+2
| | | | | | This means that debugging/tracing can now be enabled and controlled centrally without managing and passing state around the codebase.
* Apply format changes from #2048 (#2059)Alon Zakai2019-04-261-8/+13
| | | Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
* Allow tools to read from stdin (#1950)Thomas Lively2019-03-181-1/+5
| | | | This is necessary to write tests that don't require temporary files, such as in #1948, and is generally useful.
* wasm-opt source map support (#1557)Alon Zakai2018-06-071-3/+4
| | | | | | | | | | * support source map input in wasm-opt, refactoring the loading code into wasm-io * use wasm-io in wasm-as * support output source maps in wasm-opt * add a test for wasm-opt and source maps
* Fold wasm-link-metadata into wasm-emscripten-finalize (#1408)Jacob Gravelle2018-02-141-0/+4
| | | | | | | * wasm-link-metadata: Use `__data_end` symbol. * Add --global-base param to emscripten-wasm-finalize to compute staticBump properly * Let ModuleWriter write to a provided Output object
* First pass at LLD support for Emscripten (#1346)Jacob Gravelle2018-01-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Skeleton of a beginning of o2wasm, WIP and probably not going to be used * Get building post-cherry-pick * ast->ir, remove commented out code, include a debug module print because linking * Read linking section, print emscripten metadata json * WasmBinaryWriter emits user sections on Module * Remove debugging prints, everything that isn't needed to build metadata * Rename o2wasm to lld-metadata * lld-metadata support for outputting to file * Use tables index instead of function index for initializer functions * Add lld-emscripten tool to add emscripten-runtime functions to wasm modules (built with lld) * Handle EM_ASM in lld-emscripten * Add a list of functions to forcibly export (for initializer functions) * Disable incorrect initializer function reading * Add error printing when parsing .o files in lld-metadata * Remove ';; METADATA: ' prefix from lld-metadata, output is now standalone json * Support em_asm consts that aren't at the start of a segment * Initial test framework for lld-metadata tool * Add em_asm test * Add support for WASM_INIT_FUNCS in the linking section * Remove reloc section parsing because it's unused * lld-emscripten can read and write text * Add test harness for lld-emscripten * Export all functions for now * Add missing lld test output * Add support for reading object files differently Only difference so far is in importing mutable globals being an object file representation for symbols, but invalid wasm. * Update help strings * Update linking tests for stackAlloc fix * Rename lld-emscripten,lld-metadata to wasm-emscripten-finalize,wasm-link-metadata * Add help text to header comments * auto& instead of auto & * Extract LinkType to abi/wasm-object.h * Remove special handling for wasm object file reading, allow mutable globals * Add braces around default switch case * Fix flake8 errors * Handle generating dyncall thunks for imports as well * Use explicit bool for stackPointerGlobal * Use glob patterns for lld file iteration * Use __wasm_call_ctors for all initializer functions
* Exporting/importing debug location information from .wast/.asm.js/.s formats ↵Yury Delendik2017-06-011-0/+4
| | | | | | | | (#1017) * Extends wasm-as, wasm-dis and s2wasm to consume debug locations. * Exports source map from asm2wasm
* ctor evaller (#982)Alon Zakai2017-04-281-0/+1
| | | | | Add wasm-ctor-eval, which evaluates functions at compile time - typically static constructor functions - and applies their effects into memory, saving work at startup. If we encounter something we can't evaluate at compile time in our interpreter, stop there. This is similar to ctor_evaller.py in emscripten (which was for asm.js).
* Read/Write Abstraction (#889)Alon Zakai2017-01-261-0/+68
* Added ModuleReader/Writer classes that support text and binary I/O * Use them in wasm-opt and asm2wasm