diff --git a/.circleci/config.yml b/.circleci/config.yml index 182fcca57c3dc..38ec282e23239 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -109,7 +109,7 @@ commands: description: "install canary version of node" steps: - install-node-version: - node_version: "20.0.0-v8-canary2023041819be670741" + node_version: "21.0.0-v8-canary20230822f5e30d0702" canary: true install-v8: description: "install v8 using jsvu" diff --git a/src/library_pthread.js b/src/library_pthread.js index 7107398050d38..f4ca6c7ac71d7 100644 --- a/src/library_pthread.js +++ b/src/library_pthread.js @@ -1042,8 +1042,8 @@ var LibraryPThread = { $establishStackSpace__internal: true, $establishStackSpace: () => { var pthread_ptr = _pthread_self(); - var stackHigh = {{{ makeGetValue('pthread_ptr', C_STRUCTS.pthread.stack, 'i32') }}}; - var stackSize = {{{ makeGetValue('pthread_ptr', C_STRUCTS.pthread.stack_size, 'i32') }}}; + var stackHigh = {{{ makeGetValue('pthread_ptr', C_STRUCTS.pthread.stack, '*') }}}; + var stackSize = {{{ makeGetValue('pthread_ptr', C_STRUCTS.pthread.stack_size, '*') }}}; var stackLow = stackHigh - stackSize; #if PTHREADS_DEBUG dbg(`establishStackSpace: ${ptrToString(stackHigh)} -> ${ptrToString(stackLow)}`); diff --git a/src/library_wasm_worker.js b/src/library_wasm_worker.js index db6fe14c54b9e..d1feb29d43d81 100644 --- a/src/library_wasm_worker.js +++ b/src/library_wasm_worker.js @@ -244,7 +244,7 @@ if (ENVIRONMENT_IS_WASM_WORKER) { // https://github.com/tc39/proposal-atomics-wait-async/blob/master/PROPOSAL.md // This polyfill performs polling with setTimeout() to observe a change in the // target memory location. - emscripten_atomic_wait_async__postset: `if (!Atomics.waitAsync || (typeof navigator !== 'undefined' && jstoi_q((navigator.userAgent.match(/Chrom(e|ium)\\/([0-9]+)\\./)||[])[2]) < 91)) { + emscripten_atomic_wait_async__postset: `if (!Atomics.waitAsync || (typeof navigator !== 'undefined' && navigator.userAgent && jstoi_q((navigator.userAgent.match(/Chrom(e|ium)\\/([0-9]+)\\./)||[])[2]) < 91)) { let __Atomics_waitAsyncAddresses = [/*[i32a, index, value, maxWaitMilliseconds, promiseResolve]*/]; function __Atomics_pollWaitAsyncAddresses() { let now = performance.now(); diff --git a/src/runtime_init_memory.js b/src/runtime_init_memory.js index a22027493755c..15e5324bd26cd 100644 --- a/src/runtime_init_memory.js +++ b/src/runtime_init_memory.js @@ -35,13 +35,15 @@ if (ENVIRONMENT_IS_PTHREAD) { // https://github.com/emscripten-core/emscripten/issues/14130 // And in the pthreads case we definitely need to emit a maximum. So // always emit one. - 'maximum': {{{ MAXIMUM_MEMORY }}} / {{{ WASM_PAGE_SIZE }}} + 'maximum': {{{ MAXIMUM_MEMORY }}} / {{{ WASM_PAGE_SIZE }}}, #else - 'maximum': INITIAL_MEMORY / {{{ WASM_PAGE_SIZE }}} + 'maximum': INITIAL_MEMORY / {{{ WASM_PAGE_SIZE }}}, #endif // ALLOW_MEMORY_GROWTH #if SHARED_MEMORY - , - 'shared': true + 'shared': true, +#endif +#if MEMORY64 == 1 + 'index': 'u64', #endif }); #if SHARED_MEMORY diff --git a/test/common.py b/test/common.py index 8d019f4c29c14..6b461dc9e09a6 100644 --- a/test/common.py +++ b/test/common.py @@ -713,10 +713,6 @@ def setup_node_pthreads(self): self.emcc_args += ['-Wno-pthreads-mem-growth', '-pthread'] if self.get_setting('MINIMAL_RUNTIME'): self.skipTest('node pthreads not yet supported with MINIMAL_RUNTIME') - # Pthread support requires IMPORTED_MEMORY which depends on the JS API - # for creating 64-bit memories. - if self.get_setting('GLOBAL_BASE') == '4gb': - self.skipTest('no support for IMPORTED_MEMORY over 4gb yet') self.js_engines = [config.NODE_JS] self.node_args += shared.node_pthread_flags() diff --git a/test/pthread/test_pthread_attr_getstack.c b/test/pthread/test_pthread_attr_getstack.c index 166baa9e3b8bb..356383c872a16 100644 --- a/test/pthread/test_pthread_attr_getstack.c +++ b/test/pthread/test_pthread_attr_getstack.c @@ -18,7 +18,6 @@ void TestStack() { void *stbase; size_t stsize; char dummy; - intptr_t result; rc = pthread_attr_init(&attr); assert(rc == 0); diff --git a/test/pthread/test_pthread_proxying_canceled_work.c b/test/pthread/test_pthread_proxying_canceled_work.c index df8067e474a68..769f7c00696fe 100644 --- a/test/pthread/test_pthread_proxying_canceled_work.c +++ b/test/pthread/test_pthread_proxying_canceled_work.c @@ -39,7 +39,7 @@ void set_flag(void* flag) { // because this code needs to run after the thread runtime has exited. // clang-format off - EM_ASM({setTimeout(() => Atomics.store(HEAP32, $0 >>> 2, 1))}, flag); + EM_ASM({setTimeout(() => Atomics.store(HEAP32, $0 / 4, 1))}, flag); // clang-format on } diff --git a/test/test_core.py b/test/test_core.py index 76ca2d5fcfc7b..df84c888f1527 100644 --- a/test/test_core.py +++ b/test/test_core.py @@ -8489,7 +8489,6 @@ def test_pthread_join_and_asyncify(self): 'conditional': (True,), 'unconditional': (False,), }) - @no_4gb('uses imported memory') def test_emscripten_lazy_load_code(self, conditional): if self.get_setting('STACK_OVERFLOW_CHECK'): self.skipTest('https://github.com/emscripten-core/emscripten/issues/16828')