Skip to content

Commit 49aa246

Browse files
authored
Merge branch 'main' into wasm64-pthreads
2 parents 8a820e6 + 0c35c4a commit 49aa246

File tree

167 files changed

+7052
-4025
lines changed

Some content is hidden

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

167 files changed

+7052
-4025
lines changed

.circleci/config.yml

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ commands:
4242
command: |
4343
# TODO: Make these part of the base image
4444
apt-get install libu2f-udev libvulkan1
45-
wget -O ~/chrome.deb https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb
45+
#wget -O ~/chrome.deb https://dl.google.com/linux/direct/google-chrome-beta_current_amd64.deb
4646
# If that download link breaks, temporarily use this URL instead:
47-
# wget -O ~/chrome.deb https://storage.googleapis.com/webassembly/chrome/google-chrome-stable_current_amd64.deb
47+
# TODO(sbc): Disable this once we figure out whats up with the
48+
# current beta.
49+
wget -O ~/chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
4850
dpkg -i ~/chrome.deb
4951
emsdk-env:
5052
description: "emsdk_env.sh"
@@ -107,7 +109,7 @@ commands:
107109
description: "install canary version of node"
108110
steps:
109111
- install-node-version:
110-
node_version: "20.0.0-v8-canary2023041819be670741"
112+
node_version: "21.0.0-v8-canary20230822f5e30d0702"
111113
canary: true
112114
install-v8:
113115
description: "install v8 using jsvu"
@@ -358,7 +360,9 @@ commands:
358360
# that are not included by "./embuilder build ALL". For example the
359361
# PIC version of libSDL which is used by test_sdl2_misc_main_module
360362
export EM_FROZEN_CACHE=""
361-
test/runner emrun
363+
# TODO(sbc): Re-enable once we figure out why the emrun tests are
364+
# locking up.
365+
# test/runner emrun
362366
# skip test_zzz_zzz_4gb_fail as it OOMs on the current bot
363367
test/runner posixtest_browser.test_pthread_create_1_1 browser skip:browser.test_zzz_zzz_4gb_fail skip:browser.test_zzz_zzz_4gb_fail_wasm64
364368
- upload-test-results
@@ -543,6 +547,10 @@ jobs:
543547
wasmfs.test_readdir
544548
wasmfs.test_readdir_unlink
545549
wasmfs.test_unistd_pipe
550+
wasmfs.test_unistd_io
551+
wasmfs.test_unistd_curdir
552+
wasmfs.test_poll
553+
wasmfs.test_fs_64bit
546554
wasmfs.test_fs_write
547555
wasmfs.test_fs_writev
548556
wasmfs.test_fs_writev_rawfs
@@ -584,33 +592,56 @@ jobs:
584592
steps:
585593
- run-tests-linux:
586594
test_targets: "wasm2js1"
587-
test-wasm64:
595+
test-wasm64l:
588596
environment:
589597
EMTEST_SKIP_NODE_CANARY: "1"
598+
executor: bionic
599+
steps:
600+
- run-tests-linux:
601+
frozen_cache: false
602+
# On older versions of node wasm64l.test_bigswitch uses a lot (~3.5Gb)
603+
# of memory, so skip it here, but run it in test-wasm64 instead which
604+
# has node canary installed.
605+
test_targets: "wasm64l skip:wasm64l.test_bigswitch"
606+
test-wasm64:
590607
# We don't use `bionic` here since its tool old to run recent node versions:
591608
# `/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found`
592609
executor: linux-python
593610
steps:
594611
- prepare-for-tests
595612
# The linux-python image uses /home/circleci rather than /root and jsvu
596-
# hardcodes /root into its launcher scripts do we need to reinstall v8.
613+
# hardcodes /root into its launcher scripts so we need to reinstall v8.
597614
- run: rm -rf $HOME/.jsvu
598615
- install-v8
599-
- run-tests:
600-
title: "wasm64l"
601-
# On older versions of node wasm64l.test_bigswitch uses a lot (~3.5Gb)
602-
# of memory, so skip it here, but run it below under node-canary.
603-
test_targets: "wasm64l skip:wasm64l.test_bigswitch"
604616
- install-node-canary
605617
- run-tests:
606618
title: "wasm64"
607619
test_targets: "
608620
wasm64
609-
wasm64_4gb.test_hello_world
621+
core_2gb.test_*em_asm*
622+
core_2gb.test_*embind*
610623
wasm64l.test_bigswitch
611624
other.test_memory64_proxies
612625
other.test_failing_growth_wasm64"
613626
- upload-test-results
627+
test-wasm64_4gb:
628+
environment:
629+
# Only run 2 tests at a time to avoid OOM (since each tests used >4gb)
630+
EMCC_CORES: "2"
631+
# We don't use `bionic` here since its too old to run recent node versions:
632+
# `/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found`
633+
executor: linux-python
634+
steps:
635+
- prepare-for-tests
636+
# The linux-python image uses /home/circleci rather than /root and jsvu
637+
# hardcodes /root into its launcher scripts so we need to reinstall v8.
638+
- run: rm -rf $HOME/.jsvu
639+
- install-v8
640+
- install-node-canary
641+
- run-tests:
642+
title: "wasm64_4gb"
643+
test_targets: "wasm64_4gb"
644+
- upload-test-results
614645
test-jsc:
615646
executor: linux-python
616647
steps:
@@ -656,7 +687,7 @@ jobs:
656687
- run-tests:
657688
test_targets: "core0.test_hello_world core2.test_demangle_stacks_symbol_map"
658689
test-node-compat:
659-
# We don't use `bionic` here since its tool old to run recent node versions:
690+
# We don't use `bionic` here since its too old to run recent node versions:
660691
# `/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found`
661692
executor: linux-python
662693
environment:
@@ -862,6 +893,12 @@ workflows:
862893
- test-wasm64:
863894
requires:
864895
- build-linux
896+
- test-wasm64_4gb:
897+
requires:
898+
- build-linux
899+
- test-wasm64l:
900+
requires:
901+
- build-linux
865902
- test-wasm2js1:
866903
requires:
867904
- build-linux

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,3 +593,4 @@ a license to everyone to use it as detailed in LICENSE.)
593593
* Michael Schmuki <michael@schmuki.io>
594594
* Skye Gibney <skyejgibney@gmail.com>
595595
* Piotr Wierciński <laminowany@gmail.com>
596+
* 郑苏波 (Super Zheng) <superzheng@tencent.com>

