I'm offering this idea on behalf of Jarred Sumner, who has gone ahead and had AI implement it in webkit in lieu of designing the feature: Shared-memory threads for JavaScriptCore (experimental, not working yet) by Jarred-Sumner · Pull Request #249 · oven-sh/WebKit · GitHub
The idea is in conflict with SES, and has never been offered anywhere for feedback. @gibson042 any thoughts?
While the spec isn't explicit about this, most spec algorithms do not support such concurrency.
Besides that, IMO unrestricted shared memory concurrency makes it impossible for programs to reason about the state of objects if any object can become shared.
I'm considering bringing forward a normative PR to make it explicit that an engine implementation may not allow agents to let objects that are not explicitly designated as shared to be observed as having changes performed from steps other than the current execution thread. Exact wording TBD but basically no synchronous cross thread mutation of regular objects.
The shared struct proposal is going through the standard process to introduce object based shared memory concurrency in a more principled manner. Regarding the UX of starting threads, this is something where I believe proposals like module expressions could help.
1 Like