Skip to content

Fix wasm worker tests in high memory modes #21319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ jobs:
browser_2gb.test_webgl2_*
browser_2gb.test_webgl_*
browser_2gb.test_sdl_image
browser_2gb.test_wasm_worker*
"
test-browser-chrome-wasm64-4gb:
executor: bionic
Expand All @@ -839,6 +840,7 @@ jobs:
browser64_4gb.test_fulles2_sdlproc
browser64_4gb.test_html5_webgl_create_context*
browser64_4gb.test_sdl_image
browser64_4gb.test_wasm_worker*
"
test-browser-firefox:
executor: bionic
Expand Down
8 changes: 4 additions & 4 deletions src/library_wasm_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ if (ENVIRONMENT_IS_WASM_WORKER) {
};
let tryAcquireLock = () => {
do {
var val = Atomics.compareExchange(HEAP32, lock >> 2, 0/*zero represents lock being free*/, 1/*one represents lock being acquired*/);
var val = Atomics.compareExchange(HEAP32, {{{ getHeapOffset('lock', 'i32') }}}, 0/*zero represents lock being free*/, 1/*one represents lock being acquired*/);
if (!val) return dispatch(0, 0/*'ok'*/);
var wait = Atomics.waitAsync(HEAP32, lock >> 2, val, maxWaitMilliseconds);
var wait = Atomics.waitAsync(HEAP32, {{{ getHeapOffset('lock', 'i32') }}}, val, maxWaitMilliseconds);
} while (wait.value === 'not-equal');
#if ASSERTIONS
assert(wait.async || wait.value === 'timed-out');
Expand All @@ -301,12 +301,12 @@ if (ENVIRONMENT_IS_WASM_WORKER) {
let tryAcquireSemaphore = () => {
let val = num;
do {
let ret = Atomics.compareExchange(HEAP32, sem >> 2,
let ret = Atomics.compareExchange(HEAP32, {{{ getHeapOffset('sem', 'i32') }}},
val, /* We expect this many semaphore resoures to be available*/
val - num /* Acquire 'num' of them */);
if (ret == val) return dispatch(ret/*index of resource acquired*/, 0/*'ok'*/);
val = ret;
let wait = Atomics.waitAsync(HEAP32, sem >> 2, ret, maxWaitMilliseconds);
let wait = Atomics.waitAsync(HEAP32, {{{ getHeapOffset('sem', 'i32') }}}, ret, maxWaitMilliseconds);
} while (wait.value === 'not-equal');
#if ASSERTIONS
assert(wait.async || wait.value === 'timed-out');
Expand Down
2 changes: 2 additions & 0 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ def setUp(self):
def require_wasm2js(self):
if self.is_wasm64():
self.skipTest('wasm2js is not compatible with MEMORY64')
if self.is_2gb() or self.is_4gb():
self.skipTest('wasm2js does not support over 2gb of memory')

def require_jspi(self):
if not is_chrome():
Expand Down