Skip to content

Commit 3c0caba

Browse files
authored
Merge branch 'main' into glut-window-resize
2 parents 12865c3 + e0163ab commit 3c0caba

File tree

403 files changed

+7411
-6780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

403 files changed

+7411
-6780
lines changed

.circleci/config.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ commands:
3838
command: |
3939
# TODO: Make these part of the base image
4040
apt-get install -q -y libu2f-udev libvulkan1 xdg-utils
41-
# wget -O ~/chrome.deb https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb
41+
# TODO: Switch by to unstable once
42+
# https://github.com/emscripten-core/emscripten/issues/24780 os
43+
# resolved
44+
wget -O ~/chrome.deb https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb
4245
# If that download link breaks, temporarily use this URL instead:
4346
# wget -O ~/chrome.deb https://storage.googleapis.com/webassembly/chrome/google-chrome-stable_current_amd64.deb
44-
wget -O ~/chrome.deb https://dl.google.com/linux/direct/google-chrome-unstable_current_amd64.deb
4547
dpkg -i ~/chrome.deb
4648
emsdk-env:
4749
description: "emsdk_env.sh"
@@ -317,7 +319,7 @@ commands:
317319
EMTEST_DETECT_TEMPFILE_LEAKS: "0"
318320
# --no-sandbox because we are running as root and chrome requires
319321
# this flag for now: https://crbug.com/638180
320-
CHROME_FLAGS_BASE: "--no-first-run -start-maximized --no-sandbox --use-gl=swiftshader --user-data-dir=/tmp/chrome-emscripten-profile --enable-experimental-web-platform-features --enable-features=JavaScriptSourcePhaseImports"
322+
CHROME_FLAGS_BASE: "--no-first-run -start-maximized --no-sandbox --enable-unsafe-swiftshader --use-gl=swiftshader --user-data-dir=/tmp/chrome-emscripten-profile --enable-experimental-web-platform-features --enable-features=JavaScriptSourcePhaseImports"
321323
# Increase the window size to avoid flaky sdl tests see #24236.
322324
CHROME_FLAGS_HEADLESS: "--headless=new --window-size=1024,768 --remote-debugging-port=1234"
323325
CHROME_FLAGS_WASM: "--enable-experimental-webassembly-features --js-flags=\"--experimental-wasm-stack-switching --experimental-wasm-type-reflection --experimental-wasm-rab-integration\""

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ jobs:
6161
echo "Checking out ${{ github.base_ref }}"
6262
git checkout ${{ github.base_ref }}
6363
git rev-parse HEAD
64-
# Hack to honor changes to rebaseline_tests.py in the current PR
65-
git checkout - ./tools/maint/rebaseline_tests.py
64+
# Uncomment this like to pull the rebaseline_tests.py from the
65+
# current branch:
66+
# git checkout - ./tools/maint/rebaseline_tests.py
6667
./bootstrap
6768
if ! ./tools/maint/rebaseline_tests.py --check-only; then
6869
echo "Test expectations are out-of-date on the target branch."

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ See docs/process.md for more on how version tagging works.
2020

