Closed Bug 1391636 Opened 7 years ago Closed 7 years ago

We can support wasm on a platform only if it has 8-byte atomics

Categories

(Core :: JavaScript Engine: JIT, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: lth, Assigned: lth)

References

Details

Attachments

(1 file)

8-byte atomics are required to be lock free, and 8-byte racy load and store are required to be access-atomic.  On ARM, the atomics require LDREXD and STREXD, which are supported from ARMv6K and forward, this should not be a hardship.  The loads and stores can be emulated with LDREXD+CLREX and LDREXD+STREXD, respectively, but it's better to use LDRD and STRD if they are access-atomic.  They are access-atomic if the Large Physical Address Extension is present, which it is in some ARMv7-A implementations and I believe in all ARMv8 aarch32 implementations.  It's possible to test for it.  But it is in any case subsumbed by the test for LDREXD and STREXD as far as testing for lock-freedom goes; it will simply be an optimization to use LDRD and STRD for access-atomic loads and stores when possible.

Anyhow, wasm::hasCompilerSupport() should call jit::AtomicOperations::isLockfree8() and only return true if the latter returns true.
Would it make sense to have this condition in wasmSupportsThreads() instead, and merge it into wasm::hasCompilerSupport only when the feature rides the trains?
(In reply to Benjamin Bouvier [:bbouvier] from comment #1)
> Would it make sense to have this condition in wasmSupportsThreads() instead,
> and merge it into wasm::hasCompilerSupport only when the feature rides the
> trains?

Yes, that seems meaningful.
Hardware: ARM → All
Summary: On ARM, we can support wasm only if we have 8-byte atomics → We can support wasm on a platform only if it has 8-byte atomics
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Attachment #8898829 - Flags: review?(bbouvier)
Comment on attachment 8898829 [details] [diff] [review]
bug1391636-gate-on-lockfree8.patch

Review of attachment 8898829 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thanks.
Attachment #8898829 - Flags: review?(bbouvier) → review+
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9bf5648598b0
gate the availability of wasm threads on 8-byte lock-free atomics. r=bbouvier
https://hg.mozilla.org/mozilla-central/rev/9bf5648598b0
https://hg.mozilla.org/mozilla-central/rev/e013d1324ea8
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2d6227004721
Move a guard from TestingFunctions into Wasm proper. r=me
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: