From 33d1b82d16a199b1f8c61cba40b4d883088ca278 Mon Sep 17 00:00:00 2001 From: Michael Anthony Knyszek Date: Wed, 16 Jun 2021 21:25:19 +0000 Subject: [PATCH] [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 Run-TryBot: Michael Knyszek TryBot-Result: Go Bot Reviewed-by: Matthew Dempsky --- src/runtime/internal/sys/consts.go | 18 ------------------ src/runtime/stack.go | 8 ++++---- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/runtime/internal/sys/consts.go b/src/runtime/internal/sys/consts.go index dcba7a6e0d1..6400c107483 100644 --- a/src/runtime/internal/sys/consts.go +++ b/src/runtime/internal/sys/consts.go @@ -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 diff --git a/src/runtime/stack.go b/src/runtime/stack.go index 0c862e5d08f..d63b86ddc17 100644 --- a/src/runtime/stack.go +++ b/src/runtime/stack.go @@ -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