Skip to content

Commit 3b41e54

Browse files
authored
Rollup merge of #73036 - alexcrichton:update-wasm-fence, r=Mark-Simulacrum
std: Enable atomic.fence emission on wasm32 This commit removes the `#[cfg]` guards in `atomic::fence` on wasm targets. Since these guards were originally added the upstream wasm specification for threads gained an `atomic.fence` instruction, so LLVM no longer panics on these intrinsics. Although there aren't a ton of tests in-repo for this right now I've tested locally and all of these fences generate `atomic.fence` instructions in wasm. Closes #65687 Closes #72997
2 parents 2e42476 + 05b2d3f commit 3b41e54

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

src/libcore/sync/atomic.rs

-8
Original file line numberDiff line numberDiff line change
@@ -2623,15 +2623,7 @@ unsafe fn atomic_umin<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
26232623
/// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
26242624
#[inline]
26252625
#[stable(feature = "rust1", since = "1.0.0")]
2626-
#[cfg_attr(target_arch = "wasm32", allow(unused_variables))]
26272626
pub fn fence(order: Ordering) {
2628-
// On wasm32 it looks like fences aren't implemented in LLVM yet in that
2629-
// they will cause LLVM to abort. The wasm instruction set doesn't have
2630-
// fences right now. There's discussion online about the best way for tools
2631-
// to conventionally implement fences at
2632-
// https://github.com/WebAssembly/tool-conventions/issues/59. We should
2633-
// follow that discussion and implement a solution when one comes about!
2634-
#[cfg(not(target_arch = "wasm32"))]
26352627
// SAFETY: using an atomic fence is safe.
26362628
unsafe {
26372629
match order {

0 commit comments

Comments
 (0)