Skip to content

Commit c8ccd4b

Browse files
authored
Disable bulk memory on wasm64 for older Node.js (#20562)
1 parent eefceb7 commit c8ccd4b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

emcc.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,6 +2517,21 @@ def phase_linker_setup(options, state, newargs):
25172517
settings.SUPPORTS_PROMISE_ANY = feature_matrix.caniuse(feature_matrix.Feature.PROMISE_ANY)
25182518
if not settings.BULK_MEMORY:
25192519
settings.BULK_MEMORY = feature_matrix.caniuse(feature_matrix.Feature.BULK_MEMORY)
2520+
if settings.MEMORY64 and settings.MIN_NODE_VERSION < 180000:
2521+
# Note that we do not update tools/feature_matrix.py for this, as this issue is
2522+
# wasm64-specific: bulk memory for wasm32 has shipped in Node.js 12.5, but
2523+
# bulk memory for wasm64 has shipped only in Node.js 18.
2524+
#
2525+
# Feature matrix currently cannot express such complex combinations of
2526+
# features, so the only options are to either choose the least common
2527+
# denominator and disable bulk memory altogether for Node.js < 18 or to
2528+
# special-case this situation here. The former would be limiting for
2529+
# wasm32 users, so instead we do the latter:
2530+
logger.warning(
2531+
"Disabling bulk memory because it doesn't work correctly with wasm64 in Node.js < 18.\n"
2532+
"Set MIN_NODE_VERSION to 180000 or above to enable it."
2533+
)
2534+
settings.BULK_MEMORY = 0
25202535

25212536
if settings.AUDIO_WORKLET:
25222537
if settings.AUDIO_WORKLET == 1:

0 commit comments

Comments
 (0)