2121
4.0.12 (in development)
2222
-----------------------
23+
- libcxx, libcxxabi, libunwind, and compiler-rt were updated to LLVM 20.1.8.
24+
(#24757)
25+
- The `fsblkcnt_t` and `fsfilcnt_t` types used by `statfs`/`statvfs` were
26+
changed from 32-bit to 64-bit. (#24769)
2327
- Support for `-sTEXT_DECODER=0` was removed, due to widespread support for
2428
`TextDecoder`. The remaining valid values for this setting are `=1`
2529
(conditional use of `TextDecoder` with fallback) and `=2` (unconditional use

site/source/docs/api_reference/emscripten.h.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ Functions
399399
400400
401401
.. note::
402-
- Main loop blockers block the main loop from running, and can be counted to show progress. In contrast, ``emscripten_async_calls`` are not counted, do not block the main loop, and can fire at specific time in the future.
402+
- Main loop blockers block the main loop from running, and can be counted to show progress. In contrast, :c:func:`emscripten_async_call` is not counted, does not block the main loop, and can fire at a specific time in the future.
403403
404404
:param em_arg_callback_func func: The main loop blocker function. The function signature must have a ``void*`` parameter for passing the ``arg`` value.
405405
:param void* arg: User-defined arguments to pass to the blocker function.

src/lib/libnoderawfs.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,18 @@ addToLibrary({
8484
var stream = FS.getStreamChecked(fd);
8585
return fs.fstatSync(stream.nfd);
8686
},
87-
statfsStream(stream) {
88-
return fs.statfsSync(stream.path);
87+
statfs(path) {
88+
// Node's fs.statfsSync API doesn't provide these attributes so include
89+
// some defaults.
90+
var defaults = {
91+
fsid: 42,
92+
flags: 2,
93+
namelen: 255,
94+
}
95+
return Object.assign(defaults, fs.statfsSync(path));
8996
},
90-
statfsNode(node) {
91-
return fs.statfsSync(node.path);
97+
statfsStream(stream) {
98+
return FS.statfs(stream.path);
9299
},
93100
chmod(path, mode, dontFollow) {
94101
mode &= {{{ cDefs.S_IALLUGO }}};
@@ -166,7 +173,8 @@ addToLibrary({
166173
},
167174
close(stream) {
168175
VFS.closeStream(stream.fd);
169-
if (!stream.stream_ops && --stream.shared.refcnt <= 0) {
176+
// Don't close stdin/stdout/stderr since they are used by node itself.
177+
if (!stream.stream_ops && --stream.shared.refcnt <= 0 && stream.nfd > 2) {
170178
// This stream is created by our Node.js filesystem, close the
171179
// native file descriptor when its reference count drops to 0.
172180
fs.closeSync(stream.nfd);

src/lib/libsyscall.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ var SyscallsLibrary = {
6666
writeStatFs(buf, stats) {
6767
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_bsize, 'stats.bsize', 'i32') }}};
6868
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_frsize, 'stats.bsize', 'i32') }}};
69-
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_blocks, 'stats.blocks', 'i32') }}};
70-
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_bfree, 'stats.bfree', 'i32') }}};
71-
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_bavail, 'stats.bavail', 'i32') }}};
72-
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_files, 'stats.files', 'i32') }}};
73-
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_ffree, 'stats.ffree', 'i32') }}};
69+
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_blocks, 'stats.blocks', 'i64') }}};
70+
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_bfree, 'stats.bfree', 'i64') }}};
71+
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_bavail, 'stats.bavail', 'i64') }}};
72+
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_files, 'stats.files', 'i64') }}};
73+
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_ffree, 'stats.ffree', 'i64') }}};
7474
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_fsid, 'stats.fsid', 'i32') }}};
7575
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_flags, 'stats.flags', 'i32') }}}; // ST_NOSUID
7676
{{{ makeSetValue('buf', C_STRUCTS.statfs.f_namelen, 'stats.namelen', 'i32') }}};

