Skip to content

Commit a173ac7

Browse files
authored
Merge branch 'main' into cw-audio-memory64
2 parents b2c8826 + 3f29dc6 commit a173ac7

Some content is hidden

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

62 files changed

+1712
-372
lines changed

.circleci/config.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,6 @@ jobs:
591591
wasmfs.test_fs_write
592592
wasmfs.test_fs_writev
593593
wasmfs.test_fs_writev_rawfs
594-
wasmfs.test_fs_writeFile
595-
wasmfs.test_fs_writeFile_rawfs
596594
wasmfs.test_fs_readv
597595
wasmfs.test_fs_write
598596
wasmfs.test_fs_readv_rawfs
@@ -818,8 +816,7 @@ jobs:
818816
core2.test_fs_rename_on_existing_rawfs
819817
core2.test_fs_symlink_resolution_nodefs
820818
core2.test_fs_symlink_resolution_rawfs
821-
core2.test_fs_writeFile_rawfs
822-
core2.test_fs_writeFile_wasmfs_rawfs
819+
core2.test_fs_writeFile*
823820
core2.test_fs_write_rawfs
824821
core2.test_fs_writev_rawfs
825822
core2.test_futimens_rawfs

.github/workflows/tag-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
title: Mark ${{ env.RELEASE_VERSION }} as released
2626
body: Update changelog and emscripten-version.txt [ci skip]
2727
team-reviewers: release-reviewers
28+
branch: release_${{ env.RELEASE_VERSION }}
2829
delete-branch: true
2930
- name: Enable auto-merge
3031
run: gh pr merge --squash --auto "${{ steps.cpr.outputs.pull-request-number }}"

ChangeLog.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,16 @@ to browse the changes between the tags.
1818

1919
See docs/process.md for more on how version tagging works.
2020

