Skip to content

Commit

Permalink
Fix wasm worker tests in high memory modes (#21319)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 authored Feb 12, 2024
1 parent 57ba793 commit 1bde14c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
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

0 comments on commit 1bde14c

Please sign in to comment.