| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Refactored & fixed typeuse parsing rules so now the rules more closely
follow the spec. There have been multiple parsing rules that were
different in subtle ways, which are supposed to be the same according
to the spec.
- Duplicate types, i.e., types with the same signature, in the type
section are allowed as long as they don't have the same given name.
If a name is given, we use it; if type name is not given, we
generate one in the form of `$FUNCSIG$` + signature string. If the
same generated name already exists in the type section, we append
`_` at the end. This causes most of the changes in the autogenerated
type names in test outputs.
- A typeuse has to be in the order of (type) -> (param) -> (result),
if more than one of them exist. In case of function definitions,
(local) has to be after all of these. Fixed some test cases that
violate this rule.
- When only (param)/(result) are given, its type will be the type with
the smallest existing type index whose parameter and result are the
same. If there's no such type, a new type will be created and
inserted.
- Added a test case `duplicate_types.wast` to test type namings for
duplicate types.
- Refactored `parseFunction` function.
- Add more overrides to helper functions: `getSig` and
`ensureFunctionType`.
|
|
|
|
|
| |
We have `getFunction`, but not `getGlobal` because its name clashed with
APIs for the deprecated instruction `get_global`. Now we have reflected
instruction renaming in code, we can add it for consistency.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Inlining: exposed inlining thresholds as command-line parameters.
This will allow easier experimentation with optimal settings.
Also tweaked the default logic slightly to always inline single
caller functions up to a certain size.
The command-line arguments were tested to have the desired effect
for example by the Makefile change in this commit:
https://github.com/aardappel/lobster/commit/39ae393e27ff363ab095bbb26c90d6fe17570104
which in turn relies on:
https://github.com/emscripten-core/emscripten/pull/8635
* Grouped inlining options & reverted defaults.
Now uses same defaults for inlining as before for the sake of
not having to redo a lot of tests.
Added FIXME to indicate that the current inlining logic needs
fixing.
* Fixed default values now pulled from code.
* clang-format
|
|
|
|
|
| |
Checking if a first string matches a certain string within a list
element appears many times within the parser, so extracted it as a
helper function.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
clang-tidy by default enables two groups of checks: clang-diagnostic-*
and clang-analyzer-*. Between the two, clang-analyzer is a static
analyzer, but it seems to often produces false warnings. For example,
when you write `object->someFunction()`, if it is not sure if object is
not a NULL, i.e., if there's no assert(object) before, it produces a
warning. This is sometimes annoying and inserting `assert` everywhere
does not seem to be very appealing. I also noticed LLVM and V8 also
disabled this analyzer.
`-*` disables all checks. Then I re-enabled clang-diagnostic and
readability-braces-around-statements.
|
|
|
|
|
| |
(#2106)
Fixes #2103.
|
|
|
| |
Windows filenames can't contain colons. Use @ instead for passing arguments to passes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Reflected new renamed instruction names in code and tests:
- `get_local` -> `local.get`
- `set_local` -> `local.set`
- `tee_local` -> `local.tee`
- `get_global` -> `global.get`
- `set_global` -> `global.set`
- `current_memory` -> `memory.size`
- `grow_memory` -> `memory.grow`
- Removed APIs related to old instruction names in Binaryen.js and added
APIs with new names if they are missing.
- Renamed `typedef SortedVector LocalSet` to `SetsOfLocals` to prevent
name clashes.
- Resolved several TODO renaming items in wasm-binary.h:
- `TableSwitch` -> `BrTable`
- `I32ConvertI64` -> `I32WrapI64`
- `I64STruncI32` -> `I64SExtendI32`
- `I64UTruncI32` -> `I64UExtendI32`
- `F32ConvertF64` -> `F32DemoteI64`
- `F64ConvertF32` -> `F64PromoteF32`
- Renamed `BinaryenGetFeatures` and `BinaryenSetFeatures` to
`BinaryenModuleGetFeatures` and `BinaryenModuleSetFeatures` for
consistency.
|
|
|
| |
These formats don't seem to be used now.
|
|
|
|
|
| |
- Created `parseParamOrLocals`, `parseNamedParamOrLocals`,
`parseResult`, and `parseTypeRef` and make other methods use them
- Deleted some unnecessary member variables
|
|
|
|
|
|
| |
* fix
* fix style
|
|
|
| |
This happened on wasm2js, where implicit traps are off by default, and this bug is specific to that (less-tested) mode.
|
|
|
| |
After s2wasm was removed, these tests don't seem to be used anymore.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
gets (#2118)
In unreachable code, a get may have a single set that assigns to it, and that set may be assigned to by that very get.
|
|
|
|
|
| |
Add feature handling to the C/JS APIs. No features are enabled by
default, so all used features will have to be explicitly enabled in
order for modules to validate.
|
|
|
|
|
|
| |
This is useful for front-ends which wish to selectively enable or
disable coloring.
Also expose these APIs from the C API.
|
|
|
|
|
| |
This is useful for wasm2js, as we don't emit traps for OOB loads etc. like wasm (like we don't trap on bad float-to-int, as it's too hard in JS, and it's undefined behavior in C anyhow). It may also help general fuzzing, as those traps may make other interesting patterns less likely.
Also add more wasm2js support in the fuzzer, which includes using this no-OOB option.
|
| |
|
|
|
| |
Oversight from #2105
|
|
|
|
|
|
|
|
|
|
|
| |
Update build-js.sh to output to `out` directory. This is district
from the `bin` directory which is used by the cmake build and may or
may not live in the source tree. The `out` directory currently always
lives in the source tree.
As a followup change I hope to additionally move all test outout into
this tree.
See #2104
|
| |
|
| |
|
| |
|
|
|
| |
Set it to a local in the asmFunc scope, so that minifiers can easily see it's a simple local value (instead of using it as an upvar from the parameters higher up, which was how the emscripten glue was emitting it).
|
|
|
| |
This happens on e.g. an i32 load of a constant offset, then we have constant >> 2.
|
|
|
|
|
| |
- Print `globals` array in the tracing mode like other arrays
(`functions`, `exports`, `imports`, ...)
- Add accessor functions for globals
|
|
|
|
|
|
| |
It doesn't seem to be used anywhere and I don't know why the
implementation for `WasmBinaryBuilder::getGlobalName` and
`WasmBinaryBuilder::getFunctionIndexName` are different. Renamed
`getFunctionIndexName` to `getFunctionName` for consistency.
|
|
|
|
|
|
|
|
|
| |
(#2095)
Previously we were only creating `dynCall` functions for signatures
that we have statically in the table. However for dynamic linking we
may need to invoke functions that we don't have table entries for
(e.g. table entries from a different module).
|
|
|
| |
This helps quite a lot on wasm2js.
|
|
|
|
|
| |
In JS a reinterpret is especially expensive, as we implement it as a write to a temp buffer and a read using another view. This finds places where we load a value from memory, then reinterpret it later - in that case, we can load it using another view, at the cost of another load and another local.
This is helpful on things like Box2D, where there are many reinterprets due to the main 2D vector class being an union over two floats/ints, and LLVM likes to do a single i64 load of them.
|
|
|
| |
Helps to avoid trampling each other when binaryen is called multiple times from emcc, for example.
|
|
|
|
| |
This adds except_ref type, which is a part of the exception handling
proposal.
|
| |
|
|
|
|
|
|
| |
Our current clang-tidy setting requires {} after ifs. Unlike
clang-format, I couldn't find any directives or options that allow us to
exclude the generated inc file from clang-tidy. Anyway adding a pair of
braces is all it takes to make it pass.
|
|
|
| |
A few things that were missing in #2048.
|
| |
|
|
|
|
| |
of them precisely anyhow (#2087)
|
|
|
|
|
| |
When we run clang-tidy for the second time to show the error, don't show
stderr output because they are not very helpful and all error messages
are printed in stdout.
|
|
|
| |
This only adds the feature and its flag and not the instructions yet.
|
|
|
|
| |
When loading a boolean, prefer the signed heap (which is more commonly used, and may be faster).
We never use HEAPU32 (HEAP32 is always enough), just remove it.
|
|
|
| |
Without this PR, wasm2js0.test_printf in emscripten took an extremely long time to compile.
|
|
|
| |
A minifier would probably remove them later anyhow, but they make reading the code annoying and hard.
|
|
|
|
|
| |
We don't actually try to emit traps for loads, stores, invalid float to ints, etc., so when optimizing we may as well do so under the assumption those traps do not exist.
This lets us emit nice code for a select whose operands are loads, for example - otherwise, the values seem to have side effects.
|
|
|
|
|
|
|
| |
If a global is marked mutable but not assigned to, make it immutable.
If an immutable global is a copy of another, use the original, so we can remove the duplicates.
Fixes #2011
|
|
|
|
|
| |
This replaces the wasm2js code that lowered them to pessimistic (1-byte aligned) loads and stores. The new pass will do the optimal thing, keeping 2-byte alignment where possible.
This is also nicer as a standalone pass, which has the simple property that after it runs all loads and stores are aligned, instead of some code scattered inside wasm2js.
|
|
|
| |
Reenable the clang-tidy hook temporarily disabled by #2075.
|