Skip to content

Commit

Permalink
internal/cpu: make architectures without initialization work explicit
Browse files Browse the repository at this point in the history
When cpu_no_init.go was created most architectures did not have
code in the doinit function. Currently only mips(le), riscv64 and
wasm do not have empty doinit functions.

Keeping cpu_no_init.go around does not reduce the work to satisfy
the build process when adding support for new architectures.

To support a new architecture a new file or build directive has to
be added to an existing file at any rate to define the constant
CacheLinePadSize. A new empty doinit can then be created in the
new file or the existing doinit can be reused when adding the
additional build directive.

Change-Id: I58a97f8cdf1cf1be85c37f4550c40750358aa031
Reviewed-on: https://go-review.googlesource.com/c/go/+/263801
Trust: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
  • Loading branch information
martisch committed Oct 20, 2020
1 parent de932da commit feb984c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
3 changes: 3 additions & 0 deletions src/internal/cpu/cpu_mips.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
package cpu

const CacheLinePadSize = 32

func doinit() {
}
3 changes: 3 additions & 0 deletions src/internal/cpu/cpu_mipsle.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
package cpu

const CacheLinePadSize = 32

func doinit() {
}
18 changes: 0 additions & 18 deletions src/internal/cpu/cpu_no_init.go

This file was deleted.

3 changes: 3 additions & 0 deletions src/internal/cpu/cpu_riscv64.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
package cpu

const CacheLinePadSize = 32

func doinit() {
}
3 changes: 3 additions & 0 deletions src/internal/cpu/cpu_wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
package cpu

const CacheLinePadSize = 64

func doinit() {
}

0 comments on commit feb984c

Please sign in to comment.