Skip to content

Commit 844e8ca

Browse files
authored
Update default Safari version target to 15.0 (#23312)
Update the default MIN_SAFARI_VERSION from 14.1 to 15.0. Also fix the feature matrix code to be correct again as described in #23184
1 parent 229bc6d commit 844e8ca

File tree

6 files changed

+44
-37
lines changed

6 files changed

+44
-37
lines changed

ChangeLog.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,23 @@ See docs/process.md for more on how version tagging works.
2222
----------------------
2323
- compiler-rt, libcxx, libcxxabi, and libunwind were updated to LLVM 19.1.6.
2424
(#22937, #22994, and #23294)
25-
- The Wasm nontrapping-fptoint feature has been enabled by default. clang will
26-
generate nontrapping (saturating) float-to-int conversion instructions for
27-
C typecasts. This should have no effect on programs that do not have
28-
undefined behavior but if the casted floating-point value is outside the range
29-
of the target integer type, the result will be a number of the max or min value
30-
instead of a trap. This also results in a small code size improvement because
31-
of details of the LLVM IR semantics. This feature can be disabled in clang with
32-
the -mno-nontrapping-fptoint flag. (#23007)
33-
- The `WASM_BIGINT` feature has been enabled by default. This has the effect that
34-
Wasm i64 values are passed and returned between Wasm and JS as BigInt values
35-
rather than being split by Binaryen into pairs of Numbers. (#22993)
25+
- The default Safari version targeted by Emscripten has been raised from 14.1
26+
to 15.0 (the `MIN_SAFARI_VERSION` setting) (#23312). This has several effects:
27+
- The Wasm nontrapping-fptoint feature is enabled by default. Clang will
28+
generate nontrapping (saturating) float-to-int conversion instructions for
29+
C typecasts. This should have no effect on programs that do not have
30+
undefined behavior but if the casted floating-point value is outside the range
31+
of the target integer type, the result will be a number of the max or min value
32+
instead of a trap. This also results in a small code size improvement because
33+
of details of the LLVM IR semantics. This feature can be disabled in clang with
34+
the -mno-nontrapping-fptoint flag. (#23007)
35+
- The `WASM_BIGINT` feature is enabled by default. This has the effect that
36+
Wasm i64 values are passed and returned between Wasm and JS as BigInt values
37+
rather than being split by Binaryen into pairs of Numbers. (#22993)
38+
- The `BULK_MEMORY` feature is enabled by default. `memory.copy` and
39+
`memory.fill` instructions are used in the implementation of C `memcpy` and
40+
`memset`, and Clang may generate them elsewhere (#22873). It can be
41+
disabled with the `-mno-bulk-memory` flag.
3642
- When using `-sMODULARIZE` we now assert if the factory function is called with
3743
the JS `new` keyword. e.g. `a = new Module()` rather than `b = Module()`.
3844
This paves the way for marking the function as `async` which does not allow

site/source/docs/tools_reference/settings_reference.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,8 +2186,7 @@ WASM_BIGINT
21862186

21872187
WebAssembly integration with JavaScript BigInt. When enabled we don't need to
21882188
legalize i64s into pairs of i32s, as the wasm VM will use a BigInt where an
2189-
i64 is used. If WASM_BIGINT is present, the default minimum supported browser
2190-
versions will be increased to the min version that supports BigInt.
2189+
i64 is used.
21912190

21922191
Default value: true
21932192

@@ -2928,7 +2927,7 @@ MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
29282927
Minimum supported value is 101000 which was released in 2016-09 (see
29292928
feature_matrix.py).
29302929

2931-
Default value: 140100
2930+
Default value: 150000
29322931

29332932
.. _min_chrome_version:
29342933

src/settings.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,8 +1495,7 @@ var DYNCALLS = false;
14951495

14961496
// WebAssembly integration with JavaScript BigInt. When enabled we don't need to
14971497
// legalize i64s into pairs of i32s, as the wasm VM will use a BigInt where an
1498-
// i64 is used. If WASM_BIGINT is present, the default minimum supported browser
1499-
// versions will be increased to the min version that supports BigInt.
1498+
// i64 is used.
15001499
// [link]
15011500
var WASM_BIGINT = true;
15021501

@@ -1913,7 +1912,7 @@ var MIN_FIREFOX_VERSION = 79;
19131912
// Minimum supported value is 101000 which was released in 2016-09 (see
19141913
// feature_matrix.py).
19151914
// [link]
1916-
var MIN_SAFARI_VERSION = 140100;
1915+
var MIN_SAFARI_VERSION = 150000;
19171916

19181917
// Specifies the oldest version of Chrome. E.g. pass -sMIN_CHROME_VERSION=58 to
19191918
// drop support for Chrome 57 and older.

src/shell.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ var Module = typeof {{{ EXPORT_NAME }}} != 'undefined' ? {{{ EXPORT_NAME }}} : {
3434
#endif // USE_CLOSURE_COMPILER
3535

3636
#if POLYFILL
37-
#if WASM_BIGINT && MIN_SAFARI_VERSION < 140100
38-
// TODO(https://github.com/emscripten-core/emscripten/issues/23184): Fix this back to 150000
37+
#if WASM_BIGINT && MIN_SAFARI_VERSION < 150000
3938
// See https://caniuse.com/mdn-javascript_builtins_bigint64array
4039
#include "polyfill/bigint64array.js"
4140
#endif

test/test_other.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10448,6 +10448,7 @@ def verify_features_sec_linked(feature, expect_in):
1044810448
def compile(flags):
1044910449
self.run_process([EMCC, test_file('hello_world.c')] + flags)
1045010450

10451+
# Default features, unlinked and linked
1045110452
compile(['-c'])
1045210453
verify_features_sec('bulk-memory', True)
1045310454
verify_features_sec('nontrapping-fptoint', True)
@@ -10456,17 +10457,28 @@ def compile(flags):
1045610457
verify_features_sec('multivalue', True)
1045710458
verify_features_sec('reference-types', True)
1045810459

10460+
compile([])
10461+
verify_features_sec_linked('sign-ext', True)
10462+
verify_features_sec_linked('mutable-globals', True)
10463+
verify_features_sec_linked('multivalue', True)
10464+
verify_features_sec_linked('bulk-memory-opt', True)
10465+
verify_features_sec_linked('nontrapping-fptoint', True)
10466+
verify_features_sec_linked('reference-types', True)
10467+
1045910468
# Disable a feature
1046010469
compile(['-mno-sign-ext', '-c'])
1046110470
verify_features_sec('sign-ext', False)
1046210471
# Disable via browser selection
1046310472
compile(['-sMIN_FIREFOX_VERSION=61'])
1046410473
verify_features_sec_linked('sign-ext', False)
10474+
compile(['-sMIN_SAFARI_VERSION=140100'])
10475+
verify_features_sec_linked('bulk-memory-opt', False)
10476+
verify_features_sec_linked('nontrapping-fptoint', False)
1046510477
# Flag disabling overrides default browser versions
1046610478
compile(['-mno-sign-ext'])
1046710479
verify_features_sec_linked('sign-ext', False)
1046810480
# Flag disabling overrides explicit browser version
10469-
compile(['-sMIN_SAFARI_VERSION=150000', '-mno-sign-ext'])
10481+
compile(['-sMIN_SAFARI_VERSION=160000', '-mno-sign-ext'])
1047010482
verify_features_sec_linked('sign-ext', False)
1047110483
# Flag enabling overrides explicit browser version
1047210484
compile(['-sMIN_FIREFOX_VERSION=61', '-msign-ext'])
@@ -10475,18 +10487,12 @@ def compile(flags):
1047510487
compile(['-sMIN_SAFARI_VERSION=150000', '-mno-bulk-memory'])
1047610488
verify_features_sec_linked('bulk-memory-opt', False)
1047710489

10478-
# TODO(https://github.com/emscripten-core/emscripten/issues/23184) set this back to 14.1
10479-
# Also the section below can be deleted/updated once the default is 15.1
10480-
compile(['-sMIN_SAFARI_VERSION=140000'])
10490+
# Bigint ovrride does not cause other features to enable
10491+
compile(['-sMIN_SAFARI_VERSION=140100', '-sWASM_BIGINT=1'])
1048110492
verify_features_sec_linked('bulk-memory-opt', False)
10482-
verify_features_sec_linked('nontrapping-fptoint', False)
1048310493

10484-
compile(['-sMIN_SAFARI_VERSION=150000'])
10485-
verify_features_sec_linked('sign-ext', True)
10486-
verify_features_sec_linked('mutable-globals', True)
10487-
verify_features_sec_linked('multivalue', True)
10488-
verify_features_sec_linked('bulk-memory-opt', True)
10489-
verify_features_sec_linked('nontrapping-fptoint', True)
10494+
compile(['-sMIN_SAFARI_VERSION=140100', '-mbulk-memory'])
10495+
verify_features_sec_linked('nontrapping-fptoint', False)
1049010496

1049110497
def test_js_preprocess(self):
1049210498
# Use stderr rather than stdout here because stdout is redirected to the output JS file itself.
@@ -12365,8 +12371,7 @@ def fail(args, details):
1236512371
# plain -O0
1236612372
legalization_message = 'to disable int64 legalization (which requires changes after link) use -sWASM_BIGINT'
1236712373
fail(['-sWASM_BIGINT=0'], legalization_message)
12368-
# TODO(https://github.com/emscripten-core/emscripten/issues/23184): change this back to 140100 after 15 is default
12369-
fail(['-sMIN_SAFARI_VERSION=140000'], legalization_message)
12374+
fail(['-sMIN_SAFARI_VERSION=140100'], legalization_message)
1237012375
# optimized builds even without legalization
1237112376
optimization_message = '-O2+ optimizations always require changes, build with -O0 or -O1 instead'
1237212377
fail(['-O2'], optimization_message)
@@ -14440,8 +14445,7 @@ def test_reproduce(self):
1444014445

1444114446
def test_min_browser_version(self):
1444214447
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-Wno-transpile', '-Werror', '-sWASM_BIGINT', '-sMIN_SAFARI_VERSION=120000'])
14443-
# TODO(https://github.com/emscripten-core/emscripten/issues/23184): fix back to 15000 once Safari 15 is default
14444-
self.assertContained('emcc: error: MIN_SAFARI_VERSION=120000 is not compatible with WASM_BIGINT (140100 or above required)', err)
14448+
self.assertContained('emcc: error: MIN_SAFARI_VERSION=120000 is not compatible with WASM_BIGINT (150000 or above required)', err)
1444514449

1444614450
err = self.expect_fail([EMCC, test_file('hello_world.c'), '-Wno-transpile', '-Werror', '-pthread', '-sMIN_CHROME_VERSION=73'])
1444714451
self.assertContained('emcc: error: MIN_CHROME_VERSION=73 is not compatible with pthreads (74 or above required)', err)

tools/feature_matrix.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Feature(IntEnum):
4646
Feature.NON_TRAPPING_FPTOINT: {
4747
'chrome': 75,
4848
'firefox': 65,
49-
'safari': 140100, # TODO: Reset back to 150000 when the default changes
49+
'safari': 150000,
5050
'node': 130000,
5151
},
5252
Feature.SIGN_EXT: {
@@ -58,7 +58,7 @@ class Feature(IntEnum):
5858
Feature.BULK_MEMORY: {
5959
'chrome': 75,
6060
'firefox': 79,
61-
'safari': 140100, # TODO: Reset this to 150000 when we update the default.
61+
'safari': 150000,
6262
'node': 130000,
6363
},
6464
Feature.MUTABLE_GLOBALS: {
@@ -70,7 +70,7 @@ class Feature(IntEnum):
7070
Feature.JS_BIGINT_INTEGRATION: {
7171
'chrome': 67,
7272
'firefox': 68,
73-
'safari': 140100, # TODO(https://github.com/emscripten-core/emscripten/issues/23184): set this back to 15 after we update the default targets.
73+
'safari': 150000,
7474
'node': 130000,
7575
},
7676
Feature.THREADS: {

0 commit comments

Comments
 (0)