21-
4.0.3 (in development)
21+
4.0.4 (in development)
2222
----------------------
23+
- An initial port of SDL3 was added. Use it with `-sUSE_SDL=3`. This port
24+
is still experimental. (#23630)
25+
- The `--output_eol` command line flag was renamed `--output-eol` for
26+
consistency with other flags. The old name continues to work as an alias.
27+
(#20735)
28+
29+
4.0.3 - 02/07/25
30+
----------------
2331
- emscan-deps tools was added. This tool wraps clang-scan-deps and injects the
2432
needed `--target` and `--sysroot` argument that would normally be injected by
2533
emcc itself. This enables support for C++20 in cmake projects. (#21987)
@@ -31,6 +39,12 @@ See docs/process.md for more on how version tagging works.
3139
source maps, so it has not worked in many years, and there have been no
3240
requests for it. This has no impact on the source map support in browser
3341
devtools. (#23553)
42+
- The WASMFS fetch backend now fetches files in chunks using HTTP range
43+
requests (if supported by the server). `wasmfs_create_fetch_backend` now
44+
takes a second parameter (`uint32_t chunk_size`) to configure the size of
45+
each chunk. If a file is read a few times with random accesses, a small
46+
chunk size will minimize bandwidth; if a file is read in larger contiguous
47+
ranges, a larger chunk size will reduce the number of requests. (#23021)
3448

3549
4.0.2 - 01/30/25
3650
----------------

docs/emcc.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,12 +574,12 @@ Options that are modified or new in *emcc* are listed below:
574574
[compile] Tells *emcc* to emit an object file which can then be
575575
linked with other object files to produce an executable.
576576

577-
"--output_eol windows|linux"
577+
"--output-eol windows|linux"
578578
[link] Specifies the line ending to generate for the text files
579-
that are outputted. If "--output_eol windows" is passed, the final
580-
output files will have Windows rn line endings in them. With "--
581-
output_eol linux", the final generated files will be written with
582-
Unix n line endings.
579+
that are outputted. If "--output-eol windows" is passed, the final
580+
output files will have Windows "\r\n" line endings in them. With "
581+
--output-eol linux", the final generated files will be written with
582+
Unix "\n" line endings.
583583

584584
"--cflags"
585585
[other] Prints out the flags "emcc" would pass to "clang" to

emcc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
'--bind', '--closure', '--cpuprofiler', '--embed-file',
8383
'--emit-symbol-map', '--emrun', '--exclude-file', '--extern-post-js',
8484
'--extern-pre-js', '--ignore-dynamic-linking', '--js-library',
85-
'--js-transform', '--oformat', '--output_eol',
85+
'--js-transform', '--oformat', '--output_eol', '--output-eol',
8686
'--post-js', '--pre-js', '--preload-file', '--profiling-funcs',
8787
'--proxy-to-worker', '--shell-file', '--source-map-base',
8888
'--threadprofiler', '--use-preload-plugins'
@@ -1348,14 +1348,14 @@ def consume_arg_file():
13481348
exit_with_error('--default-obj-ext is no longer supported by emcc')
13491349
elif arg.startswith('-fsanitize=cfi'):
13501350
exit_with_error('emscripten does not currently support -fsanitize=cfi')
1351-
elif check_arg('--output_eol'):
1351+
elif check_arg('--output_eol') or check_arg('--output-eol'):
13521352
style = consume_arg()
13531353
if style.lower() == 'windows':
13541354
options.output_eol = '\r\n'
13551355
elif style.lower() == 'linux':
13561356
options.output_eol = '\n'
13571357
else:
1358-
exit_with_error(f'Invalid value "{style}" to --output_eol!')
1358+
exit_with_error(f'invalid value for --output-eol: `{style}`')
13591359
# Record PTHREADS setting because it controls whether --shared-memory is passed to lld
13601360
elif arg == '-pthread':
13611361
settings.PTHREADS = 1

emscripten-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.3-git
1+
4.0.4-git

site/source/docs/contributing/developers_guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The :ref:`Emscripten Compiler Frontend (emcc) <emccdoc>` is a python script that
8282
- **emcc** then calls `emscripten.py <https://github.com/emscripten-core/emscripten/blob/main/tools/emscripten.py>`_
8383
which performs the final transformation to Wasm (including invoking
8484
**wasm-emscripten-finalize** from Binaryen) and calls the JS compiler
85-
(see ``src/compiler.mjs`` and related files) which emits the JS.
85+
(see ``tools/compiler.mjs`` and related files) which emits the JS.
8686
- If optimizing Wasm, **emcc** will then call **wasm-opt**, run meta-dce, and
8787
other useful things. It will also run JS optimizations on the JS that is
8888
emitted alongside the Wasm.

site/source/docs/tools_reference/emcc.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,9 @@ Options that are modified or new in *emcc* are listed below:
566566
[compile]
567567
Tells *emcc* to emit an object file which can then be linked with other object files to produce an executable.
568568

569-
``--output_eol windows|linux``
569+
``--output-eol windows|linux``
570570
[link]
571-
Specifies the line ending to generate for the text files that are outputted. If "--output_eol windows" is passed, the final output files will have Windows \r\n line endings in them. With "--output_eol linux", the final generated files will be written with Unix \n line endings.
571+
Specifies the line ending to generate for the text files that are outputted. If "--output-eol windows" is passed, the final output files will have Windows ``\r\n`` line endings in them. With "--output-eol linux", the final generated files will be written with Unix ``\n`` line endings.
572572

573573
``--cflags``
574574
[other]

src/lib/libdylink.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ var LibraryDylink = {
627627
// loadModule loads the wasm module after all its dependencies have been loaded.
628628
// can be called both sync/async.
629629
function loadModule() {
630+
#if PTHREADS
630631
// The first thread to load a given module needs to allocate the static
631632
// table and memory regions. Later threads re-use the same table region
632633
// and can ignore the memory region (since memory is shared between
@@ -636,6 +637,7 @@ var LibraryDylink = {
636637
// locking in `dynlink.c`.
637638
var firstLoad = !handle || !{{{ makeGetValue('handle', C_STRUCTS.dso.mem_allocated, 'i8') }}};
638639
if (firstLoad) {
640+
#endif
639641
// alignments are powers of 2
640642
var memAlign = Math.pow(2, metadata.memoryAlign);
641643
// prepare memory
@@ -648,21 +650,27 @@ var LibraryDylink = {
648650
{{{ makeSetValue('handle', C_STRUCTS.dso.table_addr, 'tableBase', '*') }}};
649651
{{{ makeSetValue('handle', C_STRUCTS.dso.table_size, 'metadata.tableSize', 'i32') }}};
650652
}
653+
#if PTHREADS
651654
} else {
655+
// Read the values for tableBase and memoryBase from shared memory. The
656+
// thread that first loaded the DLL already set these values.
652657
memoryBase = {{{ makeGetValue('handle', C_STRUCTS.dso.mem_addr, '*') }}};
653658
tableBase = {{{ makeGetValue('handle', C_STRUCTS.dso.table_addr, '*') }}};
654659
}
660+
#endif
655661

656-
var tableGrowthNeeded = tableBase + metadata.tableSize - {{{ from64Expr('wasmTable.length') }}};
657-
if (tableGrowthNeeded > 0) {
662+
if (metadata.tableSize) {
663+
#if ASSERTIONS
664+
assert({{{ from64Expr('wasmTable.length') }}} == tableBase, `unexpected table size while loading ${libName}: ${wasmTable.length}`);
665+
#endif
658666
#if DYLINK_DEBUG
659-
dbg("loadModule: growing table: " + tableGrowthNeeded);
667+
dbg("loadModule: growing table by: " + metadata.tableSize);
660668
#endif
661-
wasmTable.grow({{{ toIndexType('tableGrowthNeeded') }}});
669+
wasmTable.grow({{{ toIndexType('metadata.tableSize') }}});
662670
}
663671
#if DYLINK_DEBUG
664-
dbg("loadModule: memory[" + memoryBase + ":" + (memoryBase + metadata.memorySize) + "]" +
665-
" table[" + tableBase + ":" + (tableBase + metadata.tableSize) + "]");
672+
dbg(`loadModule: memory[${memoryBase}:${memoryBase + metadata.memorySize}]` +
673+
` table[${tableBasex}:${tableBase + metadata.tableSize}]`);
666674
#endif
667675

668676
// This is the export map that we ultimately return. We declare it here

src/lib/libfetchfs.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ addToLibrary({
88
$FETCHFS__deps: ['$stringToUTF8OnStack', 'wasmfs_create_fetch_backend'],
99
$FETCHFS: {
1010
createBackend(opts) {
11-
return _wasmfs_create_fetch_backend(stringToUTF8OnStack(opts.base_url));
12-
}
11+
return withStackSave(
12+
() => _wasmfs_create_fetch_backend(
13+
stringToUTF8OnStack(opts.base_url ?? ""),
14+
opts.chunkSize | 0
15+
)
16+
);
17+
},
1318
},
1419
});
1520

0 commit comments

Comments
 (0)