diff --git a/ChangeLog.md b/ChangeLog.md index 3ab4a5c7ab685..b970d804f2a0e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -20,6 +20,7 @@ See docs/process.md for more on how version tagging works. 3.1.42 (in development) ----------------------- +- Enable WASM_BIGINT support by default. (#19156) - The default minimum Node version of Emscripten output was bumped from 10.19 to 16.0. To run the output JS in an older version of node, you can use e.g. `-sMIN_NODE_VERSION=101900` which will apply the previous minimum version of diff --git a/emcc.py b/emcc.py index 1a65c4d9ed31a..503ae3be16747 100755 --- a/emcc.py +++ b/emcc.py @@ -1895,6 +1895,11 @@ def phase_linker_setup(options, state, newargs): if settings.LZ4: settings.EXPORTED_RUNTIME_METHODS += ['LZ4'] + # WASM_BIGINT defaults to 1 when VMs support it, and when not using wasm2js + default_setting('WASM_BIGINT', + feature_matrix.caniuse(feature_matrix.Feature.JS_BIGINT_INTEGRATION) and + not settings.WASM2JS) + if settings.PURE_WASI: settings.STANDALONE_WASM = 1 settings.WASM_BIGINT = 1 diff --git a/src/library.js b/src/library.js index 8dc36d39ecca6..4ef958dd1f806 100644 --- a/src/library.js +++ b/src/library.js @@ -3157,8 +3157,15 @@ mergeInto(LibraryManager.library, { assert(('dynCall_' + sig) in Module, `bad function pointer type - dynCall function not found for sig '${sig}'`); #endif if (args && args.length) { +#if WASM_BIGINT + // j (64-bit integer) is fine, and is implemented as a BigInt. Without + // legalization, the number of parameters should match (j is not expanded + // into two i's). + assert(args.length === sig.length - 1); +#else // j (64-bit integer) must be passed in as two numbers [low 32, high 32]. assert(args.length === sig.substring(1).replace(/j/g, '--').length); +#endif } else { assert(sig.length == 1); } diff --git a/src/polyfill/bigint64array.js b/src/polyfill/bigint64array.js index 73f0ffb8548cf..7384331ecac2a 100644 --- a/src/polyfill/bigint64array.js +++ b/src/polyfill/bigint64array.js @@ -23,6 +23,12 @@ if (typeof globalThis.BigInt64Array === "undefined") { } function createBigIntArrayShim(partsToBigInt) { + /** + * Closure thinks .set is not defined on Proxy objects for some reason. The + * error is on the line with proxy.set but we can only apply the + * suppression at the function level here. + * @suppress {missingProperties} + */ function createBigInt64Array(array) { if (typeof array === "number") { array = new Uint32Array(2 * array); diff --git a/src/settings.js b/src/settings.js index 6056d7e1ee6a7..1a8c695b08d31 100644 --- a/src/settings.js +++ b/src/settings.js @@ -1381,10 +1381,9 @@ var DYNCALLS = false; // WebAssembly integration with JavaScript BigInt. When enabled we don't need to // 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. +// i64 is used. // [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. diff --git a/test/common.py b/test/common.py index 466632a9eab92..d18c1e9400bd6 100644 --- a/test/common.py +++ b/test/common.py @@ -290,14 +290,13 @@ def metafunc(self, with_bigint): self.skipTest('wasm2js does not support WASM_BIGINT') if self.get_setting('WASM_BIGINT') is not None: self.skipTest('redundant in bigint test config') - self.set_setting('WASM_BIGINT') - self.node_args += shared.node_bigint_flags() f(self) else: + self.set_setting('WASM_BIGINT', '0') f(self) - metafunc._parameterize = {'': (False,), - 'bigint': (True,)} + metafunc._parameterize = {'no_bigint': (False,), + '': (True,)} return metafunc @@ -951,9 +950,9 @@ def cleanup(line): if len(line) > 2048: # Sanity check that this is really the emscripten program/module on # a single line. - assert line.startswith('var Module=typeof Module!="undefined"') - long_lines.append(line) - line = '' + if line.startswith('var Module=typeof Module!="undefined"'): + long_lines.append(line) + line = '' return line lines = [cleanup(l) for l in lines] diff --git a/test/core/dyncall_specific.c b/test/core/dyncall_specific.c index 52c0ed1eef58d..dc3a59e6ad9ab 100644 --- a/test/core/dyncall_specific.c +++ b/test/core/dyncall_specific.c @@ -5,17 +5,27 @@ * found in the LICENSE file. */ +#include #include #include #include int waka(int w, long long xy, int z) { +#ifdef WASM_BIGINT + // With WASM_BIGINT things are straightforward: the 64-bit value just arrives + // with the expected value of 4. + assert(w == 1); + assert(xy == 4); + assert(z == 9); +#else // xy should be 0xffff_ffff_0000_0004 - int x = (int) xy; // should be 4 - int y = xy >> 32; // should be -1 - EM_ASM({ - out('received ' + [$0, $1, $2, $3] + '.'); - }, w, x, y, z); + int x = (int) xy; + int y = xy >> 32; + assert(w == 1); + assert(x == 4); + assert(y == -1); + assert(z == 9); +#endif return 42; } @@ -23,28 +33,56 @@ EM_JS_DEPS(main, "$dynCall"); int main() { EM_ASM({ - // Note that these would need to use BigInts if the file were built with - // -sWASM_BIGINT + +#ifdef WASM_BIGINT + +#if DIRECT + console.log('Received ' + dynCall_iiji($0, 1, BigInt(4), 9)); + return; +#endif +#if DYNAMIC_SIG + console.log('Received ' + dynCall('iiji', $0, [1, BigInt(4), 9])); + return; +#endif +#if EXPORTED + console.log('Received ' + Module['dynCall_iiji']($0, 1, BigInt(4), 9)); + return; +#endif +#if EXPORTED_DYNAMIC_SIG + console.log('Received ' + Module['dynCall']('iiji', $0, [1, BigInt(4), 9])); + return; +#endif +#if FROM_OUTSIDE + eval("console.log('Received ' + Module['dynCall_iiji'](" + $0 + ", 1, BigInt(4), 9))"); + return; +#endif + +#else // WASM_BIGINT + #if DIRECT - console.log('Received ' + dynCall_iiji($0, 1, 4, 0xffffffff, 9)); + console.log('Received ' + dynCall_iiji($0, 1, BigInt(4), 9)); return; #endif #if DYNAMIC_SIG - console.log('Received ' + dynCall('iiji', $0, [1, 4, 0xffffffff, 9])); + console.log('Received ' + dynCall('iiji', $0, [1, BigInt(4), 9])); return; #endif #if EXPORTED - console.log('Received ' + Module['dynCall_iiji']($0, 1, 4, 0xffffffff, 9)); + console.log('Received ' + Module['dynCall_iiji']($0, 1, BigInt(4), 9)); return; #endif #if EXPORTED_DYNAMIC_SIG - console.log('Received ' + Module['dynCall']('iiji', $0, [1, 4, 0xffffffff, 9])); + console.log('Received ' + Module['dynCall']('iiji', $0, [1, BigInt(4), 9])); return; #endif #if FROM_OUTSIDE - eval("console.log('Received ' + Module['dynCall_iiji'](" + $0 + ", 1, 4, 0xffffffff, 9))"); + eval("console.log('Received ' + Module['dynCall_iiji'](" + $0 + ", 1, BigInt(4), 9))"); return; #endif + +#endif + + // We should have run the test and returned before we get here. throw "no test mode"; }, &waka); } diff --git a/test/core/dyncall_specific.out b/test/core/dyncall_specific.out index b3911f38b37b2..665f2d084a1d8 100644 --- a/test/core/dyncall_specific.out +++ b/test/core/dyncall_specific.out @@ -1,2 +1 @@ -received 1,4,-1,9. -Received 42 \ No newline at end of file +Received 42 diff --git a/test/runner.py b/test/runner.py index bf308f224f2e5..d778900c1f238 100755 --- a/test/runner.py +++ b/test/runner.py @@ -92,7 +92,6 @@ 'wasmfs', 'wasm64', 'wasm64l', - 'bigint', ] diff --git a/test/test_browser.py b/test/test_browser.py index 881883869e82d..841c14a844538 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -4074,7 +4074,7 @@ def test_pthread_iostream(self): @requires_threads def test_pthread_unistd_io_bigint(self): - self.btest_exit(test_file('unistd/io.c'), args=['-pthread', '-sPROXY_TO_PTHREAD', '-sWASM_BIGINT']) + self.btest_exit(test_file('unistd/io.c'), args=['-pthread', '-sPROXY_TO_PTHREAD']) # Test that the main thread is able to use pthread_set/getspecific. @also_with_wasm2js @@ -5456,9 +5456,6 @@ def test_dlmalloc_3GB(self): 'main_thread': (['-sPTHREAD_POOL_SIZE=5'],), # using proxy_to_pthread also works, of course 'proxy_to_pthread': (['-sPROXY_TO_PTHREAD', '-sINITIAL_MEMORY=32MB', '-DPROXYING'],), - # using BigInt support affects the ABI, and should not break things. (this - # could be tested on either thread; do the main thread for simplicity) - 'bigint': (['-sPTHREAD_POOL_SIZE=5', '-sWASM_BIGINT'],), }) @requires_threads def test_wasmfs_fetch_backend(self, args): diff --git a/test/test_core.py b/test/test_core.py index 835fac77de60d..8b57bd8fdba2d 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -206,15 +206,10 @@ def metafunc(self, standalone): if not can_do_standalone(self, impure): self.skipTest('Test configuration is not compatible with STANDALONE_WASM') self.set_setting('STANDALONE_WASM') - # we will not legalize the JS ffi interface, so we must use BigInt - # support in order for JS to have a chance to run this without trapping - # when it sees an i64 on the ffi. - self.set_setting('WASM_BIGINT') self.emcc_args.append('-Wno-unused-command-line-argument') # if we are impure, disallow all wasm engines if impure: self.wasm_engines = [] - self.node_args += shared.node_bigint_flags() func(self) metafunc._parameterize = {'': (False,), @@ -536,9 +531,7 @@ def test_i64_varargs(self): @no_wasm2js('wasm_bigint') @requires_node def test_i64_invoke_bigint(self): - self.set_setting('WASM_BIGINT') self.emcc_args += ['-fexceptions'] - self.node_args += shared.node_bigint_flags() self.do_core_test('test_i64_invoke_bigint.cpp') def test_vararg_copy(self): @@ -2309,11 +2302,9 @@ def test_em_js(self, args, force_c): @no_wasm2js('WASM_BIGINT is not compatible with wasm2js') def test_em_js_i64(self): - err = self.expect_fail([EMCC, '-Werror', test_file('core/test_em_js_i64.c')]) + err = self.expect_fail([EMCC, '-sWASM_BIGINT=0', '-Werror', test_file('core/test_em_js_i64.c')]) self.assertContained('emcc: error: using 64-bit arguments in EM_JS function without WASM_BIGINT is not yet fully supported: `foo`', err) - self.set_setting('WASM_BIGINT') - self.node_args += shared.node_bigint_flags() self.do_core_test('test_em_js_i64.c') def test_em_js_address_taken(self): @@ -4251,7 +4242,6 @@ def test_dylink_basics_no_modify(self): self.skipTest('no modify mode only works with non-optimizing builds') if self.get_setting('MEMORY64') == 2: self.skipTest('MEMORY64=2 always requires module re-writing') - self.set_setting('WASM_BIGINT') self.set_setting('ERROR_ON_WASM_CHANGES_AFTER_LINK') self.do_basic_dylink_test() @@ -7204,23 +7194,29 @@ def test_EXPORTED_RUNTIME_METHODS(self): self.set_setting('EXPORTED_RUNTIME_METHODS', ['dynCall', 'addFunction', 'lengthBytesUTF8', 'getTempRet0', 'setTempRet0']) self.do_core_test('EXPORTED_RUNTIME_METHODS.c') + @no_wasm2js('depends on bigint support directly, which wasm2js disallows') @parameterized({ '': [], 'minimal_runtime': ['-sMINIMAL_RUNTIME=1'] }) def test_dyncall_specific(self, *args): - if self.get_setting('WASM_BIGINT') or self.get_setting('MEMORY64'): - self.skipTest('not compatible with WASM_BIGINT') + if self.get_setting('MEMORY64'): + self.skipTest('not compatible with MEMORY64') + if self.get_setting('WASM_BIGINT'): + # define DYNCALLS because this test does test calling them directly, and + # in WASM_BIGINT mode we do not enable them by default (since we can do + # more without them - we don't need to legalize) + args = list(args) + ['-sDYNCALLS', '-DWASM_BIGINT'] cases = [ ('DIRECT', []), - ('DYNAMIC_SIG', ['-sDYNCALLS=1']), + ('DYNAMIC_SIG', ['-sDYNCALLS']), ] if '-sMINIMAL_RUNTIME=1' in args: self.emcc_args += ['--pre-js', test_file('minimal_runtime_exit_handling.js')] else: cases += [ ('EXPORTED', []), - ('EXPORTED_DYNAMIC_SIG', ['-sDYNCALLS=1', '-sEXPORTED_RUNTIME_METHODS=dynCall']), + ('EXPORTED_DYNAMIC_SIG', ['-sDYNCALLS', '-sEXPORTED_RUNTIME_METHODS=dynCall']), ('FROM_OUTSIDE', ['-sEXPORTED_RUNTIME_METHODS=dynCall_iiji']) ] @@ -7228,6 +7224,7 @@ def test_dyncall_specific(self, *args): print(str(args) + ' ' + which) self.do_core_test('dyncall_specific.c', emcc_args=['-D' + which] + list(args) + extra_args) + @no_wasm2js('depends on bigint support directly, which wasm2js disallows') @also_with_wasm_bigint def test_getValue_setValue(self): # these used to be exported, but no longer are by default @@ -7682,16 +7679,12 @@ def test_embind_dynamic_initialization(self): @no_wasm2js('wasm_bigint') def test_embind_i64_val(self): - self.set_setting('WASM_BIGINT') self.emcc_args += ['-lembind'] - self.node_args += shared.node_bigint_flags() self.do_run_in_out_file_test('embind/test_i64_val.cpp', assert_identical=True) @no_wasm2js('wasm_bigint') def test_embind_i64_binding(self): - self.set_setting('WASM_BIGINT') self.emcc_args += ['-lembind'] - self.node_args += shared.node_bigint_flags() self.do_run_in_out_file_test('embind/test_i64_binding.cpp', assert_identical=True) def test_embind_no_rtti(self): @@ -9832,8 +9825,7 @@ def setUp(self): settings={'MEMORY64': 1}, require_wasm64=True, require_v8=True) # MEMORY64=2, or "lowered" wasm64l = make_run('wasm64l', emcc_args=['-Wno-experimental', '--profiling-funcs'], - settings={'MEMORY64': 2}, - node_args=shared.node_bigint_flags()) + settings={'MEMORY64': 2}) lto0 = make_run('lto0', emcc_args=['-flto', '-O0']) lto1 = make_run('lto1', emcc_args=['-flto', '-O1']) @@ -9869,9 +9861,6 @@ def setUp(self): core2s = make_run('core2s', emcc_args=['-O2'], settings={'SAFE_HEAP': 1}) core2ss = make_run('core2ss', emcc_args=['-O2'], settings={'STACK_OVERFLOW_CHECK': 2}) -bigint = make_run('bigint', emcc_args=['--profiling-funcs'], settings={'WASM_BIGINT': 1}, - node_args=shared.node_bigint_flags()) - # Add DEFAULT_TO_CXX=0 strict = make_run('strict', emcc_args=[], settings={'STRICT': 1}) diff --git a/test/test_other.py b/test/test_other.py index 631762c85e930..46530bcbc7135 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -1988,14 +1988,12 @@ def test_dylink_pthread_warning(self): @node_pthreads def test_dylink_pthread_bigint_em_asm(self): self.set_setting('MAIN_MODULE', 2) - self.set_setting('WASM_BIGINT') self.emcc_args += ['-Wno-experimental', '-pthread'] self.do_runf(test_file('hello_world_em_asm.c'), 'hello, world') @node_pthreads def test_dylink_pthread_bigint_em_js(self): self.set_setting('MAIN_MODULE', 2) - self.set_setting('WASM_BIGINT') self.emcc_args += ['-Wno-experimental', '-pthread'] self.do_runf(test_file('core/test_em_js.cpp')) @@ -4486,20 +4484,14 @@ def guess_symbols_file_type(symbols_file): self.assertContained(UNMINIFIED_HEAP8, js) self.assertContained(UNMINIFIED_MIDDLE, js) - @parameterized({ - '': [[]], - # bigint support is interesting to test here because it changes which - # binaryen tools get run, which can affect how debug info is kept around - 'bigint': [['-sWASM_BIGINT']], - }) - def test_symbol_map_output_size(self, args): + def test_symbol_map_output_size(self): # build with and without a symbol map and verify that the sizes are the # same. using a symbol map should add the map on the side, but not increase # the build size. # -Oz is used here to run as many optimizations as possible, to check for # any difference in how the optimizer operates - self.run_process([EMCC, test_file('hello_world.c'), '-Oz', '-o', 'test1.js'] + args) - self.run_process([EMCC, test_file('hello_world.c'), '-Oz', '-o', 'test2.js', '--emit-symbol-map'] + args) + self.run_process([EMCC, test_file('hello_world.c'), '-Oz', '-o', 'test1.js']) + self.run_process([EMCC, test_file('hello_world.c'), '-Oz', '-o', 'test2.js', '--emit-symbol-map']) self.assertEqual(os.path.getsize('test1.js'), os.path.getsize('test2.js')) self.assertEqual(os.path.getsize('test1.wasm'), os.path.getsize('test2.wasm')) @@ -7259,7 +7251,6 @@ def test_i64_return_value(self, args, bind_js): ''') # Run the test and confirm the output is as expected. - self.node_args += shared.node_bigint_flags() out = self.run_js('testrun.js') self.assertContained('''\ input = 0xaabbccdd11223344 @@ -7399,14 +7390,8 @@ def test_memory_growth_noasm(self): assert 'use asm' not in src def test_EM_ASM_i64(self): - expected = 'Invalid character 106("j") in readEmAsmArgs!' - self.do_runf(test_file('other/test_em_asm_i64.cpp'), - expected_output=expected, - assert_returncode=NON_ZERO) - - self.set_setting('WASM_BIGINT') self.do_other_test('test_em_asm_i64.cpp') - self.do_other_test('test_em_asm_i64.cpp', force_c=True) + # self.do_other_test('test_em_asm_i64.cpp', force_c=True) def test_eval_ctor_ordering(self): # ensure order of execution remains correct, even with a bad ctor @@ -11189,19 +11174,18 @@ def ok(args, filename='hello_world.cpp', expected='hello, world!'): args += ['-sERROR_ON_WASM_CHANGES_AFTER_LINK'] self.do_runf(test_file(filename), expected, emcc_args=args) - # -O0 with BigInt support (to avoid the need for legalization) - required_flags = ['-sWASM_BIGINT'] - ok(required_flags) + # -O0 just works + ok([]) # Same with DWARF - ok(required_flags + ['-g']) + ok(['-g']) # Function pointer calls from JS work too - ok(required_flags, filename='hello_world_main_loop.cpp') + ok([], filename='hello_world_main_loop.cpp') # -O1 is ok as we don't run wasm-opt there (but no higher, see below) - ok(required_flags + ['-O1']) + ok(['-O1']) # Exception support shouldn't require changes after linking - ok(required_flags + ['-fexceptions']) + ok(['-fexceptions']) # Standalone mode should not do anything special to the wasm. - ok(required_flags + ['-sSTANDALONE_WASM']) + ok(['-sSTANDALONE_WASM']) # other builds fail with a standard message + extra details def fail(args, details): @@ -11211,13 +11195,10 @@ def fail(args, details): self.assertContained('changes to the wasm are required after link, but disallowed by ERROR_ON_WASM_CHANGES_AFTER_LINK', err) self.assertContained(details, err) - # plain -O0 - legalization_message = 'to disable int64 legalization (which requires changes after link) use -sWASM_BIGINT' - fail([], legalization_message) # optimized builds even without legalization optimization_message = '-O2+ optimizations always require changes, build with -O0 or -O1 instead' - fail(required_flags + ['-O2'], optimization_message) - fail(required_flags + ['-O3'], optimization_message) + fail(['-O2'], optimization_message) + fail(['-O3'], optimization_message) @crossplatform def test_output_to_nowhere(self): @@ -11540,7 +11521,6 @@ def test_standalone_export_main(self): @requires_wasm_eh def test_standalone_wasm_exceptions(self): self.set_setting('STANDALONE_WASM') - self.set_setting('WASM_BIGINT') self.wasm_engines = [] self.emcc_args += ['-fwasm-exceptions'] self.do_run_from_file(test_file('core/test_exceptions.cpp'), test_file('core/test_exceptions_caught.out')) @@ -11736,7 +11716,7 @@ def test_this_in_dyncall_memory64(self): @parameterized({ 'plain': [[]], 'asyncify': [['-sASYNCIFY']], - 'asyncify_bigint': [['-sASYNCIFY', '-sWASM_BIGINT']]}) + }) def test_closure_safe(self, args): self.run_process([EMCC, test_file('hello_world.c'), '--closure=1'] + args) @@ -11832,7 +11812,7 @@ def test_split_module(self, customLoader, jspi): wasm_split = os.path.join(building.get_binaryen_bin(), 'wasm-split') wasm_split_run = [wasm_split, '-g', '--enable-mutable-globals', '--export-prefix=%', 'test_split_module.wasm.orig', '-o1', 'primary.wasm', '-o2', 'secondary.wasm', '--profile=profile.data'] if jspi: - wasm_split_run += ['--jspi', '--enable-reference-types'] + wasm_split_run += ['--jspi', '--enable-reference-types', '--enable-bulk-memory'] self.run_process(wasm_split_run) os.remove('test_split_module.wasm') @@ -12576,8 +12556,6 @@ def test_wasmfs_readfile(self): @wasmfs_all_backends def test_wasmfs_readfile_bigint(self): self.set_setting('FORCE_FILESYSTEM') - self.set_setting('WASM_BIGINT') - self.node_args += shared.node_bigint_flags() self.do_run_in_out_file_test(test_file('wasmfs/wasmfs_readfile.c')) def test_wasmfs_jsfile(self): @@ -13146,7 +13124,7 @@ def test_reproduce(self): def test_min_browser_version(self): err = self.expect_fail([EMCC, test_file('hello_world.c'), '-Werror', '-sWASM_BIGINT', '-sMIN_SAFARI_VERSION=120000']) - self.assertContained('emcc: error: MIN_SAFARI_VERSION=120000 is not compatible with WASM_BIGINT (150000 or above required)', err) + self.assertContained('emcc: error: MIN_SAFARI_VERSION=120000 is not compatible with WASM_BIGINT (140100 or above required)', err) err = self.expect_fail([EMCC, test_file('hello_world.c'), '-Werror', '-pthread', '-sMIN_CHROME_VERSION=73']) self.assertContained('emcc: error: MIN_CHROME_VERSION=73 is not compatible with pthreads (74 or above required)', err) @@ -13255,10 +13233,20 @@ def test_parseTools_legacy(self): def test_min_node_version(self): node_version = shared.check_node_version() node_version = '.'.join(str(x) for x in node_version) - self.set_setting('MIN_NODE_VERSION', 210000) + # use self.emcc_args so that we append this to the very end (using + # self.set_setting would cause it to be at the start, and overridden by + # the test runner's own changes to self.emcc_args, if it sets a node version + # as well). + self.emcc_args += ['-sMIN_NODE_VERSION=210000'] expected = 'This emscripten-generated code requires node v21.0.0 (detected v%s' % node_version self.do_runf(test_file('hello_world.c'), expected, assert_returncode=NON_ZERO) + def test_min_node_version_bigint(self): + err = self.expect_fail([EMCC, test_file('hello_world.c'), '-Werror', '-sWASM_BIGINT', '-sMIN_NODE_VERSION=149999']) + self.assertContained('emcc: error: MIN_NODE_VERSION=149999 is not compatible with WASM_BIGINT (150000 or above required)', err) + + self.run_process([EMCC, test_file('hello_world.c'), '-Werror', '-sWASM_BIGINT', '-sMIN_NODE_VERSION=150000']) + def test_deprecated_macros(self): create_file('main.c', ''' #include @@ -13311,7 +13299,6 @@ def test_missing_struct_info(self): def run_wasi_test_suite_test(self, name): if not os.path.exists(path_from_root('test/third_party/wasi-test-suite')): self.fail('wasi-testsuite not found; run `git submodule update --init`') - self.node_args += shared.node_bigint_flags() wasm = path_from_root('test', 'third_party', 'wasi-test-suite', name + '.wasm') with open(path_from_root('test', 'third_party', 'wasi-test-suite', name + '.json')) as f: config = json.load(f) diff --git a/tools/feature_matrix.py b/tools/feature_matrix.py index 7aebf78c53081..8701edb284790 100644 --- a/tools/feature_matrix.py +++ b/tools/feature_matrix.py @@ -51,7 +51,12 @@ class Feature(IntEnum): Feature.JS_BIGINT_INTEGRATION: { 'chrome': 67, 'firefox': 68, + # Note: Safari 14.1 is enough for wasm-bigint by itself (not that that + # shipped only in iOS 14.5, not 14.1, which can be confusing) - but it is + # not enough for us as we use BigInt64Array in that mode, and that only + # shipped in 15.0, so mark this feature as depending on that version. 'safari': 150000, + 'node': 150000, }, Feature.THREADS: { 'chrome': 74, @@ -81,27 +86,31 @@ def report_missing(setting_name): setting_value = getattr(settings, setting_name) logger.debug(f'cannot use {feature.name} because {setting_name} is too old: {setting_value}') - if settings.MIN_CHROME_VERSION < min_versions['chrome']: - report_missing('MIN_CHROME_VERSION') - return False - # For edge we just use the same version requirements as chrome since, - # at least for modern versions of edge, they share version numbers. - if settings.MIN_EDGE_VERSION < min_versions['chrome']: - report_missing('MIN_EDGE_VERSION') - return False - if settings.MIN_FIREFOX_VERSION < min_versions['firefox']: - report_missing('MIN_FIREFOX_VERSION') - return False - if settings.MIN_SAFARI_VERSION < min_versions['safari']: - report_missing('MIN_SAFARI_VERSION') - return False - # IE don't support any non-MVP features - if settings.MIN_IE_VERSION != 0x7FFFFFFF: - report_missing('MIN_IE_VERSION') - return False - if 'node' in min_versions and settings.MIN_NODE_VERSION < min_versions['node']: - report_missing('MIN_NODE_VERSION') - return False + if settings.ENVIRONMENT_MAY_BE_WEB or settings.ENVIRONMENT_MAY_BE_WORKER: + if settings.MIN_CHROME_VERSION < min_versions['chrome']: + report_missing('MIN_CHROME_VERSION') + return False + # For edge we just use the same version requirements as chrome since, + # at least for modern versions of edge, they share version numbers. + if settings.MIN_EDGE_VERSION < min_versions['chrome']: + report_missing('MIN_EDGE_VERSION') + return False + if settings.MIN_FIREFOX_VERSION < min_versions['firefox']: + report_missing('MIN_FIREFOX_VERSION') + return False + if settings.MIN_SAFARI_VERSION < min_versions['safari']: + report_missing('MIN_SAFARI_VERSION') + return False + # IE don't support any non-MVP features + if settings.MIN_IE_VERSION != 0x7FFFFFFF: + report_missing('MIN_IE_VERSION') + return False + + if settings.ENVIRONMENT_MAY_BE_NODE: + if 'node' in min_versions and settings.MIN_NODE_VERSION < min_versions['node']: + report_missing('MIN_NODE_VERSION') + return False + return True