Skip to content

[immutable-arraybuffer] Atomics#4554

Merged
gibson042 merged 5 commits into
tc39:mainfrom
gibson042:2025-07-immutable-arraybuffer-atomics
May 15, 2026
Merged

[immutable-arraybuffer] Atomics#4554
gibson042 merged 5 commits into
tc39:mainfrom
gibson042:2025-07-immutable-arraybuffer-atomics

Conversation

@gibson042

@gibson042 gibson042 commented Aug 1, 2025

Copy link
Copy Markdown
Member

Ref #4509

Atomics

  • Atomics.{add,and,compareExchange,exchange,or,store,sub,xor}

    • throws a TypeError if typedArray is an immutable ArrayBuffer, before coercing index
  • Atomics.load

    • works as expected if typedArray is an immutable ArrayBuffer
  • Atomics.notify

    • works as expected if typedArray is an immutable ArrayBuffer, returning 0 when index is in range and coercing count is successful

@gibson042
gibson042 requested a review from a team as a code owner August 1, 2025 06:42
@gibson042
gibson042 force-pushed the 2025-07-immutable-arraybuffer-atomics branch from 8e83a8d to 28a2175 Compare February 22, 2026 20:42
@gibson042
gibson042 force-pushed the 2025-07-immutable-arraybuffer-atomics branch from 28a2175 to 54c439c Compare May 8, 2026 15:03
@gibson042
gibson042 requested a review from ptomato May 8, 2026 15:30

@ptomato ptomato left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All comments/questions are nonblocking.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is actually the difference between this file and non-shared-int-views-throws.js in what's being tested? They seem identical except for the value being exchanged. Could one of them just be deleted?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent observation! Done.

assert.throws(TypeError, function() {
Atomics.and(view, 0, 1);
}, `Atomics.and(new ${TA.name}(buffer), 0, 1) throws TypeError`);
}, ["arraybuffer"], ["immutable"]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm reading this correctly, "immutable" is being removed from the exclude list, so this test will now run on immutable buffers as well. But all new coverage in this file is also already covered in and/immutable-buffer.js, because that runs on all typed array constructors. I don't know if that's actually a problem; probably not.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there probably is room for such consolidation, but out of scope here, and the focus is sufficiently different that I would want to see it in a dedicated sweep.

@gibson042
gibson042 force-pushed the 2025-07-immutable-arraybuffer-atomics branch from 36b4346 to e0848a8 Compare May 15, 2026 03:53
@gibson042
gibson042 merged commit 82d7772 into tc39:main May 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants