Skip to content

Commit 309b999

Browse files
authored
Remove node_pthread_flags used for node older that v16 (#26560)
This function was used to try to allows pthread code run on version of node older than v16. It was used almost exclusively in test code. The only place is used in the compiler itself is `emcmake` where it we added these flags to node when used in `-DCMAKE_CROSSCOMPILING_EMULATOR`. I don't think this is worth it anymore since v16 is so old. The oldest support node TLS is v20 these days.
1 parent 1cd8151 commit 309b999

6 files changed

Lines changed: 6 additions & 21 deletions

File tree

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ See docs/process.md for more on how version tagging works.
2323
- C++ exceptions are now always thrown as CppException objects rather than raw
2424
pointers/numbers. However, the `.message` and `.stack` fields of the thrown
2525
object will only be populated if `-sEXCEPTION_STACK_TRACES` is set. (#26523)
26+
- `emcmake` no longer automatically injects `--experimental-wasm-threads` nodejs
27+
flags when used with versions of node older than v16. (#26560)
2628

2729
5.0.4 - 03/23/26
2830
----------------

emcmake.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@ def has_substr(args, substr):
3535
args.append('-DCMAKE_TOOLCHAIN_FILE=' + utils.path_from_root('cmake/Modules/Platform/Emscripten.cmake'))
3636

3737
if not has_substr(args, '-DCMAKE_CROSSCOMPILING_EMULATOR'):
38-
node_js = [config.NODE_JS[0]]
39-
# In order to allow cmake to run code built with pthreads we need to pass
40-
# some extra flags to node.
41-
node_js += shared.node_pthread_flags(config.NODE_JS)
42-
node_js = ';'.join(node_js)
38+
node_js = config.NODE_JS[0]
4339
# See https://github.com/emscripten-core/emscripten/issues/15522
4440
args.append(f'-DCMAKE_CROSSCOMPILING_EMULATOR={node_js}')
4541

test/browser_common.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
test_file,
3535
)
3636

37-
from tools import feature_matrix, shared, utils
37+
from tools import feature_matrix, utils
3838
from tools.feature_matrix import UNSUPPORTED
3939
from tools.shared import DEBUG, EMCC, exit_with_error
4040
from tools.utils import MACOS, WINDOWS, memoize, path_from_root, read_binary
@@ -929,8 +929,6 @@ def btest(self, filename, expected=None,
929929
if not isinstance(expected, list):
930930
expected = [expected]
931931
if EMTEST_BROWSER == 'node':
932-
nodejs = self.require_node()
933-
self.node_args += shared.node_pthread_flags(nodejs)
934932
output = self.run_js(f'{output_basename}.js')
935933
self.assertContained('RESULT: ' + expected[0], output)
936934
else:

test/common.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,8 @@ def require_pthreads(self):
457457
self.skipTest('non-browser pthreads not yet supported with MINIMAL_RUNTIME')
458458
for engine in self.js_engines:
459459
if engine_is_node(engine):
460-
self.require_node()
461-
nodejs = get_nodejs()
462-
self.node_args += shared.node_pthread_flags(nodejs)
460+
if not self.try_require_node_version(16, 0, 0):
461+
self.fail('node v16 required to run this test')
463462
return
464463
elif engine_is_bun(engine) or engine_is_deno(engine):
465464
self.require_engine(engine)

test/test_other.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13540,7 +13540,6 @@ def test_fetch_settings(self):
1354013540
@also_with_minimal_runtime
1354113541
def test_shared_memory(self):
1354213542
self.do_runf('wasm_worker/shared_memory.c', '0', cflags=[])
13543-
self.node_args += shared.node_pthread_flags(get_nodejs())
1354413543
self.do_runf('wasm_worker/shared_memory.c', '1', cflags=['-sSHARED_MEMORY'])
1354513544
self.do_runf('wasm_worker/shared_memory.c', '1', cflags=['-sWASM_WORKERS'])
1354613545
self.do_runf('wasm_worker/shared_memory.c', '1', cflags=['-pthread'])

tools/shared.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,6 @@ def node_exception_flags(nodejs):
326326
return []
327327

328328

329-
def node_pthread_flags(nodejs):
330-
node_version = get_node_version(nodejs)
331-
# bulk memory and wasm threads were enabled by default in node v16.
332-
if node_version and node_version < (16, 0, 0):
333-
return ['--experimental-wasm-bulk-memory', '--experimental-wasm-threads']
334-
else:
335-
return []
336-
337-
338329
@memoize
339330
@ToolchainProfiler.profile()
340331
def check_node():

0 commit comments

Comments
 (0)