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

8801 Коммитов

Автор SHA1 Сообщение Дата
Dexter Chua da6d09491f
Fix --use-preload-plugins with -s LZ4 (#13235) 2021-02-09 13:13:14 -08:00
Sam Clegg d72835a3b9
Add new REVERSE_DEPS setting to control reverse dependencies (#13448)
See settings.js for details of how the option works.

Fixes: #13409
2021-02-09 09:49:46 -08:00
Alon Zakai e0138dfc2f
Avoid using WasmOffsetConverter when Module.instantiateWasm (#13425)
Module.instantiateWasm is a callback the user provides, and then the user is
in change of fetching and instantiating the wasm. In that code path emscripten
never sees the wasm binary, which means we cannot create a
WasmOffsetConverter.

With this PR we will not hang on startup, and we will still detect problems, but
the sanitizer's own stack traces will mark function names as "unknown". That will
limit the santizer's usefulness, but they do still detect errors, and the browser's
own stack traces may be enough to diagnose things.

Fixes #13424
2021-02-08 10:27:27 -08:00
jprendes 46ade19398
Add side module table entries to functionsInTableMap (#13385)
Fix incorrect "function in Table but not functionsInTableMap" assertions
by adding new entries in the table from a side module to
functionsInTableMap.

Fixes #13347
Fixes #13040
2021-02-04 14:29:18 -08:00
juj 5d22425c86
4GB emmalloc (#13258)
* Add support for emmalloc for 4GB heap sizes. Fix an issue that caused -s MAXIMUM_MEMORY=4G -s ABORTING_MALLOC=0 to crash, instead of returning zero on failed growth operation. Remove the unnecessary 16MB minimum heap growth size clamp: heap growth is not that costly, and 16MB can be excessive for tiny applications. Add emmalloc-debug and emmalloc-debug-log MALLOC options that allow building emmalloc with its debugging options, without needing to manually edit emmalloc.cpp sources to activate. Remove old asm.js/32-bit only code in emmalloc. Remove old workaround for wasm2js codegen bug in emmalloc.

* Update embuilder.py.

* Rename emmalloc special targets to "memvalidate" and "verbose", and adjust their variations to fix embuilder.py.

* Update tests.

* Update variations.

* Fix emmalloc system lib naming.

* Fix memory region merging check and test_emmalloc naming.

* Address review

* Fix case on test_zzz_zzz_4gb_fail

* Rebaseline code size tests
2021-02-04 12:58:43 +02:00
juj 65dbdda5eb
Fix return in {{{ makeDynCall }}} macro and add test. (#13373)
* Fix return in {{{ makeDynCall }}} macro and add test. Clean up unused code and code duplication. Optimize code size to avoid unnecessary 'return's on void functions.

* eslint

* eslint
2021-02-04 12:41:24 +02:00
juj aed8e4678f
Update Emscripten em_math.h header (#13374)
* Add emscripten_math_fmod() function.

* Add EM_MATH_* constants to em_math.h. Alphabetically sort the header and tests.
2021-02-04 12:39:05 +02:00
Derek Schuff 771c941f00
Revert "Cleanup tools/emprofile.py and add more testing. NFC (#13403)" (#13410)
This reverts commit 9fc7f41b9b.
2021-02-03 14:11:23 -08:00
Sam Clegg 2bdbaf3670
Don't disable all parallelism when EMCC_DEBUG is set (#13404)
This enables certain parallel phases such as running llvm-nm in parallel
when calculating system libraries to link.  Developers who what to
disable even that can continue to use `EMCC_CORES=1`.

Continue to disable parallelism in debug mode in these two cases:

1. When building system libraries/ports at link time.
2. In the test runner

While the risk using parallelism and debug mode is diminished due to
recent changes (#13329 #13370) it is still possible for emscripten
processed in debug mode to interfere with each other due to sharing
a temp directory.

See https://bugs.chromium.org/p/chromium/issues/detail?id=1171844
2021-02-02 17:05:39 -08:00
Sam Clegg 9fc7f41b9b
Cleanup tools/emprofile.py and add more testing. NFC (#13403) 2021-02-02 13:25:34 -08:00
Sam Clegg 845ff80658
Add __sys_shutdown stub library function (#13399)
We never really supported this syscall but prior to #13272 this
fact was not evident since the generic socketcall handler had a
catchall the returned ENOSYS.

Fixes: #13393
2021-02-02 19:55:39 +01:00
Derek Schuff cc08b2b299
Don't rely on LLVM's -debug flag in tests (#13390)
It's compiled away in release/non-asserts mode, so the invocation fails
with an unknown argument.
2021-02-01 17:54:57 -08:00
Thomas Lively cdd17b1e87
Remove tests of {i16x8,i32x4}.any_true (#13400)
These instructions were removed from the spec proposal and from V8 because they
were redundant with i8x16.any_true, which has identical semantics. Since they
were removed from V8, these tests started failing. This PR fixes the breakage by
removing the obsolete tests. See https://github.com/WebAssembly/simd/issues/416.
2021-02-01 17:48:36 -08:00
Hugo Amnov f825fa99d9
[WebGPU] Add support for new binding layout model, Update color to use doubles, Update WebGPU headers (#13266)
* WebGPU: Add support for new binding layout model

* WebGPU: Update color to use doubles

* WebGPU: Update generator URL from master to main in struct_info.json

* Rebaseline reference_struct_info.json

Co-authored-by: Kai Ninomiya <kainino@chromium.org>
2021-01-29 20:22:51 -08:00
Sam Clegg df83597bee
Update llvm dependency to 13.0 (#13383)
Followup on #13358.  Remove exceptions now that llvm 13 has rolled
into emscripten-releases.
2021-01-29 11:39:07 -08:00
Sam Clegg e74e0af413
Avoid writing even sanity.txt if FROZEN_CACHE is enabled (#13316)
These improvements to the `FROZE_CACHE` setting allow for a
pre-populated, read-only cache.  In this scenario the cache
is cannot ever be locked, and that we don't even write
the sanity file.

Users can still force a sanity check with `emcc --check`
but no sanity file will ever be written.

Fixes: #13369
2021-01-29 08:06:22 -08:00
waterlike86 4928f8530e
Allow loadWebAssemblyModule to load a compiled wasm (#13252)
Enables loadWebAssemblyModule to use both compiled wasm and binary.
expose mergelibSymbols so it can be used postInstantiate.

For performance reasons we fetch and compile a side module on a separate
thread and post it over to the worker thread with the main module. 

Fixes: #13262
2021-01-28 19:17:19 -08:00
Thomas Lively 4c19197ebc
[UBSan] Fix infinite recursion in type_info::operator== (#13367)
Under UBSan, comparing type_infos triggers a lookup in UBSan's typeinfo cache.
When this cache is not warm, this causes a cache miss, and the code path that
handles that ends up calling __dynamic_cast. __dynamic_cast itself ends up
comparing type_infos and this recursion ends up exhausting the stack.

```
RangeError: Maximum call stack size exceeded
    ...
    at std::type_info::operator==(std::type_info const&) const
    at is_equal(std::type_info const*, std::type_info const*, bool) 
    at __dynamic_cast (<anonymous>:wasm-function[40]:0x8fb)
    at __ubsan::checkDynamicType(void*, void*, unsigned long)
    at HandleDynamicTypeCacheMiss(__ubsan::DynamicTypeCacheMissData*,
        unsigned long, unsigned long, __ubsan::ReportOptions)
    at __ubsan_handle_dynamic_type_cache_miss
    at std::type_info::operator==(std::type_info const&) const
    ...
```

This is not a problem on native platforms because inlining and follow-on
optimizations remove the call to type_info::operator== under __dynamic_cast, so
UBSan never re-enters its type checking routine. In Emscripten, however, we
build libc++abi with -Oz, so these optimizations do not take place. The fix is
to add __attribute__((always_inline)) to type_info::operator==, which is enough
to get the recursion optimized out in -Oz.

Fixes #13330.
Fixes #13324.
2021-01-28 16:59:07 -08:00
Sam Clegg 06825ec9e4
Don't export all symbols in RELOCATABLE mode. (#13366)
Since we don't have many users who use RELOCATABLE directly it
went unnoticed that setting this option on its own was causing all
symbols to be included and exported.

Fixes #13029
2021-01-28 15:57:25 -08:00
Sam Clegg 96ffe11d0f
Remove complexity in caching of llvm-nm results. NFC (#13360)
This extra argument (include_internal) and the extra complexity
it entailed had only a single call site in the test suite.

Calling llvm-nm directly in the test suite is much simpler.
2021-01-28 13:49:07 -08:00
jprendes 88a3b47899
Deterministic dynamic libs order (#13308)
When using pthread with more than one dynamic library the order in which the libraries are linked when the module is loaded in the browser's main thread is non deterministic. This makes the function pointers between the main thread and the workers not compatible.

With this change the main thread links the dynamic libraries in the same deterministic order as in the workers.
This fix only applies to libraries linked when the module is loaded and adds a test to lock down this behavior.
Libraries linked only through dlopen remains unsupported.

Fix #13303
2021-01-28 13:46:07 -08:00
Sam Clegg deab7783df
Update expected llvm version to 13.0 (#13358)
This change temporarily disables the version check to allow
the llvm change to roll in.

Copied from the previous time around: #11637.
2021-01-28 11:46:45 -08:00
Sam Clegg 7c0e89809d
tests: remove get_async_args function. NFC (#13350)
Its cleaner just to inline these settings like all the others.
2021-01-27 17:40:01 -08:00
Sam Clegg bae6cf71ec
Cleanup test_emscripten_async_wget2 (#13348)
- Name the next more meaningfully
- Merge into a single file
- Remove tabs
- Fix fomatting
- Put trivial methods in class
2021-01-27 13:23:41 -08:00
juj 7ff719c378
Restore the dynCall() and dynCall_sig() API into the build (#13296)
* Restore the dynCall() and dynCall_sig() API into the build when -s USE_LEGACY_DYNCALLS=1 is passed. Add support for dynCall() in MINIMAL_RUNTIME builds (that was not implemented before).

* Add ChangeLog entry.

* Rename USE_LEGACY_DYNCALLS to DYNCALLS.

* Inline getDynCaller.

* Address review.

* Merge new dynCall test with old.

* Reformat parseTools.js
2021-01-27 18:12:59 +02:00
mehdisadeghi 01ef6f5577
Add HarfBuzz flag to SDL2_ttf rev 703ebc7c66fd. (#12868)
* Add HarfBuzz flag to SDL2_ttf rev 703ebc7c66fd.

`TTF_USE_HARFBUZ` flag adds complex script support
to SDL_ttf, hence the update to the latest revesion.

Fixes #12845.

* Add a new test for Arabic shaping with HarfBuzz.

This commit adds a test which uses SDL2_ttf for Arabic Shaping with
HarfBuzz. In order to do so, a font with Arabic Glyphs was necessary.
Therefore NotoNaskhArabic font was added.
2021-01-26 14:07:11 -08:00
Sam Clegg 67866c3c42
Fix embuilder --force for ports (#13325)
This was broken at some point (possibly by #9353) but we didn't have a
test for it.
2021-01-26 13:00:12 -08:00
Adam Bujalski ac0a4b3a8a
Disabling flaky test_pthread_cond_signal_1_1 (#13259)
test_pthread_cond_signal_1_1 has very tight timing requirements, and
expects that side threads will be woken and do some action in very short
time. This causes occasional spurious fail of this test not because side
thread(s) hasn't been woken by pthread_cond_signal, but because this
threads hasn't been scheduled and hasn't get CPU on time.

See #13283
2021-01-26 10:38:47 -08:00
Sam Clegg 536a14e5d1
Avoid using EM_IGNORE_SANITY in testcode. (#13317)
This isn't needed provided:
a. the fake tools are good enough to fool our checks
b. we clear the sanity file explicitly between each test iteration.
2021-01-25 16:41:57 -08:00
Sam Clegg 1f4a74860a
tests: Remove force_c paramater from btest method. NFC (#13300)
Since we started passing the filename all the way through to the
compiler (See #13112) this argument has been completely ignored.
2021-01-22 06:32:13 -08:00
Sam Clegg 904a66e8de
Acquire the cache lock before checking for sanity file (#13299)
Without this check there is a race to create that sanity file when
emscripten if first used.   I noticed this strange behavior when I would
run the test suite just after clearig the cache.

On my machine the test suite would launch many emcc processes and each
of them would notice the sanity file as missing and run the checks.
Some of them would see an empty sanify file that one of the other
processes was in the middle of creating (before they flushed it), and
when this happens that process would try to clear the cache!  This
resulted in the cache being clearing by one process while it was being
populated by another.  Not good.

The fix is the hold the cache lock while we check for the sanity file
and while we run the sanity checks.

This problem has always existed but was recently exacerbated by the fact
that we populate the sysroot headers as soon as we start emcc.

Also remove superfluous ensure() calls.  Since we call this during
the constructor these days the cache can be assumed to always exist.
2021-01-21 17:15:19 -08:00
iamahuman 6928ece32d
emcc: support merging static library into a single object (#7683)
Remove the optimization (again) for the special case of single object
input, which skips the linker and directly copies the input object file
to output.

This behavior interferes with linking (merging) all objects in a
library archive into a single object, done with the following command:

    cc -o lib.o -r -Wl,--whole-archive lib.a

The optimization was once useful when no clear distinction was made
between compile mode and link-only mode.  It was also required for
compatibility (see #9510 and #9571).

However, #9510 was addressed by #9511, and #9600 introduced the '-r'
flag that allows to explicitly indicate linking to an object, making the
optimization less useful.
2021-01-21 15:49:14 -08:00
Patric Stout b0da998f6c
Zero sin_zero when writing a sockaddr_in (#13003)
Although not strictly defined by POSIX, it is done by most (all?)
other implementations, most often in patches over the years as
places got forgotten.
This is mostly useful to allow quick comparing between sockaddr_in
to see if they are the same address.

Fixes #12998
2021-01-20 13:39:52 -08:00
Sam Clegg 094e6399ef
Rebaseline other.test_gen_struct_info. NFC (#13291)
Of course right when I landed this new test if crossed paths
with a change the json output.  Doh!
2021-01-20 11:18:35 -08:00
Sam Clegg 585c5e6990
Refactor gen_struct_info to allow separate compilation. NFC. (#13270)
As part of the pending musl update we can no longer (or at least it
becomes problematic) to compile internal musl headers alongside the
public headers.  To avoid this, this change updates gen_struct_info.py
to compile internal headers separately.

To facilitate this, this change adds support for compiling groups of
headers and merging the results into a single json output.

As part of debugging this I added support for compiling every header
file in isolation.  While this is slow, it uncovered a couple of
issues where structs and defines that were listed under the wrong
header and also a header that could not be compiled on its own
(SDL_pixels.h).
2021-01-20 08:52:37 -08:00
Sam Clegg 462ddb4c63
Implement fstatat flag: AT_EMPTY_PATH (#13282)
Also, add new test for fstatat.

I notived this issue while updating to the new musl version that
uses this internally.
2021-01-20 07:55:13 -08:00
Sam Clegg 0c32a9940b
Rebaseline code size tests after llvm change. NFC (#13286) 2021-01-20 06:27:58 -08:00
Sam Clegg ee483fc6c3
test_other: use self.do_runf where it makes sense. NFC. (#13275) 2021-01-18 09:48:00 -08:00
Sam Clegg 0e92f931e6
Improve error message when check for multiple of page size (#13279)
Also:
- remove duplication of wasm page size specification
- remove old reference to asm.js

Fixes: #13277
2021-01-18 08:18:22 -08:00
Sam Clegg 279b7f8780
test: remove two unneeded include paths. NFC. (#13276) 2021-01-18 07:51:53 -08:00
Sam Clegg ba2b891d88
Remove out copyright from some upstream sources. NFC (#13278) 2021-01-18 07:25:55 -08:00
Sam Clegg ae09c9db85
Don't include webgl2.c in regular gl library (#13261)
This fixes big where linking MAIN_MODULE and libgl was bring in
undefined references to GL2 symbols.  Normally including this extra
`webgl.c` file in the library would be harmless since it will be ignored
if no GL2 symbols are used.

However, with MAIN_MODULE mode all objects from all libraries are
included which means that webgl2.o is included which itself references
all webgl2 symbols.

The problem specifically is that `webgl2.c` includes 
`emscripten_webgl2_get_proc_address` which in turn references all
the `emscripten_XXX` versions of the GL2 API such as
`emscripten_glReadBuffer` which are defined in `library_webgl2.js`

Fixes: #13101
2021-01-15 07:18:53 -08:00
juj 7684d4ad34
Remove old leftover MEMFS code (#13255)
* In PR #7918, the option MEMFS_APPEND_TO_TYPED_ARRAYS=0 was removed, dropping the support for using regular JS Arrays to back MEMFS file storage. In this PR, complete the removal of old code that related to JS Array backing, since all files are now typed array backed.

* Migrate tests to use the MEMFS typed array API.

* Fix tests.
2021-01-14 23:24:45 +02:00
Sam Clegg 5ee8fe3ff0
Initial support for pthreads + dynamic linking (#13245)
This support is still experimental and has some major
caveats:

- Only supports load-time dynamic linking
- No support for sharing TLS data between dylibs.

The major change is that workers now also call the module `run` function
although they exit early, once dynamic libraries have all been loaded.

See: #3494
2021-01-14 12:32:29 -08:00
Raffarti 259e2ee58f
Fix `alcCaptureSamples` (#13178)
- Properly read from the circular buffer (fixes #13173)
- Fix requested frame count check (it was failing when requested frequency was higher than source frequency)
2021-01-14 11:33:57 -08:00
Kagami Sascha Rosylight 97f13a10ad
Add libgif port (#13139)
This is useful in building the JPEG XL reference software, for example.
2021-01-13 14:56:33 -08:00
Sam Clegg c5cde8ace3
Cleanup test_size.cpp. NFC. (#13247)
- Fix memory leak.
- Re-enable in safe heap mode (seems to pass just fine).
- Fix indentation.
2021-01-13 14:26:11 -08:00
Sam Clegg ea208ffca0
Re-enable some disabled browser tests. NFC (#13244) 2021-01-13 14:09:18 -08:00
Alon Zakai f58135043a
Disable a flaky recently-added test, asan.test_pthread_cxx_threads (#13242) 2021-01-12 14:18:57 -08:00
Sam Clegg 3c7a8663bb
Fix MODULARIZE + PTHREADS + USE_OFFSET_CONVERTER (asan) (#13236)
Fixes: #13138
2021-01-12 10:45:57 -08:00