| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
s2wasm is no longer used my emscripten and as far as I know now
as no other users.
|
|
|
|
|
|
|
|
|
| |
wasm-emscripten (#1539)
This allows the same functionality to be used also in
wasm-emscripten-finalize (i.e. the lld path).
|
|
|
|
|
|
|
|
|
|
|
|
| |
llvm-mirror/llvm@9273bb3([Phabricator](https://reviews.llvm.org/D44256))
changed alias assignment syntax from
```
x = y
```
to
```
.set x, y
```
This patch reflects the change.
|
|
|
| |
The & on the type is the proper convention.
|
|
|
|
| |
* rename WasmType to Type. it's in the wasm:: namespace anyhow, and without Wasm- it fits in better alongside Index, Address, Expression, Module, etc.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix unused variable warnings in wasm2asm.cpp
No need to give the bad_alloc exception a name when we do nothing with it.
* add appropriate casts for shift operands
MSVC complains about implicitly converting results from 32 bits to 64
bits here, so we might as well make it clear that we intended the 64-bit
shift to happen in the first place.
* disable C4722 on MSVC
We annotated Fatal::~Fatal with WASM_NORETURN, yet MSVC still warns, so
take the next step and silence the warning completely.
* don't warn about "deprecated" POSIX functions with MSVC
Non-Windows platforms don't have the names MSVC recommends using, and
everybody understands the POSIX names, so just silence the warning.
|
|
|
|
|
|
|
|
| |
* Fixed parseFile() skipping every other line
Was caused by "s = strchr(s, '\n')"
Also replaced recordFile() by parseFile() as they do exactly the same
* Added parseFile() to process() in s2wasm.h
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
(#1017)
* Extends wasm-as, wasm-dis and s2wasm to consume debug locations.
* Exports source map from asm2wasm
|
|
|
|
|
|
|
| |
* validate that types are properly finalized, when in pass-debug mode (BINARYEN_PASS_DEBUG env var): check after each pass is run that the type of each node is equal to the proper type (when finalizing it, i.e., fully recomputing the type).
* fix many fuzz bugs found by that.
* in particular, fix dce bugs with type changes not being fully updated during code removal. add a new TypeUpdater helper class that lets a pass update types efficiently, by the helper tracking deps between blocks and branches etc., and updating/propagating type changes only as necessary.
|
|
|
|
| |
contents. make s2wasm avoid outputting that as well (#992)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Handle importing globals in s2wasm
* Make importedGlobals a set of Names, make Names hashable
* Revert "Make importedGlobals a set of Names, make Names hashable"
This reverts commit 1d0ca7a5e3839b15ca60593330979864c9c3ed60.
* Refactor relocation parsing to handle expressions directly
* PR Feedback
- Move comment where it belongs
- Add comment about ownership to addRelocation
- Remove do-nothing parseImportGlobal
* Reword "imported globals" to "imported objects"
- Flip isObjectImported to isObjectImplemented, for consistency
* Add tests for s2wasm globals.
Also implement import relocation expression handling
* Simplify globals.s test
* Fix memory leak of relocation
* Use unique_ptr instead of delete in getRelocatableExpression
|
|
|
|
|
|
|
| |
Loops are modeled in Binaryen IR as having a Block as a body. The block
is added to module walkers and validated like a normal block.
In s2wasm when we add the blocks, we need to make sure that the type of
the loop body matches the type of the loop itself, or we run into
issues.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Update s2wasm for reordered call_indirect
https://reviews.llvm.org/D25708 fixed call_indirect for 0xc by
reordering the operands. s2wasm needs to be aware of that too.
* Update llvm_autogenerated tests
* Update torture-s tests
* run auto_update_tests
* update handwritten dot_s test that had call_indirect with args
|
|
|
|
|
|
|
|
|
|
| |
* Support block signatures in s2wasm's .s format
* Autogenerate tests
* update cfg-stackify tests
* Remove conflict files
|
|
|
|
| |
Corresponds to LLVM change https://reviews.llvm.org/D25122, r283502
|
|
|
|
| |
Corresponds to LLVM change https://reviews.llvm.org/D25122
|
|
|
| |
Fixes #708
|
|
|
|
|
|
|
|
|
|
|
| |
Several updates for s2wasm and its tests:
Add explicit drops where they are emitted by LLVM already
Convert loops (which are still modeled in the old way by LLVM) to wrap them in an explicit block (for the exit label). This also allows simplifying the loop creation (no need to post-process the implicit block which is the loop's body). After the engines update to 0xc we should update LLVM to model loops in the 0xc way, but for now it remains compatible with 0xb and 0xc.
Fix the order of the calls to setTee() when creating tee_locals
Add an explicit drop when creating the _start entry function wrapper if needed
Update dot_s and llvm_autogenerated tests to remove store-results optimization (and few other minor updates)
Fix the test auto-updater to fail if subprocesses fail
There still seems to be a validation failure when building libc (I think it's from the stricter drop rules, but it may be in the source rather than the compiler), but this at least makes Binaryen's tests pa
|
| |
|
| |
|
| |
|
|
|
|
| |
emscripten_longjmp_jmpbuf name
|
|
|
|
|
|
|
|
|
|
|
|
| |
When parsing .lcomm directives, s2wasm does not parse the alignment
number and skip it. This causes alignment bugs in some cases. (In the
test case attached, 'buf' should be 4 bytes aligned, but it does not
align it properly, so this code was generated:
```
(call $foo
(i32.const 13)
)
```
13 is not 4-bytes aligned. This patch fixes this bug.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implement asm.js style exception handling for Wasm
Converts invoke wrapper names generated by LLVM backend to real invoke wrapper
names that are expected by JavaScript glue code.
This is required to support wasm exception handling (asm.js style).
LLVM backend lowers
invoke @func(arg1, arg2) to label %invoke.cont unwind label %lpad
into
... (some code)
call @invoke_SIG(func, arg1, arg2)
... (some code)
SIG is a mangled string generated based on the LLVM IR-level function
signature. In LLVM IR, types are not lowered yet, so this mangling scheme
simply takes LLVM's string representtion of parameter types and concatenate
them with '_'. For example, the name of an invoke wrapper for function void
foo(struct mystruct*, int) will be "__invoke_void_%struct.mystruct*_int". This
function converts the names of invoke wrappers based on their lowered argument
types and a return type. In the example above, the resulting new wrapper name
becomes "invoke_vii".
* Address comments
Change variable names to camelcase
Add a small (semi-)handwritten test case
* Export malloc and free from wasm when available
* Add a test case for exporting malloc/free feature
+ cosmetic 'file' name change in text_before_type.s
* fixInvokeWrapper -> fixEmExceptionInvoke
* Add a TODO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Name lhs = getStrToSep();
if (!skipEqual()){
s = strchr(s, '\n');
if (!s) break;
continue;
}
The above code snippet introduced by #615 has a bug when there is only
one word (e.g. ".text") in a line. If there is only one word in a line,
skipEqual() also skips the newline character at the end of the line, and
strchr(s, '\n') moves the cursor to the end of the next line,
effectively skipping the whole next line.
|
|
|
| |
This patch adds support for an ".indidx" primitive that pre-assigns table indexes for functions that are called indirectly. It is used by the upstream LLVM WebAssembly backend to support fine-grained control-flow integrity for indirect function calls by emitting instrumentation at each indirect call site to check that the destination index is within certain ranges that correspond to disjoint equivalence classes of indirect call targets. The reason that this primitive is necessary is because the layout of the table section isn't determined until the WebAssembly linker is executed, but indirect function to table index mappings need to be known when opt is executed to generate the correct range checking in the LLVM IR.
|
|
|
|
| |
presence, and eliminate explicit index counter (#633)
|
| |
|
|
|
| |
Adds support for aliases to objects, to go along with the existing support for aliases to functions.
|
|
|
|
| |
Add an s2wasm option `--no-validate` to disable validation for debugging purposes.
Also fix several validation errors by adding calls to `finalize()` after creating expressions, and ensuring that an import is created earlier in `Linker::getImportThunk`.
|
| |
|
|
|
|
|
| |
(#563)
Pass ownership into the wasm module.
|
|
|
|
|
|
|
|
|
|
|
| |
Under emscripten, C code can take the address of a function implemented
in Javascript (which is exposed via an import in wasm). Because imports
do not have linear memory address in wasm, we need to generate a thunk
to be the target of the indirect call; it call the import directly.
This is facilited by a new .s directive (.functype) which declares the
types of functions which are declared but not defined.
Fixes https://github.com/WebAssembly/binaryen/issues/392
|
|
|
|
| |
Currently it ignores this information. Also it allows parse files with -asm-verbose=true.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
* Avoid double dollarsigns in s2wasm local names.
Recognize '$' as part of the .s syntax for register names, and exclude it
when forming the wasm local name. This changes names like "$$0" to "$0".
* Fix a comment.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
It includes implicit conversion from u64 and implicit conversion to address_t. This makes it easier to use without ugly casting and but still gets the overflow checks.
|
| |
|
|
|
|
|
|
|
| |
We've been using size_t (and other things) for addresses, which is
generally wrong because it depends on the host, when it should in fact
depend on the target. This is a partial fix for #278 (i.e. it's the
right fix, I don't think it's applied quite everywhere yet).
|
|
|
|
|
|
|
|
| |
Add a class to parse archive files.
Support linking archive files, with archive semantics (i.e. an archive
member is linked in if it satisfies an undefined reference).
Archive files must be gnu-format archives containing .s files.
Add tests for linking semantics.
|
|
|
|
|
|
| |
* harmonize the internal opcodes with the binary format, so they clearly parallel, and also this helps us avoid needing the type to disambiguate
* comment on GetLocal in C API
|
|
|
| |
There may be some other places which are broken, but they don't trigger ubsan right now. This is another fix for #404.
|