Граф коммитов

22964 Коммитов

Автор SHA1 Сообщение Дата
Kleis Auke Wolthuizen 0fe9b0b2f1
Add missing Closure extern for ftruncateSync (#14877)
Otherwise, the Closure Compiler might rename fs.ftruncateSync
during compilation when the NODERAWFS filesystem backend
is used.
2021-08-16 15:51:44 -07:00
Sam Clegg 0f536c60bb
Remove unused `objectTransfer` command. NFC (#14875)
This command appears to be unused.  `receiveObjectTranster` is
done when the `run` command is received in the worker and nowhere
else.
2021-08-16 13:31:28 -07:00
Sam Clegg 7c8be3dab1
Move a part of pthread_create to native code. NFC (#14858) 2021-08-13 13:12:15 -07:00
Alon Zakai bc2263af6b
Support Sanitizers + Asyncify (#14864)
The problem here was that the asan_c_load_4 etc. methods, that are tiny
functions in C that we let ASan instrument, and then JS calls into, were getting
processed by Asyncify. And we end up calling those asan_c_* methods
during critical Asyncify times like as we begin to rewind - times when it is
not valid to call into instrumented code, or we assert. To fix that, simply
ignore those specific methods in Asyncify - we don't need to process them
anyhow, as they cannot pause.

One test remains broken, test_asyncify_lists_onlylist_d, which I left as
a TODO. That test does something invalid, and it is expected to fail, but
it fails in a different way somehow. The details get complicated due to how
ASan modifies things. Let's leave #14807 open for that.
2021-08-13 13:01:02 -07:00
Sam Clegg 86bbe8bb71
Always include user requested symbols with INCLUDE_FULL_LIBRARY. (#14862)
For some reason we were ignoring the contents of
`DEFAULT_LIBRARY_FUNCS_TO_INCLUDE` when building with
`INCLUDE_FULL_LIBRARY` which means we were not reporting undefined
symbols in this case, and in particular not auto-generating the needed
`__cxa_find_matching_catch` functions in the case of exception handling.

Fixes: #13794
2021-08-13 12:45:50 -07:00
Alon Zakai e9146ec7be
Fix pthreads+dylink+long .so names (#14854)
In pthreads mode, TextDecoder is wrapped in a special way. The logic there
receives buffers and copies them. It asserts the buffer is a Uint8array. The
dylink code hits that assertion as it creates a Int8Array and sends it there.
We could make the wrapper support signed views too, but it seems simpler
to just use the same unsigned view there, which is clearer anyhow.

Fixes #14833
2021-08-13 12:42:03 -07:00
Sam Clegg 58647ae5b0
Allow `abort` to be called in pthread workers (#14860)
The `_abort` library function gets proxied back to the main thread so
doesn't env up calling this function.  However direct calls to the
`abort` runtime function can occur in JS code.  More importantly
worker.js defines `assert` in terms of abort:

```
function assert(condition, text) {
  if (!condition) abort('Assertion failed: ' + text);
}
```

Without this fix `assert` calls from `worker.js` will end up in infinite
recursion.
2021-08-13 07:39:05 -07:00
Sam Clegg ff683c554d
Don't free thread data until after terminating workers (#14859)
Freeing the thread data while the worker hosting the thread is still
running could cause issues in the final moments of the workers life.
2021-08-13 12:02:17 +02:00
Sam Clegg 2d7fc87b81
Missing patch from #14838 which sought to better log JS commands. NFC (#14857) 2021-08-12 19:42:37 -07:00
Sam Clegg 37bfd198c4
Update the version of sqlite used in test to latst version. NFC (#14848)
Updated to https://github.com/sqlite/sqlite at revision
a76b151dab4b7d0b1d5f3ca39bbb118065de1356.

This code causes a crash in llvm before https://reviews.llvm.org/D107940
2021-08-12 17:22:13 -07:00
Sam Clegg 60de3300c4
Move thread exit code to native. NFC (#14853) 2021-08-12 17:00:13 -07:00
Sam Clegg 7e538a419c
Use existing `result` rather than adding to pthread struct. NFC (#14850) 2021-08-12 09:25:02 -07:00
Sam Clegg daa21d3d9a
Inline single use library function. NFC (#14849) 2021-08-12 17:25:26 +02:00
Sam Clegg c22d2121c9
Add test for MINIMAL_RUNTIME + STRICT_JS (#14841)
Also, when AUTO_JS_LIBRARIES is set to 0 (as it is by default in
MINIMAL_RUNTIME mode) we don't want to be including SDL by default
(since it depends on other JS libraies such as library_browser.js).
2021-08-11 20:21:02 -07:00
Sam Clegg d5b891f7d8
In STRICT mode set DEFAULT_TO_CXX setting before the compiler phase (#14847)
Without this the setting of `DEFAULT_TO_CXX` does not effect
the compile phase.
2021-08-11 19:03:42 -07:00
Sam Clegg fc4b81258f
Perform `pthread_exit` logic on return from thread main. (#14839)
Split the logic from `pthread_exit` into `_emscripten_pthread_exit`
so it can be called after return from thread main rather than just
the `threadExit` part.

This is a useful precursor to the musl upgrade where the native
component of `pthread_exit` has non-trivial functionality.

Calling `_emscripten_pthread_exit` can also be used to perform
a thread exit without the `unwind` exception being thrown.
2021-08-11 17:43:43 -07:00
Sam Clegg a0046aef31
Simplify pthread_testcancel. NFC (#14846)
Simply use `pthread_exit` avoid the extra `EM_ASM` and specific new
exception string.

This also happens to be how much implements this. See
musl/src/thread/pthread_cancel.c
2021-08-11 15:51:26 -07:00
Sam Clegg 2126d3c1a6
Add missing dependency __sys_fstatfs64 (#14845)
Fixes: #14602
2021-08-11 13:34:35 -07:00
Sam Clegg 6823c24f7d
tests: use outfilename returned from self.build(). NFC (#14843) 2021-08-11 11:22:35 -07:00
Sam Clegg 579f47ab5e
Only warn about unimplemented syscalls when assersions are enabled. (#14842)
Fixes: https://github.com/emscripten-core/emsdk/issues/865
2021-08-11 11:13:58 -07:00
Sam Clegg f3a529e3a5
tests: Log full JS commands. NFC (#14838)
This change logs the full JS commands run by the test suite
in such a way that the command can be copied and pasted and
run standalone.
2021-08-11 10:40:53 -07:00
Sam Clegg 2052018c7a
Remove auto-skip of missing SharedArrayBuffer. NFC (#14837)
We already have the `@requires_threads` on all tests that
require threads and `EMTEST_LACKS_THREAD_SUPPORT` for those
that want to skip them.
2021-08-10 20:25:41 -07:00
Sam Clegg c0c61442b8
Avoid fflush export in STANDALONE_WASM mode (#14834)
STANDALONE_WASM flushes its std streams on exit via calling
`__stdio_exit` (from musl/src/stdio/__stdio_exit.c) form `exit` (from
musl/src/exit/exit.c).
2021-08-10 10:29:04 -07:00
Sam Clegg 932b3e0b82
Reland "Cleanup tools/emprofile.py and add more testing. NFC (#13403)" (#13416)
Run the new test on windows to prove that it works there.

This was reverted in 13410
2021-08-10 09:47:10 -07:00
Sam Clegg 429063d417
Restore disabled tests: test_mem_init and test_mem_init_request (#14828) 2021-08-10 09:46:14 -07:00
Roman Yurchak 3d3dff7ce8
file_packager.py: Only store the audio file property when true (#14798)
In the .js generated by file_packager.py which currently produces the following attributes for each file,

{"filename":"<path>","start":<start>,"end":<end>,"audio":0}

(exemple here) only store the audio attribute when it's set to 1. Otherwise assume that it is 0 (which should be the case for the vast majority of files). Resulting in,

{"filename":"<path>","start":<start>,"end":<end>}

This saves 9 bytes per file, or in the above linked example about 10kB for 1100 files.

Related to #14695
2021-08-10 09:37:31 -07:00
Sam Clegg b2473ea8f5
Run node with `--unhandled-rejections=throw`. NFC (#14825)
This mode means that unhandled promise rejections will be thown as
exceptions which means that the process will exit with a non-zero return
code.  This is the default mode in v15 and above but we still use v14
and we want this behaviour when running our tests to make sure we don't
silently ignore any unhandled rejections.

See https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode.
2021-08-09 13:13:29 -07:00
Sam Clegg bcb41522b8
Update out-of-date comments that reference asm.js. NFC. (#14819) 2021-08-06 17:07:00 -07:00
Sam Clegg 3d0c70fc5b
Remove use of REPORT_RESULT from tests/test_browser.py (#14818) 2021-08-06 16:58:38 -07:00
Sam Clegg a3afce9d40
Remove sockets.test_webrtc test which has been disabled since 2015. NFC (#14817)
This test was disabled back in 03ba458a16.
Keeping this dead code around is a maintenance burden.  We can resurect
it from history if needed.

Also remove the commented out test above.
2021-08-06 12:00:55 -07:00
Sam Clegg 729ed9b75f
Warning if MAXIUMUM_MEMORY used without ALLOW_MEMORT_GROWTH. NFC (#14816)
Previously we were silently ignoring it.  We considered the alternative
which would be to automatically enable ALLOW_MEMORT_GROWTH but decided
that would be more of a breaking/surprise change.
2021-08-06 11:33:10 -07:00
Sam Clegg 2b858435e4
Remove use of REPORT_RESULT in webgl2 tests (#14812)
Followup to #14727.
2021-08-06 10:52:08 -07:00
Sam Clegg df72b73ab4
Add `-no-pie` to 'gcc' native benchmarker. NFC (#14813)
This means that we don't need to build all our static libraris (e.g.
libz.a) with `-fPIC`.  I guess gcc at some point made `-pie` the default
(or at least the gcc installation on my machine seems to be configured
that way).

Alternative to #14793
2021-08-06 10:34:45 -07:00
Sam Clegg 4a5d7ca9b4
Re-raise pthread exceptions back on the main thread (#13666)
Without this the parent node process will continue, which is especially
bad in `PROXY_TO_PTHREAD` and test code since the node process will never
exit.

As part of this change we also avoid re-throwing `unwind` exceptions.
`unwind` exceptions, just like `ExitStatus` exceptions are designed simply
to unwind the stack and should never reach the outermost frame / event
loop.

Should help with #14344 (at least it should prevent the uncaught unwind issue).
2021-08-06 10:27:54 -07:00
Andrew 071b8b143f
Added timestamp to EmscriptenTouchEvent (#14752)
* Added timestamp to EmscriptenTouchEvent

* Added myself to AUTHORS

* Update src/library_html5.js

Co-authored-by: Alon Zakai <alonzakai@gmail.com>

* Added timestamp member to EmscriptenTouchEvent

* Added timestamp to EmscriptenMouseEvent & EmscriptenKeyboardEvent

* Added timestamps to test_html5_core test

* Updated reference_struct_info.json with new timestamp field in EmscriptenKeyboardEvent & EmscriptenMouseEvent

Co-authored-by: Alon Zakai <alonzakai@gmail.com>
2021-08-06 10:48:06 +03:00
Sam Clegg 2aeebf2ae0
Remove unsued files from system/lib. NFC (#14811)
I tried running build_cxx_natively.sh but it looks like its quite
a long way from actually working.
2021-08-05 17:19:54 -07:00
Alon Zakai a16ad67882
Fix a typo in shell_minimal.js (#14794)
ENVIRONMENT_IS_NODE exists only at runtime, but it was in
an #ifdef. This fixes breakage in the benchmark suite.
2021-08-05 16:50:47 -07:00
Sam Clegg a8d227cbde
Fix init order so that emmalloc comes earlier (#14806)
This allows pthread initialization, for example, to call malloc.

This is an alternative to
ttps://github.com/emscripten-core/emscripten/pull/14774 which avoids the
static constructor completely.

Fixes: #14766
2021-08-05 16:15:30 -07:00
Sam Clegg d0ddb39ac9
Remove handling for MAXIMUM_MEMORY == -1. NFC (#14809)
It was previously possible for MAXIMUM_MEMORY to be set to -1. In
fact it was the default.  However since #10601, it is no longer the
default and there is no way to set it to -1.
2021-08-05 16:07:09 -07:00
Sam Clegg 5737964461
Revive test_binaryen_mem. NFC (#14810)
This test was essentially don't doing anything since we switched
to exported memories since it was never finding the line in the wat
file that it was looking for.

- Rename the test to test_memory_size
- Look for exported memory (and fail if its not found)
- When ALLOW_MEMORY_GROWTH is not specified we currently ignore
  MAXIMUM_MEMORY (we can decide it we want to change that but for
  now this is test of the existing behaviour).
2021-08-05 14:16:30 -07:00
Sam Clegg 8f3c0db3c9
Fix EMCC_FORCE_STDLIBS and re-enable tests for it (#11712)
Refactored the existing test and re-enabled it.  This had
bit rotted in the mean time which meant that EMCC_FORCE_STDLIBS=1
was getting duplicate symbols.

Fixes: #10571
Fixes: #11703
2021-08-05 13:10:53 -07:00
Hood Chatham d35de0bf35
Fix pipe close operation so it doesn't break the other side of pipe (#14685) 2021-08-04 12:46:01 -07:00
Doug Conmy 79c8d81a2e
Fix tzset cacheing (#14769) 2021-08-02 17:42:04 -07:00
Alon Zakai ad6c036199
Fix breakage in test_benchmark.py (#14792) 2021-08-02 17:13:28 -07:00
Sam Clegg 16ff7282dc
Remove em-dwp wrappers accidentally added in #14659 (#14791)
We decided to called these `emdwp` (without the dash) but somehow the PR
that landed still included the old ones.

Fixes: #14782
2021-08-02 15:15:03 -07:00
Alon Zakai a7b23296e4
Finish roll of LLVM 14 version change (#14780) 2021-07-28 17:03:20 -07:00
Sam Clegg b752bd6838
Move most of `Pthread.initRuntime` into native code. NFC (#14775)
This also avoids the use of malloc both for the main pthread struct and
for its TLS vars.  This in turn avoids the use of `withBuiltinMalloc`
since we no longer use malloc here.
2021-07-28 10:18:18 -07:00
juj fb062902f4
Avoid accessing canvas object if not necessary since some users may pass null on context creation when Module['preinitializedWebGLContext'] is used. #13926 (#13979) 2021-07-28 10:12:56 -07:00
Alon Zakai e681d05cfb
Allow LLVM 14 to roll in (#14778) 2021-07-28 17:49:23 +01:00
Sam Clegg 8192916e32
Remove thread support checks from pthread tests. NFC (#14772)
These checks are rather pointless since we don't run any of these tests
without thread support enabled.

There are also several downsides to including this check everywhere:

1. Could lead to false positives since the fallback is simply to
   return zero (success).
2. Prevents the tests from being compiled and run outside of emscripten.
3. Add needless complexit to tests and needless includes of
   emscripten-specific headers.

There are some tests that actually do look like they are designed to be
run in two different modes: with real threading and with stubs.  I left
those tests alone, even those I can't see any cases were we actually run
those tests without pthreads enabled in the test suite.
2021-07-28 09:12:05 -07:00