Commit ba09d06e authored by Jeremy Jackins's avatar Jeremy Jackins Committed by Matthew Dempsky

runtime: remove remaining references to TheChar

After mdempsky's recent changes, these are the only references to
"TheChar" left in the Go tree. Without the context, and without
knowing the history, this is confusing.

Also rename sys.TheGoos and sys.TheGoarch to sys.GOOS
and sys.GOARCH.

Also change the heap dump format to include sys.GOARCH
rather than TheChar, which is no longer a concept.

Updates #15169 (changes heapdump format)

Change-Id: I3e99eeeae00ed55d7d01e6ed503d958c6e931dca
Reviewed-on: https://go-review.googlesource.com/21647Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
parent 1faa8869
...@@ -224,8 +224,8 @@ func Version() string { ...@@ -224,8 +224,8 @@ func Version() string {
// GOOS is the running program's operating system target: // GOOS is the running program's operating system target:
// one of darwin, freebsd, linux, and so on. // one of darwin, freebsd, linux, and so on.
const GOOS string = sys.TheGoos const GOOS string = sys.GOOS
// GOARCH is the running program's architecture target: // GOARCH is the running program's architecture target:
// 386, amd64, arm, or s390x. // 386, amd64, arm, or s390x.
const GOARCH string = sys.TheGoarch const GOARCH string = sys.GOARCH
...@@ -496,7 +496,7 @@ func dumpparams() { ...@@ -496,7 +496,7 @@ func dumpparams() {
dumpint(sys.PtrSize) dumpint(sys.PtrSize)
dumpint(uint64(mheap_.arena_start)) dumpint(uint64(mheap_.arena_start))
dumpint(uint64(mheap_.arena_used)) dumpint(uint64(mheap_.arena_used))
dumpint(sys.TheChar) dumpstr(sys.GOARCH)
dumpstr(sys.Goexperiment) dumpstr(sys.Goexperiment)
dumpint(uint64(ncpu)) dumpint(uint64(ncpu))
} }
......
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package sys
type ArchFamilyType int
const (
AMD64 ArchFamilyType = iota
ARM
ARM64
I386
MIPS64
PPC64
S390X
)
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = '8' ArchFamily = I386
BigEndian = 0 BigEndian = 0
CacheLineSize = 64 CacheLineSize = 64
PhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl PhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = '6' ArchFamily = AMD64
BigEndian = 0 BigEndian = 0
CacheLineSize = 64 CacheLineSize = 64
PhysPageSize = 4096 PhysPageSize = 4096
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = '6' ArchFamily = AMD64
BigEndian = 0 BigEndian = 0
CacheLineSize = 64 CacheLineSize = 64
PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl) PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = '5' ArchFamily = ARM
BigEndian = 0 BigEndian = 0
CacheLineSize = 32 CacheLineSize = 32
PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl) PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl)
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = '7' ArchFamily = ARM64
BigEndian = 0 BigEndian = 0
CacheLineSize = 32 CacheLineSize = 32
PhysPageSize = 65536 PhysPageSize = 65536
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = '0' ArchFamily = MIPS64
BigEndian = 1 BigEndian = 1
CacheLineSize = 32 CacheLineSize = 32
PhysPageSize = 16384 PhysPageSize = 16384
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = '0' ArchFamily = MIPS64
BigEndian = 0 BigEndian = 0
CacheLineSize = 32 CacheLineSize = 32
PhysPageSize = 16384 PhysPageSize = 16384
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = '9' ArchFamily = PPC64
BigEndian = 1 BigEndian = 1
CacheLineSize = 64 CacheLineSize = 64
PhysPageSize = 65536 PhysPageSize = 65536
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = '9' ArchFamily = PPC64
BigEndian = 0 BigEndian = 0
CacheLineSize = 64 CacheLineSize = 64
PhysPageSize = 65536 PhysPageSize = 65536
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
package sys package sys
const ( const (
TheChar = 'z' ArchFamily = S390X
BigEndian = 1 BigEndian = 1
CacheLineSize = 256 CacheLineSize = 256
PhysPageSize = 4096 PhysPageSize = 4096
......
...@@ -50,7 +50,7 @@ func main() { ...@@ -50,7 +50,7 @@ func main() {
fmt.Fprintf(&buf, "// +build !android\n\n") // must explicitly exclude android for linux fmt.Fprintf(&buf, "// +build !android\n\n") // must explicitly exclude android for linux
} }
fmt.Fprintf(&buf, "package sys\n\n") fmt.Fprintf(&buf, "package sys\n\n")
fmt.Fprintf(&buf, "const TheGoos = `%s`\n\n", target) fmt.Fprintf(&buf, "const GOOS = `%s`\n\n", target)
for _, goos := range gooses { for _, goos := range gooses {
value := 0 value := 0
if goos == target { if goos == target {
...@@ -68,7 +68,7 @@ func main() { ...@@ -68,7 +68,7 @@ func main() {
var buf bytes.Buffer var buf bytes.Buffer
fmt.Fprintf(&buf, "// generated by gengoos.go using 'go generate'\n\n") fmt.Fprintf(&buf, "// generated by gengoos.go using 'go generate'\n\n")
fmt.Fprintf(&buf, "package sys\n\n") fmt.Fprintf(&buf, "package sys\n\n")
fmt.Fprintf(&buf, "const TheGoarch = `%s`\n\n", target) fmt.Fprintf(&buf, "const GOARCH = `%s`\n\n", target)
for _, goarch := range goarches { for _, goarch := range goarches {
value := 0 value := 0
if goarch == target { if goarch == target {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `386` const GOARCH = `386`
const Goarch386 = 1 const Goarch386 = 1
const GoarchAmd64 = 0 const GoarchAmd64 = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `amd64` const GOARCH = `amd64`
const Goarch386 = 0 const Goarch386 = 0
const GoarchAmd64 = 1 const GoarchAmd64 = 1
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `amd64p32` const GOARCH = `amd64p32`
const Goarch386 = 0 const Goarch386 = 0
const GoarchAmd64 = 0 const GoarchAmd64 = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `arm` const GOARCH = `arm`
const Goarch386 = 0 const Goarch386 = 0
const GoarchAmd64 = 0 const GoarchAmd64 = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `arm64` const GOARCH = `arm64`
const Goarch386 = 0 const Goarch386 = 0
const GoarchAmd64 = 0 const GoarchAmd64 = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `mips64` const GOARCH = `mips64`
const Goarch386 = 0 const Goarch386 = 0
const GoarchAmd64 = 0 const GoarchAmd64 = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `mips64le` const GOARCH = `mips64le`
const Goarch386 = 0 const Goarch386 = 0
const GoarchAmd64 = 0 const GoarchAmd64 = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `ppc64` const GOARCH = `ppc64`
const Goarch386 = 0 const Goarch386 = 0
const GoarchAmd64 = 0 const GoarchAmd64 = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `ppc64le` const GOARCH = `ppc64le`
const Goarch386 = 0 const Goarch386 = 0
const GoarchAmd64 = 0 const GoarchAmd64 = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoarch = `s390x` const GOARCH = `s390x`
const Goarch386 = 0 const Goarch386 = 0
const GoarchAmd64 = 0 const GoarchAmd64 = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `android` const GOOS = `android`
const GoosAndroid = 1 const GoosAndroid = 1
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `darwin` const GOOS = `darwin`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 1 const GoosDarwin = 1
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `dragonfly` const GOOS = `dragonfly`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `freebsd` const GOOS = `freebsd`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
package sys package sys
const TheGoos = `linux` const GOOS = `linux`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `nacl` const GOOS = `nacl`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `netbsd` const GOOS = `netbsd`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `openbsd` const GOOS = `openbsd`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `plan9` const GOOS = `plan9`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `solaris` const GOOS = `solaris`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
package sys package sys
const TheGoos = `windows` const GOOS = `windows`
const GoosAndroid = 0 const GoosAndroid = 0
const GoosDarwin = 0 const GoosDarwin = 0
......
...@@ -719,8 +719,8 @@ func scanframeworker(frame *stkframe, cache *pcvalueCache, gcw *gcWork) { ...@@ -719,8 +719,8 @@ func scanframeworker(frame *stkframe, cache *pcvalueCache, gcw *gcWork) {
// Scan local variables if stack frame has been allocated. // Scan local variables if stack frame has been allocated.
size := frame.varp - frame.sp size := frame.varp - frame.sp
var minsize uintptr var minsize uintptr
switch sys.TheChar { switch sys.ArchFamily {
case '7': case sys.ARM64:
minsize = sys.SpAlign minsize = sys.SpAlign
default: default:
minsize = sys.MinFrameSize minsize = sys.MinFrameSize
......
...@@ -634,8 +634,8 @@ func adjustframe(frame *stkframe, arg unsafe.Pointer) bool { ...@@ -634,8 +634,8 @@ func adjustframe(frame *stkframe, arg unsafe.Pointer) bool {
// Adjust local variables if stack frame has been allocated. // Adjust local variables if stack frame has been allocated.
size := frame.varp - frame.sp size := frame.varp - frame.sp
var minsize uintptr var minsize uintptr
switch sys.TheChar { switch sys.ArchFamily {
case '7': case sys.ARM64:
minsize = sys.SpAlign minsize = sys.SpAlign
default: default:
minsize = sys.MinFrameSize minsize = sys.MinFrameSize
...@@ -662,7 +662,7 @@ func adjustframe(frame *stkframe, arg unsafe.Pointer) bool { ...@@ -662,7 +662,7 @@ func adjustframe(frame *stkframe, arg unsafe.Pointer) bool {
} }
// Adjust saved base pointer if there is one. // Adjust saved base pointer if there is one.
if sys.TheChar == '6' && frame.argp-frame.varp == 2*sys.RegSize { if sys.ArchFamily == sys.AMD64 && frame.argp-frame.varp == 2*sys.RegSize {
if !framepointer_enabled { if !framepointer_enabled {
print("runtime: found space for saved base pointer, but no framepointer experiment\n") print("runtime: found space for saved base pointer, but no framepointer experiment\n")
print("argp=", hex(frame.argp), " varp=", hex(frame.varp), "\n") print("argp=", hex(frame.argp), " varp=", hex(frame.varp), "\n")
...@@ -969,7 +969,7 @@ func newstack() { ...@@ -969,7 +969,7 @@ func newstack() {
throw("missing stack in newstack") throw("missing stack in newstack")
} }
sp := gp.sched.sp sp := gp.sched.sp
if sys.TheChar == '6' || sys.TheChar == '8' { if sys.ArchFamily == sys.AMD64 || sys.ArchFamily == sys.I386 {
// The call to morestack cost a word. // The call to morestack cost a word.
sp -= sys.PtrSize sp -= sys.PtrSize
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment