Skip to content

Commit

Permalink
Enable WASM_BIGINT by default (emscripten-core#22993)
Browse files Browse the repository at this point in the history
Enables by default by temporarily reducing required Safari version.

Also includes bugfixes for WASM_BIGINT compatibility.
  • Loading branch information
dschuff authored Dec 18, 2024
1 parent 5fe1d64 commit 93d2f8d
Show file tree
Hide file tree
Showing 137 changed files with 202 additions and 245 deletions.
5 changes: 4 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Note that version numbers do not necessarily reflect the amount of changes
between versions. A version number reflects a release that is known to pass all
tests, and versions may be tagged more or less frequently at different times.

Note that there is *no* ABI compatibility guarantee between versions - the ABI
nNote that there is *no* ABI compatibility guarantee between versions - the ABI
may change, so that we can keep improving and optimizing it. The compiler will
automatically invalidate system caches when the version number updates, so that
libc etc. are rebuilt for you. You should also rebuild object files and
Expand All @@ -20,6 +20,9 @@ See docs/process.md for more on how version tagging works.

3.1.75 (in development)
-----------------------
- The `WASM_BIGINT` feature has been enabled by default. This has the effect that
Wasm i64 values are passed and returned between Wasm and JS as BigInt values
rather than being split by Binaryen into pairs of Numbers. (#22993)
- When using `-sMODULARIZE` we now assert if the factory function is called with
the JS `new` keyword. e.g. `a = new Module()` rather than `b = Module()`.
This paves the way for marking the function as `async` which does not allow
Expand Down
2 changes: 1 addition & 1 deletion site/source/docs/tools_reference/settings_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,7 @@ legalize i64s into pairs of i32s, as the wasm VM will use a BigInt where an
i64 is used. If WASM_BIGINT is present, the default minimum supported browser
versions will be increased to the min version that supports BigInt.

Default value: false
Default value: true

.. _emit_producers_section:

Expand Down
2 changes: 1 addition & 1 deletion src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ var DYNCALLS = false;
// i64 is used. If WASM_BIGINT is present, the default minimum supported browser
// versions will be increased to the min version that supports BigInt.
// [link]
var WASM_BIGINT = false;
var WASM_BIGINT = true;

// WebAssembly defines a "producers section" which compilers and tools can
// annotate themselves in, and LLVM emits this by default.
Expand Down
3 changes: 2 additions & 1 deletion src/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ var Module = typeof {{{ EXPORT_NAME }}} != 'undefined' ? {{{ EXPORT_NAME }}} : {
#endif // USE_CLOSURE_COMPILER

#if POLYFILL
#if WASM_BIGINT && MIN_SAFARI_VERSION < 150000
#if WASM_BIGINT && MIN_SAFARI_VERSION < 140100
// TODO(https://github.com/emscripten-core/emscripten/issues/23184): Fix this back to 150000
// See https://caniuse.com/mdn-javascript_builtins_bigint64array
#include "polyfill/bigint64array.js"
#endif
Expand Down
2 changes: 1 addition & 1 deletion test/browser/test_small_js_flags.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4297
4380
12 changes: 6 additions & 6 deletions test/code_size/embind_hello_wasm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.html": 552,
"a.html.gz": 380,
"a.js": 9593,
"a.js.gz": 4230,
"a.wasm": 7615,
"a.wasm.gz": 3471,
"total": 17760,
"total_gz": 8081
"a.js": 9879,
"a.js.gz": 4288,
"a.wasm": 7580,
"a.wasm.gz": 3449,
"total": 18011,
"total_gz": 8117
}
12 changes: 6 additions & 6 deletions test/code_size/embind_val_wasm.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.html": 552,
"a.html.gz": 380,
"a.js": 6724,
"a.js.gz": 2900,
"a.wasm": 9528,
"a.wasm.gz": 4896,
"total": 16804,
"total_gz": 8176
"a.js": 7153,
"a.js.gz": 3042,
"a.wasm": 9493,
"a.wasm.gz": 4872,
"total": 17198,
"total_gz": 8294
}
4 changes: 3 additions & 1 deletion test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
from tools.shared import get_canonical_temp_dir, path_from_root
from tools.utils import MACOS, WINDOWS, read_file, read_binary, write_binary, exit_with_error
from tools.settings import COMPILE_TIME_SETTINGS
from tools import shared, line_endings, building, config, utils
from tools import shared, feature_matrix, line_endings, building, config, utils

logger = logging.getLogger('common')

Expand Down Expand Up @@ -1164,6 +1164,8 @@ def setUp(self):
if node_version < emcc_min_node_version:
self.emcc_args += building.get_emcc_node_flags(node_version)
self.emcc_args.append('-Wno-transpile')
if node_version[0] < feature_matrix.min_browser_versions[feature_matrix.Feature.JS_BIGINT_INTEGRATION]['node'] / 10000:
self.emcc_args.append('-sWASM_BIGINT=0')

self.v8_args = ['--wasm-staging']
self.env = {}
Expand Down
5 changes: 0 additions & 5 deletions test/other/codesize/test_codesize_cxx_ctors1.exports
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ __indirect_function_table
__wasm_call_ctors
_emscripten_stack_alloc
_emscripten_stack_restore
dynCall_iiiiiijj
dynCall_iiiiij
dynCall_iiiiijj
dynCall_jiji
dynCall_viijii
emscripten_stack_get_current
main
memory
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_ctors1.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8502
8352
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_ctors1.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20867
20347
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_ctors1.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
129231
128974
5 changes: 0 additions & 5 deletions test/other/codesize/test_codesize_cxx_ctors2.exports
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
__indirect_function_table
_emscripten_stack_alloc
_emscripten_stack_restore
dynCall_iiiiiijj
dynCall_iiiiij
dynCall_iiiiijj
dynCall_jiji
dynCall_viijii
emscripten_stack_get_current
main
memory
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_ctors2.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8486
8336
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_ctors2.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20835
20315
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_ctors2.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
128680
128423
6 changes: 0 additions & 6 deletions test/other/codesize/test_codesize_cxx_except.exports
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ __wasm_call_ctors
_emscripten_stack_alloc
_emscripten_stack_restore
_emscripten_tempret_set
dynCall_iiiiiijj
dynCall_iiiiij
dynCall_iiiiijj
dynCall_jiiii
dynCall_jiji
dynCall_viijii
emscripten_stack_get_current
main
memory
Expand Down
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_except.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9533
9358
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_except.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24712
24116
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_except.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
171361
171008
5 changes: 0 additions & 5 deletions test/other/codesize/test_codesize_cxx_except_wasm.exports
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@ __indirect_function_table
__trap
__wasm_call_ctors
_emscripten_stack_alloc
dynCall_iiiiiijj
dynCall_iiiiij
dynCall_iiiiijj
dynCall_jiji
dynCall_viijii
main
memory
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_except_wasm.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8464
8321
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_except_wasm.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20760
20240
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_except_wasm.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
142481
142223
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@ __indirect_function_table
__trap
__wasm_call_ctors
_emscripten_stack_alloc
dynCall_iiiiiijj
dynCall_iiiiij
dynCall_iiiiijj
dynCall_jiji
dynCall_viijii
main
memory
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8464
8321
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20760
20240
Original file line number Diff line number Diff line change
@@ -1 +1 @@
145068
144810
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_lto.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8413
8348
16 changes: 8 additions & 8 deletions test/other/codesize/test_codesize_cxx_lto.imports
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
a (fd_seek)
b (emscripten_resize_heap)
c (_tzset_js)
d (_setitimer_js)
e (_emscripten_runtime_keepalive_clear)
f (_abort_js)
g (proc_exit)
h (fd_write)
a (emscripten_resize_heap)
b (_tzset_js)
c (_setitimer_js)
d (_emscripten_runtime_keepalive_clear)
e (_abort_js)
f (proc_exit)
g (fd_write)
h (fd_seek)
i (fd_read)
j (fd_close)
k (environ_sizes_get)
Expand Down
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_lto.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20451
20371
16 changes: 8 additions & 8 deletions test/other/codesize/test_codesize_cxx_lto.sent
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
a (fd_seek)
b (emscripten_resize_heap)
c (_tzset_js)
d (_setitimer_js)
e (_emscripten_runtime_keepalive_clear)
f (_abort_js)
g (proc_exit)
h (fd_write)
a (emscripten_resize_heap)
b (_tzset_js)
c (_setitimer_js)
d (_emscripten_runtime_keepalive_clear)
e (_abort_js)
f (proc_exit)
g (fd_write)
h (fd_seek)
i (fd_read)
j (fd_close)
k (environ_sizes_get)
Expand Down
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_lto.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
121923
121924
6 changes: 0 additions & 6 deletions test/other/codesize/test_codesize_cxx_mangle.exports
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ __wasm_call_ctors
_emscripten_stack_alloc
_emscripten_stack_restore
_emscripten_tempret_set
dynCall_iiiiiijj
dynCall_iiiiij
dynCall_iiiiijj
dynCall_jiiii
dynCall_jiji
dynCall_viijii
emscripten_stack_get_current
free
main
Expand Down
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_mangle.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9538
9361
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_mangle.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24712
24116
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_mangle.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
232870
232517
5 changes: 0 additions & 5 deletions test/other/codesize/test_codesize_cxx_noexcept.exports
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ __indirect_function_table
__wasm_call_ctors
_emscripten_stack_alloc
_emscripten_stack_restore
dynCall_iiiiiijj
dynCall_iiiiij
dynCall_iiiiijj
dynCall_jiji
dynCall_viijii
emscripten_stack_get_current
main
memory
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_noexcept.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8502
8352
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_noexcept.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20867
20347
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_noexcept.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
132038
131781
8 changes: 0 additions & 8 deletions test/other/codesize/test_codesize_cxx_wasmfs.exports
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ __indirect_function_table
__wasm_call_ctors
_emscripten_stack_alloc
_emscripten_stack_restore
dynCall_iiiiiijj
dynCall_iiiiij
dynCall_iiiiijj
dynCall_iiiij
dynCall_iij
dynCall_ji
dynCall_jiji
dynCall_viijii
emscripten_stack_get_current
main
memory
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_wasmfs.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3769
3653
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_wasmfs.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8493
7914
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_wasmfs.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
169290
168928
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_files_js_fs.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7638
7656
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_files_js_fs.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18780
18842
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_files_wasmfs.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2866
2882
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_files_wasmfs.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6140
6202
1 change: 0 additions & 1 deletion test/other/codesize/test_codesize_hello_O0.exports
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ __indirect_function_table
__wasm_call_ctors
_emscripten_stack_alloc
_emscripten_stack_restore
dynCall_jiji
emscripten_stack_get_base
emscripten_stack_get_current
emscripten_stack_get_end
Expand Down
4 changes: 0 additions & 4 deletions test/other/codesize/test_codesize_hello_O0.funcs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ $__wasi_syscall_ret
$__wasm_call_ctors
$_emscripten_stack_alloc
$_emscripten_stack_restore
$_emscripten_tempret_get
$_emscripten_tempret_set
$dynCall_jiji
$emscripten_stack_get_base
$emscripten_stack_get_current
$emscripten_stack_get_end
Expand All @@ -42,7 +39,6 @@ $frexp
$getint
$getpid
$init_pthread_self
$legalstub$dynCall_jiji
$main
$memchr
$out
Expand Down
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8003
8017
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21535
21597
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14531
15142
1 change: 0 additions & 1 deletion test/other/codesize/test_codesize_hello_O1.exports
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ __indirect_function_table
__wasm_call_ctors
_emscripten_stack_alloc
_emscripten_stack_restore
dynCall_jiji
emscripten_stack_get_current
main
memory
4 changes: 0 additions & 4 deletions test/other/codesize/test_codesize_hello_O1.funcs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@ $__wasi_syscall_ret
$__wasm_call_ctors
$_emscripten_stack_alloc
$_emscripten_stack_restore
$_emscripten_tempret_get
$_emscripten_tempret_set
$dynCall_jiji
$emscripten_stack_get_current
$fputs
$fwrite
$legalstub$dynCall_jiji
$main
$puts
$strlen
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O1.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2713
2697
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O1.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6921
6911
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O1.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2535
2634
Loading

0 comments on commit 93d2f8d

Please sign in to comment.