Re: [whatwg/webidl] Fix `BufferSource` algorithms for shared and resizable buffers (PR #1529)

syg left a comment (whatwg/webidl#1529)

> When dealing with views backed by a SharedArrayBuffer, what memory ordering should we use? ECMAScript seems to use SEQ-CST pretty much everywhere (e.g. [%TypedArray%.prototype.byteLength](https://tc39.es/ecma262/multipage/indexed-collections.html#sec-get-%typedarray%.prototype.bytelength)), but ["get a copy of the bytes"](https://webidl.spec.whatwg.org/#dfn-get-buffer-source-copy) uses UNORDERED for GetValueFromBuffer.

The rules of thumb here are:
- Explicit accesses of the length, like via `.length`, or a particular builtin reading the length, of a growable SAB are seq-cst (intended to be synchronizing)
- Implicit accesses of the length for the sake of bounds checking are unordered (intended to be fast)
- Access of SAB (growable or otherwise) contents themselves are unordered (intended to be fast)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1529#issuecomment-3757018345
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/pull/1529/c3757018345@github.com>

Received on Thursday, 15 January 2026 21:44:19 UTC