[dev.typeparams] runtime: replace Goos* constants with internal/goos versions [generated]

[git-generate]
cd src/runtime
gofmt -w -r "sys.GoosAix       -> goos.IsAix" .
gofmt -w -r "sys.GoosAndroid   -> goos.IsAndroid" .
gofmt -w -r "sys.GoosDarwin    -> goos.IsDarwin" .
gofmt -w -r "sys.GoosDragonfly -> goos.IsDragonfly" .
gofmt -w -r "sys.GoosFreebsd   -> goos.IsFreebsd" .
gofmt -w -r "sys.GoosHurd      -> goos.IsHurd" .
gofmt -w -r "sys.GoosIllumos   -> goos.IsIllumos" .
gofmt -w -r "sys.GoosIos       -> goos.IsIos" .
gofmt -w -r "sys.GoosJs        -> goos.IsJs" .
gofmt -w -r "sys.GoosLinux     -> goos.IsLinux" .
gofmt -w -r "sys.GoosNacl      -> goos.IsNacl" .
gofmt -w -r "sys.GoosNetbsd    -> goos.IsNetbsd" .
gofmt -w -r "sys.GoosOpenbsd   -> goos.IsOpenbsd" .
gofmt -w -r "sys.GoosPlan9     -> goos.IsPlan9" .
gofmt -w -r "sys.GoosSolaris   -> goos.IsSolaris" .
gofmt -w -r "sys.GoosWindows   -> goos.IsWindows" .
gofmt -w -r "sys.GoosZos       -> goos.IsZos" .
goimports -w *.go

Change-Id: I42bed2907317ed409812e5a3e2897c88a5d36f24
Reviewed-on: https://go-review.googlesource.com/c/go/+/328344
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:52:24 +00:00 committed by Michael Knyszek
parent 81a6a4354b
commit 7b0e9cae66
4 changed files with 12 additions and 8 deletions

View file

