]> Cypherpunks repositories - gostls13.git/commit
internal/cpu: add a CacheLinePadSize constant
authorMartin Möhrmann <moehrmann@google.com>
Fri, 24 Aug 2018 15:07:20 +0000 (17:07 +0200)
committerMartin Möhrmann <moehrmann@google.com>
Fri, 24 Aug 2018 17:45:28 +0000 (17:45 +0000)
commit60f83621fc357f9e838bee9811230339b9da493a
tree2434947941cb95c529c953b2c0ed9d97c145c8e1
parent38143badf1d7244f1015286ba2d2d540a3a78d69
internal/cpu: add a CacheLinePadSize constant

The new constant CacheLinePadSize can be used to compute best effort
alignment of structs to cache lines.

e.g. the runtime can use this in the locktab definition:
var locktab [57]struct {
        l   spinlock
        pad [cpu.CacheLinePadSize - unsafe.Sizeof(spinlock{})]byte
}

Change-Id: I86f6fbfc5ee7436f742776a7d4a99a1d54ffccc8
Reviewed-on: https://go-review.googlesource.com/131237
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/internal/cpu/cpu.go
src/internal/cpu/cpu_arm.go
src/internal/cpu/cpu_arm64.go
src/internal/cpu/cpu_mips.go
src/internal/cpu/cpu_mips64.go
src/internal/cpu/cpu_mips64le.go
src/internal/cpu/cpu_mipsle.go
src/internal/cpu/cpu_ppc64x.go
src/internal/cpu/cpu_s390x.go
src/internal/cpu/cpu_wasm.go
src/internal/cpu/cpu_x86.go