1
0
mirror of https://github.com/golang/go synced 2024-11-26 07:38:00 -07:00

[dev.typeparams] runtime/internal/sys: replace ArchFamily and constants with goarch

Refactoring with rf

    rf 'ex . {
      import "internal/goarch"
      import "runtime/internal/sys"
      sys.ArchFamily -> goarch.ArchFamily
      sys.AMD64 -> goarch.AMD64
      sys.ARM -> goarch.ARM
      sys.ARM64 -> goarch.ARM64
      sys.I386 -> goarch.I386
      sys.MIPS -> goarch.MIPS
      sys.MIPS64 -> goarch.MIPS64
      sys.PPC64 -> goarch.PPC64
      sys.RISCV64 -> goarch.RISCV64
      sys.S390X -> goarch.S390X
      sys.WASM -> goarch.WASM
    }'

Change-Id: I0cc29ed3fdcf9ff39aa901d8bc92270996f0821c
Reviewed-on: https://go-review.googlesource.com/c/go/+/328341
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Michael Anthony Knyszek 2021-06-16 21:25:19 +00:00 committed by Michael Knyszek
parent 85b12a8563
commit 33d1b82d16
2 changed files with 4 additions and 22 deletions

View File

@ -9,24 +9,6 @@ import (
"internal/goos"
)
type ArchFamilyType = goarch.ArchFamilyType
const (
AMD64 = goarch.AMD64
ARM = goarch.ARM
ARM64 = goarch.ARM64
I386 = goarch.I386
MIPS = goarch.MIPS
MIPS64 = goarch.MIPS64
PPC64 = goarch.PPC64
RISCV64 = goarch.RISCV64
S390X = goarch.S390X
WASM = goarch.WASM
)
// ArchFamily is the architecture family (AMD64, ARM, ...)
const ArchFamily ArchFamilyType = goarch.ArchFamily
// AIX requires a larger stack for syscalls.
const StackGuardMultiplier = StackGuardMultiplierDefault*(1-goos.GoosAix) + 2*goos.GoosAix

View File

@ -662,7 +662,7 @@ func adjustframe(frame *stkframe, arg unsafe.Pointer) bool {
// Adjust saved base pointer if there is one.
// TODO what about arm64 frame pointer adjustment?
if sys.ArchFamily == sys.AMD64 && frame.argp-frame.varp == 2*goarch.PtrSize {
if goarch.ArchFamily == goarch.AMD64 && frame.argp-frame.varp == 2*goarch.PtrSize {
if stackDebug >= 3 {
print(" saved bp\n")
}
@ -1013,7 +1013,7 @@ func newstack() {
throw("missing stack in newstack")
}
sp := gp.sched.sp
if sys.ArchFamily == sys.AMD64 || sys.ArchFamily == sys.I386 || sys.ArchFamily == sys.WASM {
if goarch.ArchFamily == goarch.AMD64 || goarch.ArchFamily == goarch.I386 || goarch.ArchFamily == goarch.WASM {
// The call to morestack cost a word.
sp -= goarch.PtrSize
}
@ -1256,8 +1256,8 @@ func getStackMap(frame *stkframe, cache *pcvalueCache, debug bool) (locals, args
// Local variables.
size := frame.varp - frame.sp
var minsize uintptr
switch sys.ArchFamily {
case sys.ARM64:
switch goarch.ArchFamily {
case goarch.ARM64:
minsize = sys.StackAlign
default:
minsize = sys.MinFrameSize