@ -8,6 +8,7 @@ package runtime
import ( import (
"internal/goarch" "internal/goarch"
"internal/goos"
"runtime/internal/atomic" "runtime/internal/atomic"
"runtime/internal/sys" "runtime/internal/sys"
"unsafe" "unsafe"
@ -1051,7 +1052,7 @@ func FreePageAlloc(pp *PageAlloc) {
// //
// This should not be higher than 0x100*pallocChunkBytes to support // This should not be higher than 0x100*pallocChunkBytes to support
// mips and mipsle, which only have 31-bit address spaces. // mips and mipsle, which only have 31-bit address spaces.
var BaseChunkIdx = ChunkIdx(chunkIndex(((0xc000*pageAlloc64Bit + 0x100*pageAlloc32Bit) * pallocChunkBytes) + arenaBaseOffset*sys.GoosAix)) var BaseChunkIdx = ChunkIdx(chunkIndex(((0xc000*pageAlloc64Bit + 0x100*pageAlloc32Bit) * pallocChunkBytes) + arenaBaseOffset*goos.IsAix))
// PageBase returns an address given a chunk index and a page index // PageBase returns an address given a chunk index and a page index
// relative to that chunk. // relative to that chunk.

View file

@ -102,6 +102,7 @@ package runtime
import ( import (
"internal/goarch" "internal/goarch"
"internal/goos"
"runtime/internal/atomic" "runtime/internal/atomic"
"runtime/internal/math" "runtime/internal/math"
"runtime/internal/sys" "runtime/internal/sys"
@ -151,7 +152,7 @@ const (
// windows/32 | 4KB | 3 // windows/32 | 4KB | 3
// windows/64 | 8KB | 2 // windows/64 | 8KB | 2
// plan9 | 4KB | 3 // plan9 | 4KB | 3
_NumStackOrders = 4 - goarch.PtrSize/4*sys.GoosWindows - 1*sys.GoosPlan9 _NumStackOrders = 4 - goarch.PtrSize/4*goos.IsWindows - 1*goos.IsPlan9
// heapAddrBits is the number of bits in a heap address. On // heapAddrBits is the number of bits in a heap address. On
// amd64, addresses are sign-extended beyond heapAddrBits. On // amd64, addresses are sign-extended beyond heapAddrBits. On
@ -208,7 +209,7 @@ const (
// arenaBaseOffset to offset into the top 4 GiB. // arenaBaseOffset to offset into the top 4 GiB.
// //
// WebAssembly currently has a limit of 4GB linear memory. // WebAssembly currently has a limit of 4GB linear memory.
heapAddrBits = (_64bit*(1-sys.GoarchWasm)*(1-sys.GoosIos*sys.GoarchArm64))*48 + (1-_64bit+sys.GoarchWasm)*(32-(sys.GoarchMips+sys.GoarchMipsle)) + 33*sys.GoosIos*sys.GoarchArm64 heapAddrBits = (_64bit*(1-sys.GoarchWasm)*(1-goos.IsIos*sys.GoarchArm64))*48 + (1-_64bit+sys.GoarchWasm)*(32-(sys.GoarchMips+sys.GoarchMipsle)) + 33*goos.IsIos*sys.GoarchArm64
// maxAlloc is the maximum size of an allocation. On 64-bit, // maxAlloc is the maximum size of an allocation. On 64-bit,
// it's theoretically possible to allocate 1<<heapAddrBits bytes. On // it's theoretically possible to allocate 1<<heapAddrBits bytes. On
@ -249,7 +250,7 @@ const (
// logHeapArenaBytes is log_2 of heapArenaBytes. For clarity, // logHeapArenaBytes is log_2 of heapArenaBytes. For clarity,
// prefer using heapArenaBytes where possible (we need the // prefer using heapArenaBytes where possible (we need the
// constant to compute some other constants). // constant to compute some other constants).
logHeapArenaBytes = (6+20)*(_64bit*(1-sys.GoosWindows)*(1-sys.GoarchWasm)*(1-sys.GoosIos*sys.GoarchArm64)) + (2+20)*(_64bit*sys.GoosWindows) + (2+20)*(1-_64bit) + (2+20)*sys.GoarchWasm + (2+20)*sys.GoosIos*sys.GoarchArm64 logHeapArenaBytes = (6+20)*(_64bit*(1-goos.IsWindows)*(1-sys.GoarchWasm)*(1-goos.IsIos*sys.GoarchArm64)) + (2+20)*(_64bit*goos.IsWindows) + (2+20)*(1-_64bit) + (2+20)*sys.GoarchWasm + (2+20)*goos.IsIos*sys.GoarchArm64
// heapArenaBitmapBytes is the size of each heap arena's bitmap. // heapArenaBitmapBytes is the size of each heap arena's bitmap.
heapArenaBitmapBytes = heapArenaBytes / (goarch.PtrSize * 8 / 2) heapArenaBitmapBytes = heapArenaBytes / (goarch.PtrSize * 8 / 2)
@ -269,7 +270,7 @@ const (
// We use the L1 map on 64-bit Windows because the arena size // We use the L1 map on 64-bit Windows because the arena size
// is small, but the address space is still 48 bits, and // is small, but the address space is still 48 bits, and
// there's a high cost to having a large L2. // there's a high cost to having a large L2.
arenaL1Bits = 6 * (_64bit * sys.GoosWindows) arenaL1Bits = 6 * (_64bit * goos.IsWindows)
// arenaL2Bits is the number of bits of the arena number // arenaL2Bits is the number of bits of the arena number
// covered by the second level arena index. // covered by the second level arena index.
@ -304,7 +305,7 @@ const (
// //
// On other platforms, the user address space is contiguous // On other platforms, the user address space is contiguous
// and starts at 0, so no offset is necessary. // and starts at 0, so no offset is necessary.
arenaBaseOffset = 0xffff800000000000*sys.GoarchAmd64 + 0x0a00000000000000*sys.GoosAix arenaBaseOffset = 0xffff800000000000*sys.GoarchAmd64 + 0x0a00000000000000*goos.IsAix
// A typed version of this constant that will make it into DWARF (for viewcore). // A typed version of this constant that will make it into DWARF (for viewcore).
arenaBaseOffsetUintptr = uintptr(arenaBaseOffset) arenaBaseOffsetUintptr = uintptr(arenaBaseOffset)

View file

@ -56,6 +56,7 @@
package runtime package runtime
import ( import (
"internal/goos"
"runtime/internal/atomic" "runtime/internal/atomic"
"runtime/internal/sys" "runtime/internal/sys"
"unsafe" "unsafe"
@ -90,7 +91,7 @@ const (
// //
// This ratio is used as part of multiplicative factor to help the scavenger account // This ratio is used as part of multiplicative factor to help the scavenger account
// for the additional costs of using scavenged memory in its pacing. // for the additional costs of using scavenged memory in its pacing.
scavengeCostRatio = 0.7 * (sys.GoosDarwin + sys.GoosIos) scavengeCostRatio = 0.7 * (goos.IsDarwin + goos.IsIos)
// scavengeReservationShards determines the amount of memory the scavenger // scavengeReservationShards determines the amount of memory the scavenger
// should reserve for scavenging at a time. Specifically, the amount of // should reserve for scavenging at a time. Specifically, the amount of

View file

@ -8,6 +8,7 @@ import (
"internal/abi" "internal/abi"
"internal/cpu" "internal/cpu"
"internal/goarch" "internal/goarch"
"internal/goos"
"runtime/internal/atomic" "runtime/internal/atomic"
"runtime/internal/sys" "runtime/internal/sys"
"unsafe" "unsafe"
@ -68,7 +69,7 @@ const (
// to each stack below the usual guard area for OS-specific // to each stack below the usual guard area for OS-specific
// purposes like signal handling. Used on Windows, Plan 9, // purposes like signal handling. Used on Windows, Plan 9,
// and iOS because they do not use a separate stack. // and iOS because they do not use a separate stack.
_StackSystem = sys.GoosWindows*512*goarch.PtrSize + sys.GoosPlan9*512 + sys.GoosIos*sys.GoarchArm64*1024 _StackSystem = goos.IsWindows*512*goarch.PtrSize + goos.IsPlan9*512 + goos.IsIos*sys.GoarchArm64*1024
// The minimum size of stack used by Go code // The minimum size of stack used by Go code
_StackMin = 2048 _StackMin = 2048