WebAssembly / shared-everything-threads

A draft proposal for spawning threads in WebAssembly
Other
44 stars 1 forks source link

Consistency of tearing behavior for fields and globals #87

Open tlively opened 1 month ago

tlively commented 1 month ago

The overview currently notes that accesses to shared globals are not allowed to tear. The rationale behind this decision was that the spec does not currently treat numeric globals as sequences of bytes, so it has no way to describe tearing. Lacking data, we also assumed the performance overhead of preventing tearing on shared globals would be acceptable.

We didn't consider, however, that the same spec problem comes up for accesses to numeric fields of shared structs. It seems unlikely that the overhead of disallowing tears on struct fields will be acceptable, so we might have to start treating them as sequences of bytes after all. We might as well then do the same for globals.

tlively commented 3 weeks ago

Another consideration here is packed fields, where disallowing tears might have even more overhead on even more platforms.