17 Commits

Author SHA1 Message Date
かめのこにょこにょこ
443345400d
Add an Asyncify option to propagate the addList (#5935)
The new asyncify flag --pass-arg=asyncify-propagate-addlist changes the
behavior of --pass-arg=asyncify-addlist : with it, callers of functions in the
asyncify-addlist will be also instrumented.
2024-04-01 15:37:20 -07:00
Alon Zakai
77facb13f7
Remove various testing spam (#6109)
Avoid some common warnings and stop printing various stdout/stderr stuff.

Helps #6104
2023-11-14 13:42:52 -08:00
Alon Zakai
c0b48a61be
Add a test for too many locals in Asyncify (#4110)
Followup to #4108
2021-08-27 16:57:51 -07:00
Wouter van Oortmerssen
6116553a91
Improve testing on Windows (#3142)
This PR contains:
- Changes that enable/disable tests on Windows to allow for better local testing.
- Also changes many abort() into Fatal() when it is really just exiting on error. This is because abort() generates a dialog window on Windows which is not great in automated scripts.
- Improvements to CMake to better work with the project in IDEs (VS).
2020-09-17 10:55:02 -07:00
Alon Zakai
f067a45c1e
Skip tests that fail on windows and enable all the rest (#3035)
This lets us run most tests at least on that platform.

Add a new function for skipping those tests, skip_if_on_windows,
so that it's easy to find which tests are disabled on windows for later fixing
efforts.

This fixes a few minor issues for windows, like comparisons
should ignore \r in some cases.

Rename all passes tests that use --dwarfdump to contain "dwarf"
in their name, which makes it easy to skip those (and is clearer
anyhow).
2020-08-11 10:31:51 -07:00
Alon Zakai
d26f90bba4
Asyncify: Add an "add list", rename old lists (#2910)
Asyncify does a whole-program analysis to figure out the list of functions
to instrument. In
emscripten-core/emscripten#10746 (comment)
we realized that we need another type of list there, an "add list" which is a
list of functions to add to the instrumented functions list, that is, that we
should definitely instrument.

The use case in that link is that we disable indirect calls, but there is
one special indirect call that we do need to instrument. Being able to add
just that one can be much more efficient than assuming all indirect calls in
a big codebase need instrumentation. Similar issues can come up if we
add a profile-guided option to asyncify, which we've discussed.

The existing lists were not good enough to allow that, so a new option
is needed. I took the opportunity to rename the old ones to something
better and more consistent, so after this PR we have 3 lists as follows:

* The old "remove list" (previously "blacklist") which removes functions
from the list of functions to be instrumented.

* The new "add list" which adds to that list (note how add/remove are
clearly parallel).

* The old "only list" (previously "whitelist") which simply replaces the
entire list, and so only those functions are instrumented and no other.

This PR temporarily still supports the old names in the commandline
arguments, to avoid immediate breakage for our CI.
2020-06-12 17:15:22 -07:00
Alon Zakai
dc264342e4
Asyncify: Fix wasm-only instrumentation of unnamed imports (#2682)
We assumed that the imports were already named (in their
internal name) properly. When processing a binary file without
names, or if the names don't match in general, that's not true.

To fix this, use ModuleUtils::renameFunctions to do a proper
renaming up front.

Also fix renameFunctions to not assert on the case of
renaming a function to the same name it already has.

Helps #2680
2020-03-05 16:55:09 -08:00
Sam Clegg
42b61e3c2e
Use wat over wast for text format filenames (#2518) 2019-12-08 20:50:25 -06:00
Heejin Ahn
6600870380
Use package name in imports (NFC) (#2462)
Don't directly import names from shared.py and support.py, and use
prefixes instead. Also this reorders imports based on PEP
recommendation.
2019-11-22 14:46:09 -08:00
Alon Zakai
28dfa0e023
Warning improvements (#2438)
If wasm-opt is run with no passes, warn, as we've gotten reports that people
assume a tool called "wasm-opt" should optimize automatically (but we follow
llvm's opt convention of not doing so).

Add a --quiet (-q) flag that suppresses this minor warning, and the other minor
warning where there is no output file.
2019-11-15 16:53:35 -08:00
Beuc
f5f53bb222 asyncify: support *-matching in whitelist and blacklist (#2344)
See emscripten-core/emscripten#9381 for rationale.
2019-09-23 13:57:48 -07:00
Alon Zakai
b61f67c33d
Support response files, and use that in Asyncify (#2319)
See emscripten-core/emscripten#9206, the asyncify names can need complex escaping, so this provides an escape hatch.
2019-08-30 16:51:09 -07:00
Sam Clegg
c8a797d120 Switch python indentation from 2-space to 4-space (#2299)
pep8 specifies 4 space indentation.  The use of 2 spaces is, I believe
a historical anomaly where certain large organizations such as google
chose 2 over 4 and have yet to make the switch.

Since there isn't too much code in binaryen today it seems reasonable to
make the switch.
2019-08-16 13:31:52 -07:00
Alon Zakai
0ec9ddf416
Proper Asyncify list name handling (#2275)
The lists are comma separated, but the names can have internal commas since they are human-readable. This adds awareness of bracketing things, so void foo(int, double) is parsed as a single function name, properly.

Helps emscripten-core/emscripten#9128
2019-07-31 20:33:26 -07:00
Alon Zakai
cbcca4cf42
Python3-ify check.py and auto_update_tests.py (#2270)
I fixed flatten.bin.txt which seems to have just had some corrupted data, and I removed some fancy unicode from the spec comments tests, which I'm not sure it's important enough to figure out how to fix.

Fixes #1691
2019-07-31 17:41:06 -07:00
Alon Zakai
ccd95f8f57
Asyncify: whitelist and blacklist support (#2264)
The blacklist means "functions here are to be ignored and not instrumented, we can assume they never unwind." The whitelist means "only these functions, and no others, can unwind." I had hoped such lists would not be necessary, since Asyncify's overhead is much smaller than the old Asyncify and Emterpreter, but as projects have noticed, the overhead to size and speed is still significant. The lists give power users a way to reduce any unnecessary overhead.

A slightly tricky thing is escaping of names: we escape names from the names section (see #2261 #1646). The lists arrive in human-readable format, so we escape them before comparing to the internal escaped names. To enable that I refactored wasm-binary a little bit to provide the escaping logic, cc @yurydelendik

If both lists are specified, an error is shown (since that is meaningless). If a name appears in a list that is not in the module, we show a warning, which will hopefully help people debug typos etc. I had hoped to make this an error, but the problem is that due to inlining etc. a single list will not always work for both unoptimized and optimized builds (a function may vanish when optimizing, due to duplicate function elimination or inlining).

Fixes #2218.
2019-07-26 13:45:48 -07:00
Alon Zakai
774fdbb2f6
Bysyncify => Asyncify (#2226)
After some discussion this seems like a less confusing name: what the pass does is "asyncify" code, after all.

The one downside is the name overlaps with the old emscripten "Asyncify" utility, which we'll need to clarify in the docs there.

This keeps the old --bysyncify flag around for now, which is helpful for avoiding temporary breakage on CI as we move the emscripten side as well.
2019-07-15 14:50:04 -07:00