Skip to content

Commit ec7d955

Browse files
rhyshgopherbot
authored andcommitted
cmd/compile/internal/test: verify inlining for mutex fast paths
Change-Id: I17568a898ea8514c7b32d2f48c44365ae37cf898 Reviewed-on: https://go-review.googlesource.com/c/go/+/670195 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
1 parent 0c15d88 commit ec7d955

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/cmd/compile/internal/test/inl_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,25 @@ func TestIntendedInlining(t *testing.T) {
284284
}
285285
}
286286

287+
if runtime.GOARCH != "wasm" {
288+
// mutex implementation for multi-threaded GOARCHes
289+
want["runtime"] = append(want["runtime"],
290+
// in the fast paths of lock2 and unlock2
291+
"key8",
292+
"(*mLockProfile).store",
293+
)
294+
if bits.UintSize == 64 {
295+
// these use 64-bit arithmetic, which is hard to inline on 32-bit platforms
296+
want["runtime"] = append(want["runtime"],
297+
// in the fast paths of lock2 and unlock2
298+
"mutexSampleContention",
299+
300+
// in a slow path of lock2, but within the critical section
301+
"(*mLockProfile).end",
302+
)
303+
}
304+
}
305+
287306
// Functions that must actually be inlined; they must have actual callers.
288307
must := map[string]bool{
289308
"compress/flate.byLiteral.Len": true,

0 commit comments

Comments
 (0)