Closed
Bug 1122467
Opened 10 years ago
Closed 9 years ago
SAB: What happens when a TypedArray constructor is presented with a SharedArrayBuffer or SharedTypedArray?
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: lth, Assigned: lth)
References
(Blocks 1 open bug)
Details
(Also see bug 1122338.) (Also see bug 1084248; the current shared code probably complicates things.) When a TypedArray constructor is presented with a SharedArrayBuffer or SharedTypedArray it treats the input as the generic "Array-like" case and constructs a new non-shared ArrayBuffer and then copies elements from 0..length-1 from the argument object to that ArrayBuffer. (For SharedArrayBuffer the length will normally be zero since there is no "length" property.) The opposite case, presenting a SharedTypedArray constructor with an ArrayBuffer or TypedArray, will result in an error being thrown. This bug has two parts: (1) figure out what the most desirable behavior is and (2) write code and test cases to implement that.
Assignee | ||
Comment 1•10 years ago
|
||
The SharedTypedArray code only allows for two general cases, new SharedInt32Array([length]) new SharedInt32Array(SharedArrayBuffer, [offset, [length]]) Specifically it disallows the copy-from-random-object semantics of the TypedArray constructors, since that is thought to be of low utility and almost certainly not what is wanted. As noted in comment #0, the TypedArray code allows the object in the second case above to be any Array-like object, even defaulting object.length to zero if it is not present. There's probably a reasonable case to be made for the object argument to a TypedArray constructor to be a SharedTypedArray object, with the meaning that shared data is being copied into private data, and that copying works now. (There's the question of how that copy is done: if done byte-by-byte, say, the copy may experience word tearing if there are concurrent updates to the shared memory, and that would be wrong for multi-byte data. If that is being done correctly already it's probably a little bit accidental.) The only case for allowing the object argument to a TypedArray constructor to be a SharedArrayBuffer is uniformity with the rest of the language.
Assignee | ||
Comment 2•9 years ago
|
||
The spec has changed, SharedTypedArray is going away.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•