ChangeLog.md

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

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

21-
3.1.45 (in development)
21+
3.1.46 (in development)
2222
-----------------------
23+
- libunwind updated to LLVM 16.0.6. (#20088)
24+
25+
3.1.45 - 08/23/23
26+
-----------------
2327
- The function used to add symbols the JS library has been renamed from
2428
`mergeInto`, to the more specific `addToLibrary`. This new function does not
2529
require the passing of `LibraryManager.library` as a first argument. The old
2630
`mergeInto` continues to exist for backwards compat.
31+
- The `--log_html` option was removed from `emrun`. This option was already not
32+
working with python3.8 or above so we hope is safe to say that nobody was
33+
relying on it.
2734

2835
3.1.44 - 07/25/23
2936
-----------------

embuilder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
'libstandalonewasm-nocatch',
6565
'crt1',
6666
'crt1_proxy_main',
67+
'crtbegin',
6768
'libunwind-except',
6869
'libnoexit',
6970
'sqlite3',

emcc.py

100755100644
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,8 +1781,11 @@ def set_max_memory():
17811781
diagnostics.warning('unused-command-line-argument', 'MAXIMUM_MEMORY is only meaningful with ALLOW_MEMORY_GROWTH')
17821782
settings.MAXIMUM_MEMORY = settings.INITIAL_MEMORY
17831783

1784-
# INITIAL_MEMORY sets a lower bound for MAXIMUM_MEMORY
17851784
if 'MAXIMUM_MEMORY' not in user_settings:
1785+
if settings.ALLOW_MEMORY_GROWTH and settings.INITIAL_MEMORY > 2 * 1024 * 1024 * 1024:
1786+
settings.MAXIMUM_MEMORY = 4 * 1024 * 1024 * 1024
1787+
1788+
# INITIAL_MEMORY sets a lower bound for MAXIMUM_MEMORY
17861789
if settings.INITIAL_MEMORY > settings.MAXIMUM_MEMORY:
17871790
settings.MAXIMUM_MEMORY = settings.INITIAL_MEMORY
17881791

@@ -2358,6 +2361,8 @@ def phase_linker_setup(options, state, newargs):
23582361
# included, as the entire JS library can refer to things that require
23592362
# these exports.)
23602363
settings.REQUIRED_EXPORTS += [
2364+
'emscripten_builtin_memalign',
2365+
'wasmfs_create_file',
23612366
'_wasmfs_mount',
23622367
'_wasmfs_unmount',
23632368
'_wasmfs_read_file',
@@ -2373,6 +2378,9 @@ def phase_linker_setup(options, state, newargs):
23732378
'_wasmfs_chdir',
23742379
'_wasmfs_mknod',
23752380
'_wasmfs_rmdir',
2381+
'_wasmfs_mmap',
2382+
'_wasmfs_munmap',
2383+
'_wasmfs_msync',
23762384
'_wasmfs_read',
23772385
'_wasmfs_pread',
23782386
'_wasmfs_symlink',
@@ -2421,7 +2429,7 @@ def phase_linker_setup(options, state, newargs):
24212429
settings.EXPORT_IF_DEFINED.append('__wasm_apply_data_relocs')
24222430

24232431
if settings.SIDE_MODULE and 'GLOBAL_BASE' in user_settings:
2424-
exit_with_error('GLOBAL_BASE is not compatible with SIDE_MODULE')
2432+
diagnostics.warning('unused-command-line-argument', 'GLOBAL_BASE is not compatible with SIDE_MODULE')
24252433

24262434
if settings.PROXY_TO_WORKER or options.use_preload_plugins:
24272435
settings.DEFAULT_LIBRARY_FUNCS_TO_INCLUDE += ['$Browser']
@@ -2870,10 +2878,12 @@ def get_full_import_name(name):
28702878
if settings.WASM2JS:
28712879
if settings.GENERATE_SOURCE_MAP:
28722880
exit_with_error('wasm2js does not support source maps yet (debug in wasm for now)')
2873-
if settings.WASM_BIGINT:
2874-
exit_with_error('wasm2js does not support WASM_BIGINT')
28752881
if settings.MEMORY64:
28762882
exit_with_error('wasm2js does not support MEMORY64')
2883+
if settings.WASM_BIGINT:
2884+
exit_with_error('wasm2js does not support WASM_BIGINT')
2885+
if settings.CAN_ADDRESS_2GB:
2886+
exit_with_error('wasm2js does not support >2gb address space')
28772887

28782888
if settings.NODE_CODE_CACHING:
28792889
if settings.WASM_ASYNC_COMPILATION:

emrun.py

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
# standalone outside Emscripten directory tree.
1717
import argparse
1818
import atexit
19-
import cgi
2019
import json
2120
import os
2221
import platform
@@ -39,17 +38,11 @@
3938
from SimpleHTTPServer import SimpleHTTPRequestHandler
4039
from urllib import unquote
4140
from urlparse import urlsplit
42-
43-
def print_to_handle(handle, line):
44-
print >> handle, line # noqa: F633
4541
else:
4642
import socketserver
4743
from http.server import HTTPServer, SimpleHTTPRequestHandler
4844
from urllib.parse import unquote, urlsplit
4945

50-
def print_to_handle(handle, line):
51-
handle.write(line + '\n')
52-
5346
# Populated from cmdline params
5447
emrun_options = None
5548

@@ -138,15 +131,6 @@ def tick():
138131
page_last_served_time = None
139132

140133

141-
def format_html(msg):
142-
"""Returns given log message formatted to be outputted on a HTML page."""
143-
if not msg.endswith('\n'):
144-
msg += '\n'
145-
msg = cgi.escape(msg)
146-
msg = msg.replace('\r\n', '<br />').replace('\n', '<br />')
147-
return msg
148-
149-
150134
# HTTP requests are handled from separate threads - synchronize them to avoid race conditions
151135
http_mutex = threading.RLock()
152136

@@ -156,10 +140,7 @@ def logi(msg):
156140
"""
157141
global last_message_time
158142
with http_mutex:
159-
if emrun_options.log_html:
160-
sys.stdout.write(format_html(msg))
161-
else:
162-
print_to_handle(sys.stdout, msg)
143+
sys.stdout.write(msg + '\n')
163144
sys.stdout.flush()
164145
last_message_time = tick()
165146

@@ -171,10 +152,7 @@ def logv(msg):
171152
global last_message_time
172153
if emrun_options.verbose:
173154
with http_mutex:
174-
if emrun_options.log_html:
175-
sys.stdout.write(format_html(msg))
176-
else:
177-
print_to_handle(sys.stdout, msg)
155+
sys.stdout.write(msg + '\n')
178156
sys.stdout.flush()
179157
last_message_time = tick()
180158

@@ -184,10 +162,7 @@ def loge(msg):
184162
"""
185163
global last_message_time
186164
with http_mutex:
187-
if emrun_options.log_html:
188-
sys.stderr.write(format_html(msg))
189-
else:
190-
print_to_handle(sys.stderr, msg)
165+
sys.stderr.write(msg + '\n')
191166
sys.stderr.flush()
192167
last_message_time = tick()
193168

@@ -203,7 +178,7 @@ def browser_logi(msg):
203178
"""
204179
global last_message_time
205180
msg = format_eol(msg)
206-
print_to_handle(browser_stdout_handle, msg)
181+
browser_stdout_handle.write(msg + '\n')
207182
browser_stdout_handle.flush()
208183
last_message_time = tick()
209184

@@ -213,7 +188,7 @@ def browser_loge(msg):
213188
"""
214189
global last_message_time
215190
msg = format_eol(msg)
216-
print_to_handle(browser_stderr_handle, msg)
191+
browser_stderr_handle.write(msg + '\n')
217192
browser_stderr_handle.flush()
218193
last_message_time = tick()
219194

@@ -527,7 +502,7 @@ def print_messages_due(self):
527502
return
528503

529504
def serve_forever(self, timeout=0.5):
530-
global last_message_time, page_exit_code, emrun_not_enabled_nag_printed
505+
global page_exit_code, emrun_not_enabled_nag_printed
531506
self.is_running = True
532507
self.timeout = timeout
533508
logi('Now listening at http://%s/' % ':'.join(map(str, self.socket.getsockname())))
@@ -1574,9 +1549,6 @@ def parse_args():
15741549
'automated runs. (If target browser != Firefox, '
15751550
'this parameter is ignored)')
15761551

1577-
parser.add_argument('--log_html', action='store_true',
1578-
help='If set, information lines are printed out an HTML-friendly format.')
1579-
15801552
parser.add_argument('--private_browsing', action='store_true',
15811553
help='If specified, opens browser in private/incognito mode.')
15821554

emscripten-version.txt

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

site/source/docs/compiling/Running-html-files-with-emrun.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ The following command line flags affect logging output:
113113
- ``--lot_stderr <filename>``: Write all ``stderr`` messages from the application to the named file (instead of printing to terminal).
114114
- ``--system_info``: Print detailed information about the current system before launching. This is useful during automated runs when you want to capture hardware information to logs.
115115
- ``--browser_info``: Print information about which browser is about to be launched.
116-
- ``--log_html``: Reformat application output as HTML markup.
117116
- ``--no_emrun_detect``: Hide the warning message that is launched if a target **.html** file is detected to not have been built with ``--emrun``.
118117

119118

site/source/docs/porting/connecting_cpp_and_javascript/embind.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ For example:
146146
.constructor<int, std::string>()
147147
.function("incrementX", &MyClass::incrementX)
148148
.property("x", &MyClass::getX, &MyClass::setX)
149+
.property("x_readonly", &MyClass::getX)
149150
.class_function("getStringFromInstance", &MyClass::getStringFromInstance)
150151
;
151152
}

0 commit comments

Comments
 (0)