Skip to content

Commit 7a17711

Browse files
rhyshgopherbot
authored andcommitted
runtime: commit to spinbitmutex GOEXPERIMENT
Use the "spinbit" mutex implementation always (including on platforms that need to emulate atomic.Xchg8), and delete the prior "tristate" implementations. The exception is GOARCH=wasm, where the Go runtime does not use multiple threads. For #68578 Change-Id: Ifc29bbfa05071d776c23a19ae185891a03a82417 Reviewed-on: https://go-review.googlesource.com/c/go/+/658456 Auto-Submit: Rhys Hiltner <[email protected]> Reviewed-by: Junyang Shao <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 7ce45a0 commit 7a17711

File tree

8 files changed

+4
-314
lines changed

8 files changed

+4
-314
lines changed

src/internal/buildcfg/exp.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ func ParseGOEXPERIMENT(goos, goarch, goexp string) (*ExperimentFlags, error) {
6767
regabiSupported = true
6868
}
6969

70-
haveThreads := goarch != "wasm"
71-
7270
// Older versions (anything before V16) of dsymutil don't handle
7371
// the .debug_rnglists section in DWARF5. See
7472
// https://github.com/golang/go/issues/26379#issuecomment-2677068742
@@ -85,7 +83,6 @@ func ParseGOEXPERIMENT(goos, goarch, goexp string) (*ExperimentFlags, error) {
8583
RegabiArgs: regabiSupported,
8684
AliasTypeParams: true,
8785
SwissMap: true,
88-
SpinbitMutex: haveThreads,
8986
SyncHashTrieMap: true,
9087
Dwarf5: dwarf5Supported,
9188
}

src/internal/goexperiment/exp_spinbitmutex_off.go

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/internal/goexperiment/exp_spinbitmutex_on.go

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/internal/goexperiment/flags.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,6 @@ type Flags struct {
115115
// SwissMap enables the SwissTable-based map implementation.
116116
SwissMap bool
117117

118-
// SpinbitMutex enables the new "spinbit" mutex implementation on supported
119-
// platforms. See https://go.dev/issue/68578.
120-
SpinbitMutex bool
121-
122118
// SyncHashTrieMap enables the HashTrieMap sync.Map implementation.
123119
SyncHashTrieMap bool
124120

src/runtime/lock_futex_tristate.go

Lines changed: 0 additions & 138 deletions
This file was deleted.

src/runtime/lock_sema_tristate.go

Lines changed: 0 additions & 148 deletions
This file was deleted.

src/runtime/lock_spinbit.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 (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || plan9 || solaris || windows) && goexperiment.spinbitmutex
5+
//go:build !wasm
66

77
package runtime
88

src/runtime/runtime2.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"internal/abi"
99
"internal/chacha8rand"
1010
"internal/goarch"
11-
"internal/goexperiment"
1211
"internal/runtime/atomic"
1312
"internal/runtime/sys"
1413
"unsafe"
@@ -628,9 +627,9 @@ type mPadded struct {
628627

629628
// Size the runtime.m structure so it fits in the 2048-byte size class, and
630629
// not in the next-smallest (1792-byte) size class. That leaves the 11 low
631-
// bits of muintptr values available for flags, as required for
632-
// GOEXPERIMENT=spinbitmutex.
633-
_ [goexperiment.SpinbitMutexInt * (2048 - mallocHeaderSize - mRedZoneSize - unsafe.Sizeof(m{}))]byte
630+
// bits of muintptr values available for flags, as required by
631+
// lock_spinbit.go.
632+
_ [(1 - goarch.IsWasm) * (2048 - mallocHeaderSize - mRedZoneSize - unsafe.Sizeof(m{}))]byte
634633
}
635634

636635
type p struct {

0 commit comments

Comments
 (0)