src/lib/libwebgl.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -663,12 +663,24 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
663663
var contextHandle = glCtx.canvas.GLctxObject.handle;
664664
glCtx[f] = function(...args) {
665665
var ret = orig.apply(this, args);
666-
// Some GL functions take a view of the entire linear memory. Replace
667-
// such arguments with the string 'HEAP' to avoid serializing all of
668-
// memory.
669666
for (var i in args) {
670-
if (ArrayBuffer.isView(args[i]) && args[i].byteLength === HEAPU8.byteLength) {
671-
args[i] = 'HEAP';
667+
if (ArrayBuffer.isView(args[i])) {
668+
// Some GL functions take a view of the entire linear memory. Replace
669+
// such arguments with the string 'HEAP' to avoid serializing all of
670+
// memory.
671+
if (args[i].byteLength === HEAPU8.byteLength) {
672+
args[i] = 'HEAP';
673+
continue;
674+
}
675+
// For large arrays just take the first N elements.
676+
const MAX_ARRAY_ELEMS = 30;
677+
if (args[i].length > MAX_ARRAY_ELEMS) {
678+
const notShown = args[i].length - MAX_ARRAY_ELEMS;
679+
args[i] = args[i].subarray(0, MAX_ARRAY_ELEMS);
680+
args[i] = `[${args[i]}, ... <${notShown} more elements not shown>]`;
681+
} else {
682+
args[i] = `[${args[i]}]`;
683+
}
672684
}
673685
}
674686
#if PTHREADS

src/postamble_minimal.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,17 @@ var imports = {
108108

109109
#if MINIMAL_RUNTIME_STREAMING_WASM_INSTANTIATION
110110
// https://caniuse.com/#feat=wasm and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming
111-
#if MIN_FIREFOX_VERSION < 58 || MIN_CHROME_VERSION < 61 || MIN_NODE_VERSION < 180100 || MIN_SAFARI_VERSION < 150000
111+
#if MIN_FIREFOX_VERSION < 58 || MIN_CHROME_VERSION < 61 || MIN_SAFARI_VERSION < 150000 || ENVIRONMENT_MAY_BE_NODE
112112
#if ASSERTIONS && !WASM2JS
113113
// Module['wasm'] should contain a typed array of the Wasm object data, or a
114114
// precompiled WebAssembly Module.
115115
assert(WebAssembly.instantiateStreaming || Module['wasm'], 'Must load WebAssembly Module in to variable Module.wasm before adding compiled output .js script to the DOM');
116116
#endif
117117
(WebAssembly.instantiateStreaming
118+
#if ENVIRONMENT_MAY_BE_NODE
119+
// Node's fetch API cannot be used for local files, so we cannot use instantiateStreaming
120+
&& !ENVIRONMENT_IS_NODE
121+
#endif
118122
? WebAssembly.instantiateStreaming(fetch('{{{ TARGET_BASENAME }}}.wasm'), imports)
119123
: WebAssembly.instantiate(Module['wasm'], imports)).then((output) => {
120124
#else
@@ -221,13 +225,12 @@ WebAssembly.instantiate(Module['wasm'], imports).then((output) => {
221225
#endif
222226
}
223227

224-
#if ASSERTIONS || WASM == 2
228+
#if WASM == 2
225229
, (error) => {
226230
#if ASSERTIONS
227231
console.error(error);
228232
#endif
229233

230-
#if WASM == 2
231234
#if ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_MAY_BE_SHELL
232235
if (typeof location != 'undefined') {
233236
#endif
@@ -239,9 +242,8 @@ WebAssembly.instantiate(Module['wasm'], imports).then((output) => {
239242
#if ENVIRONMENT_MAY_BE_NODE || ENVIRONMENT_MAY_BE_SHELL
240243
}
241244
#endif
242-
#endif // WASM == 2
243245
}
244-
#endif // ASSERTIONS || WASM == 2
246+
#endif // WASM == 2
245247
);
246248

247249
#if PTHREADS || WASM_WORKERS

src/postamble_modularize.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
// We assign to the `moduleRtn` global here and configure closure to see
55
// this as and extern so it won't get minified.
66

7-
#if WASM_ASYNC_COMPILATION
8-
97
#if USE_READY_PROMISE
108
if (runtimeInitialized) {
119
moduleRtn = Module;
@@ -20,12 +18,6 @@ if (runtimeInitialized) {
2018
moduleRtn = {};
2119
#endif
2220

23-
#else // WASM_ASYNC_COMPILATION
24-
25-
moduleRtn = Module;
26-
27-
#endif // WASM_ASYNC_COMPILATION
28-
2921
#if ASSERTIONS
3022
// Assertion for attempting to access module properties on the incoming
3123
// moduleArg. In the past we used this object as the prototype of the module

src/preamble.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,11 @@ async function instantiateArrayBuffer(binaryFile, imports) {
692692

693693
async function instantiateAsync(binary, binaryFile, imports) {
694694
#if !SINGLE_FILE
695-
if (!binary && typeof WebAssembly.instantiateStreaming == 'function'
695+
if (!binary
696+
#if MIN_FIREFOX_VERSION < 58 || MIN_CHROME_VERSION < 61 || MIN_SAFARI_VERSION < 150000
697+
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/instantiateStreaming
698+
&& WebAssembly.instantiateStreaming
699+
#endif
696700
#if ENVIRONMENT_MAY_BE_WEBVIEW
697701
// Don't use streaming for file:// delivered objects in a webview, fetch them synchronously.
698702
&& !isFileURI(binaryFile)

0 commit comments

Comments
 (0)