import (
"bufio"
+ "internal/buildcfg"
"internal/testenv"
"io"
"math/bits"
"(*Uintptr).Load",
"(*Uintptr).Store",
"(*Uintptr).Swap",
- // TODO(rsc): Why are these not reported as inlined?
- // "(*Pointer[T]).CompareAndSwap",
- // "(*Pointer[T]).Load",
- // "(*Pointer[T]).Store",
- // "(*Pointer[T]).Swap",
+ // (*Pointer[T])'s methods' handled below.
},
}
// (*Bool).CompareAndSwap is just over budget on 32-bit systems (386, arm).
want["sync/atomic"] = append(want["sync/atomic"], "(*Bool).CompareAndSwap")
}
+ if buildcfg.Experiment.Unified {
+ // Non-unified IR does not report "inlining call ..." for atomic.Pointer[T]'s methods.
+ // TODO(cuonglm): remove once non-unified IR frontend gone.
+ want["sync/atomic"] = append(want["sync/atomic"], "(*Pointer[go.shape.int]).CompareAndSwap")
+ want["sync/atomic"] = append(want["sync/atomic"], "(*Pointer[go.shape.int]).Load")
+ want["sync/atomic"] = append(want["sync/atomic"], "(*Pointer[go.shape.int]).Store")
+ want["sync/atomic"] = append(want["sync/atomic"], "(*Pointer[go.shape.int]).Swap")
+ }
switch runtime.GOARCH {
case "386", "wasm", "arm":
return 0
}
+// For testing *Pointer[T]'s methods can be inlined.
+// Keep in sync with cmd/compile/internal/test/inl_test.go:TestIntendedInlining.
+var _ = &Pointer[int]{}
+
// A Pointer is an atomic pointer of type *T. The zero value is a nil *T.
type Pointer[T any] struct {
_ noCopy