Skip to content

Commit 7d78ad8

Browse files
authored
Remove table64 lowering (#22452)
This requires an update the version of node canary that use for testing.
1 parent 57f2e30 commit 7d78ad8

File tree

7 files changed

+61
-26
lines changed

7 files changed

+61
-26
lines changed

.circleci/config.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ commands:
106106
description: "install canary version of node"
107107
steps:
108108
- install-node-version:
109-
node_version: "22.0.0-v8-canary20240423a2eb2005bd"
109+
node_version: "23.0.0-v8-canary20240819f52f1c2f1c"
110110
canary: true
111111
install-v8:
112112
description: "install v8 using jsvu"
@@ -625,6 +625,12 @@ jobs:
625625
- run: rm -rf $HOME/.jsvu
626626
- install-v8
627627
- install-node-canary
628+
# When running wasm64 tests we need to make sure we use the testing
629+
# version of node (node canary) when running the compiler output (e.g.
630+
# in configure tests.
631+
- run:
632+
name: configure node canary
633+
command: echo "NODE_JS = NODE_JS_TEST" >> ~/emsdk/.emscripten
628634
- run-tests:
629635
title: "wasm64"
630636
test_targets: "
@@ -651,6 +657,12 @@ jobs:
651657
- run: rm -rf $HOME/.jsvu
652658
- install-v8
653659
- install-node-canary
660+
# When running wasm64 tests we need to make sure we use the testing
661+
# version of node (node canary) when running the compiler output (e.g.
662+
# in configure tests.
663+
- run:
664+
name: configure node canary
665+
command: echo "NODE_JS = NODE_JS_TEST" >> ~/emsdk/.emscripten
654666
- run-tests:
655667
title: "wasm64_4gb"
656668
test_targets: "wasm64_4gb"
@@ -772,6 +784,7 @@ jobs:
772784
executor: bionic
773785
environment:
774786
EMTEST_SKIP_NODE_CANARY: "1"
787+
EMTEST_SKIP_WASM64: "1"
775788
steps:
776789
- run: apt-get install -q -y ninja-build scons
777790
- run-tests-linux:
@@ -796,7 +809,14 @@ jobs:
796809
steps:
797810
- run-tests-chrome:
798811
title: "browser64"
799-
test_targets: "browser64"
812+
# Skip tests that depend on running the output in node
813+
# (This bot doesn't have node canary installed which is required to
814+
# run wasm64 output).
815+
test_targets: "browser64
816+
skip:browser64.test_worker
817+
skip:browser64.test_2gb_fail
818+
skip:browser64.test_4gb_fail
819+
skip:browser64.test_4gb"
800820
test-browser-chrome-2gb:
801821
executor: bionic
802822
environment:
@@ -828,7 +848,15 @@ jobs:
828848
# browser.test_webgl_offscreen_canvas_in_mainthread_after_pthread
829849
# are crashing Firefox (bugzil.la/1281796). The former case is
830850
# further blocked by issue #6897.
831-
test_targets: "browser skip:browser.test_sdl2_mouse skip:browser.test_html5_webgl_create_context skip:browser.test_webgl_offscreen_canvas_in_pthread skip:browser.test_webgl_offscreen_canvas_in_mainthread_after_pthread skip:browser.test_glut_glutget"
851+
test_targets: "
852+
browser64.test_sdl_image
853+
browser
854+
skip:browser.test_sdl2_mouse
855+
skip:browser.test_html5_webgl_create_context
856+
skip:browser.test_webgl_offscreen_canvas_in_pthread
857+
skip:browser.test_webgl_offscreen_canvas_in_mainthread_after_pthread
858+
skip:browser.test_glut_glutget
859+
"
832860
# TODO(sbc): Re-enable once we figure out why the emrun tests are
833861
# locking up.
834862
#test-browser-chrome-emrun:

src/library.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2394,6 +2394,9 @@ addToLibrary({
23942394
'initial': {{{ INITIAL_TABLE }}},
23952395
#if !ALLOW_TABLE_GROWTH
23962396
'maximum': {{{ INITIAL_TABLE }}},
2397+
#endif
2398+
#if MEMORY64 == 1
2399+
'index': 'i64',
23972400
#endif
23982401
'element': 'anyfunc'
23992402
});

test/common.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -872,8 +872,8 @@ def node_is_canary(self, nodejs):
872872
def require_node_canary(self):
873873
nodejs = self.get_nodejs()
874874
if self.node_is_canary(nodejs):
875-
self.require_engine(nodejs)
876-
return
875+
self.require_engine(nodejs)
876+
return
877877

878878
if 'EMTEST_SKIP_NODE_CANARY' in os.environ:
879879
self.skipTest('test requires node canary and EMTEST_SKIP_NODE_CANARY is set')
@@ -889,10 +889,13 @@ def require_engine(self, engine):
889889
self.wasm_engines = []
890890

891891
def require_wasm64(self):
892+
if self.is_browser_test():
893+
return
894+
892895
nodejs = self.get_nodejs()
893896
if nodejs:
894897
version = shared.get_node_version(nodejs)
895-
if version >= (16, 0, 0):
898+
if version >= (23, 0, 0):
896899
self.js_engines = [nodejs]
897900
self.node_args += shared.node_memory64_flags()
898901
return
@@ -904,11 +907,14 @@ def require_wasm64(self):
904907
return
905908

906909
if 'EMTEST_SKIP_WASM64' in os.environ:
907-
self.skipTest('test requires node >= 16 or d8 (and EMTEST_SKIP_WASM64 is set)')
910+
self.skipTest('test requires node >= 23 or d8 (and EMTEST_SKIP_WASM64 is set)')
908911
else:
909-
self.fail('either d8 or node >= 16 required to run wasm64 tests. Use EMTEST_SKIP_WASM64 to skip')
912+
self.fail('either d8 or node >= 23 required to run wasm64 tests. Use EMTEST_SKIP_WASM64 to skip')
910913

911914
def require_simd(self):
915+
if self.is_browser_test():
916+
return
917+
912918
nodejs = self.get_nodejs()
913919
if nodejs:
914920
version = shared.get_node_version(nodejs)

test/embind/imvu_test_adapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ function module(ignore, func) {
553553
}
554554

555555
(function() {
556-
var g = 'undefined' === typeof window ? global : window;
556+
var g = 'undefined' === typeof window ? globalThis : window;
557557

558558
// synonyms
559559
assert.equals = assert.equal;

test/test_other.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3471,6 +3471,7 @@ def test_embind_tsgen_bigint(self):
34713471
self.run_process(args + ['-sWASM_BIGINT'])
34723472
self.assertFileContents(test_file('other/embind_tsgen_bigint.d.ts'), read_file('embind_tsgen_bigint.d.ts'))
34733473

3474+
@requires_wasm64
34743475
def test_embind_tsgen_memory64(self):
34753476
# Check that when memory64 is enabled longs & unsigned longs are mapped to bigint in the generated TS bindings
34763477
self.run_process([EMXX, test_file('other/embind_tsgen_memory64.cpp'),

tools/feature_matrix.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Feature(IntEnum):
3535
THREADS = auto()
3636
GLOBALTHIS = auto()
3737
PROMISE_ANY = auto()
38+
MEMORY64 = auto()
3839

3940

4041
default_features = {Feature.SIGN_EXT, Feature.MUTABLE_GLOBALS}
@@ -82,6 +83,12 @@ class Feature(IntEnum):
8283
'safari': 140000,
8384
'node': 150000,
8485
},
86+
Feature.MEMORY64: {
87+
'chrome': 128,
88+
'firefox': 129,
89+
'safari': UNSUPPORTED,
90+
'node': 230000,
91+
},
8592
}
8693

8794

@@ -136,3 +143,5 @@ def apply_min_browser_versions():
136143
enable_feature(Feature.BULK_MEMORY, 'pthreads')
137144
if settings.AUDIO_WORKLET:
138145
enable_feature(Feature.GLOBALTHIS, 'AUDIO_WORKLET')
146+
if settings.MEMORY64 == 1:
147+
enable_feature(Feature.MEMORY64, 'MEMORY64')

tools/link.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,7 @@ def check_human_readable_list(items):
393393
passes += ['--pass-arg=asyncify-onlylist@%s' % ','.join(settings.ASYNCIFY_ONLY)]
394394

395395
if settings.MEMORY64 == 2:
396-
passes += ['--memory64-lowering']
397-
398-
if settings.MEMORY64:
399-
passes += ['--table64-lowering']
396+
passes += ['--memory64-lowering', '--table64-lowering']
400397

401398
if settings.BINARYEN_IGNORE_IMPLICIT_TRAPS:
402399
passes += ['--ignore-implicit-traps']
@@ -1368,17 +1365,6 @@ def phase_linker_setup(options, state, newargs):
13681365
settings.SUPPORTS_PROMISE_ANY = feature_matrix.caniuse(feature_matrix.Feature.PROMISE_ANY)
13691366
if not settings.BULK_MEMORY:
13701367
settings.BULK_MEMORY = feature_matrix.caniuse(feature_matrix.Feature.BULK_MEMORY)
1371-
if settings.BULK_MEMORY and settings.MEMORY64 and settings.MIN_NODE_VERSION < 180000:
1372-
# Note that we do not update tools/feature_matrix.py for this, as this issue is
1373-
# wasm64-specific: bulk memory for wasm32 has shipped in Node.js 12.5, but
1374-
# bulk memory for wasm64 has shipped only in Node.js 18.
1375-
#
1376-
# Feature matrix currently cannot express such complex combinations of
1377-
# features, so the only options are to either choose the least common
1378-
# denominator and disable bulk memory altogether for Node.js < 18 or to
1379-
# special-case this situation here. The former would be limiting for
1380-
# wasm32 users, so instead we do the latter:
1381-
settings.BULK_MEMORY = 0
13821368

13831369
if settings.AUDIO_WORKLET:
13841370
if settings.AUDIO_WORKLET == 1:
@@ -1977,9 +1963,11 @@ def run_embind_gen(wasm_target, js_syms, extra_settings, linker_inputs):
19771963
# Replace embind with the TypeScript generation version.
19781964
embind_index = settings.JS_LIBRARIES.index('embind/embind.js')
19791965
settings.JS_LIBRARIES[embind_index] = 'embind/embind_gen.js'
1980-
outfile_js = in_temp('tsgen_a.out.js')
1966+
if settings.MEMORY64:
1967+
settings.MIN_NODE_VERSION = 160000
1968+
outfile_js = in_temp('tsgen.js')
19811969
# The Wasm outfile may be modified by emscripten.emscript, so use a temporary file.
1982-
outfile_wasm = in_temp('tsgen_a.out.wasm')
1970+
outfile_wasm = in_temp('tsgen.wasm')
19831971
emscripten.emscript(wasm_target, outfile_wasm, outfile_js, js_syms, finalize=False)
19841972
# Build the flags needed by Node.js to properly run the output file.
19851973
node_args = []

0 commit comments

Comments
 (0)