Skip to content

Commit 5abae02

Browse files
mauri870gopherbot
authored andcommitted
runtime/internal/atomic: deduplicate And/Or code on wasm
When I initially added the wasm code for these ops I did not saw that wasm actually has the Cas operations implemented, although they are merely pointer assignments since wasm is single threaded. Now with a generic implementation for And/Or we can add wasm to the build tags. For #61395 Change-Id: I997dc90477c772882d6703df1b795dfc0d90a699 GitHub-Last-Rev: 92736a6 GitHub-Pull-Request: #64300 Reviewed-on: https://go-review.googlesource.com/c/go/+/544116 Run-TryBot: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
1 parent 2c424ed commit 5abae02

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

src/runtime/internal/atomic/atomic_andor_generic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build arm || s390x || loong64 || mips || mipsle || mips64 || mips64le
5+
//go:build arm || s390x || loong64 || mips || mipsle || mips64 || mips64le || wasm
66

77
package atomic
88

src/runtime/internal/atomic/atomic_wasm.go

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -339,51 +339,3 @@ func Xaddint64(ptr *int64, delta int64) int64 {
339339
*ptr = new
340340
return new
341341
}
342-
343-
//go:nosplit
344-
//go:noinline
345-
func And32(ptr *uint32, val uint32) uint32 {
346-
old := *ptr
347-
*ptr = old & val
348-
return old
349-
}
350-
351-
//go:nosplit
352-
//go:noinline
353-
func And64(ptr *uint64, val uint64) uint64 {
354-
old := *ptr
355-
*ptr = old & val
356-
return old
357-
}
358-
359-
//go:nosplit
360-
//go:noinline
361-
func Anduintptr(ptr *uintptr, val uintptr) uintptr {
362-
old := *ptr
363-
*ptr = old & val
364-
return old
365-
}
366-
367-
//go:nosplit
368-
//go:noinline
369-
func Or32(ptr *uint32, val uint32) uint32 {
370-
old := *ptr
371-
*ptr = old | val
372-
return old
373-
}
374-
375-
//go:nosplit
376-
//go:noinline
377-
func Or64(ptr *uint64, val uint64) uint64 {
378-
old := *ptr
379-
*ptr = old | val
380-
return old
381-
}
382-
383-
//go:nosplit
384-
//go:noinline
385-
func Oruintptr(ptr *uintptr, val uintptr) uintptr {
386-
old := *ptr
387-
*ptr = old | val
388-
return old
389-
}

0 commit comments

Comments
 (0)