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/21647
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Jeremy Jackins 2016-04-07 15:42:35 +09:00 committed by Matthew Dempsky
parent 1faa8869c6
commit ba09d06e16
37 changed files with 59 additions and 42 deletions

View File

@ -224,8 +224,8 @@ func Version() string {
// GOOS is the running program's operating system target:
// 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:
// 386, amd64, arm, or s390x.
const GOARCH string = sys.TheGoarch
const GOARCH string = sys.GOARCH

View File

@ -496,7 +496,7 @@ func dumpparams() {
dumpint(sys.PtrSize)
dumpint(uint64(mheap_.arena_start))
dumpint(uint64(mheap_.arena_used))
dumpint(sys.TheChar)
dumpstr(sys.GOARCH)
dumpstr(sys.Goexperiment)
dumpint(uint64(ncpu))
}

View File

@ -0,0 +1,17 @@
// 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
)

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = '8'
ArchFamily = I386
BigEndian = 0
CacheLineSize = 64
PhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = '6'
ArchFamily = AMD64
BigEndian = 0
CacheLineSize = 64
PhysPageSize = 4096

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = '6'
ArchFamily = AMD64
BigEndian = 0
CacheLineSize = 64
PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl)

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = '5'
ArchFamily = ARM
BigEndian = 0
CacheLineSize = 32
PhysPageSize = 65536*GoosNacl + 4096*(1-GoosNacl)

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = '7'
ArchFamily = ARM64
BigEndian = 0
CacheLineSize = 32
PhysPageSize = 65536

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = '0'
ArchFamily = MIPS64
BigEndian = 1
CacheLineSize = 32
PhysPageSize = 16384

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = '0'
ArchFamily = MIPS64
BigEndian = 0
CacheLineSize = 32
PhysPageSize = 16384

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = '9'
ArchFamily = PPC64
BigEndian = 1
CacheLineSize = 64
PhysPageSize = 65536

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = '9'
ArchFamily = PPC64
BigEndian = 0
CacheLineSize = 64
PhysPageSize = 65536

View File

@ -5,7 +5,7 @@
package sys
const (
TheChar = 'z'
ArchFamily = S390X
BigEndian = 1
CacheLineSize = 256
PhysPageSize = 4096

View File

@ -50,7 +50,7 @@ func main() {
fmt.Fprintf(&buf, "// +build !android\n\n") // must explicitly exclude android for linux
}
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 {
value := 0
if goos == target {
@ -68,7 +68,7 @@ func main() {
var buf bytes.Buffer
fmt.Fprintf(&buf, "// generated by gengoos.go using 'go generate'\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 {
value := 0
if goarch == target {

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `386`
const GOARCH = `386`
const Goarch386 = 1
const GoarchAmd64 = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `amd64`
const GOARCH = `amd64`
const Goarch386 = 0
const GoarchAmd64 = 1

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `amd64p32`
const GOARCH = `amd64p32`
const Goarch386 = 0
const GoarchAmd64 = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `arm`
const GOARCH = `arm`
const Goarch386 = 0
const GoarchAmd64 = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `arm64`
const GOARCH = `arm64`
const Goarch386 = 0
const GoarchAmd64 = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `mips64`
const GOARCH = `mips64`
const Goarch386 = 0
const GoarchAmd64 = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `mips64le`
const GOARCH = `mips64le`
const Goarch386 = 0
const GoarchAmd64 = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `ppc64`
const GOARCH = `ppc64`
const Goarch386 = 0
const GoarchAmd64 = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `ppc64le`
const GOARCH = `ppc64le`
const Goarch386 = 0
const GoarchAmd64 = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoarch = `s390x`
const GOARCH = `s390x`
const Goarch386 = 0
const GoarchAmd64 = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `android`
const GOOS = `android`
const GoosAndroid = 1
const GoosDarwin = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `darwin`
const GOOS = `darwin`
const GoosAndroid = 0
const GoosDarwin = 1

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `dragonfly`
const GOOS = `dragonfly`
const GoosAndroid = 0
const GoosDarwin = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `freebsd`
const GOOS = `freebsd`
const GoosAndroid = 0
const GoosDarwin = 0

View File

@ -4,7 +4,7 @@
package sys
const TheGoos = `linux`
const GOOS = `linux`
const GoosAndroid = 0
const GoosDarwin = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `nacl`
const GOOS = `nacl`
const GoosAndroid = 0
const GoosDarwin = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `netbsd`
const GOOS = `netbsd`
const GoosAndroid = 0
const GoosDarwin = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `openbsd`
const GOOS = `openbsd`
const GoosAndroid = 0
const GoosDarwin = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `plan9`
const GOOS = `plan9`
const GoosAndroid = 0
const GoosDarwin = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `solaris`
const GOOS = `solaris`
const GoosAndroid = 0
const GoosDarwin = 0

View File

@ -2,7 +2,7 @@
package sys
const TheGoos = `windows`
const GOOS = `windows`
const GoosAndroid = 0
const GoosDarwin = 0

View File

@ -719,8 +719,8 @@ func scanframeworker(frame *stkframe, cache *pcvalueCache, gcw *gcWork) {
// Scan local variables if stack frame has been allocated.
size := frame.varp - frame.sp
var minsize uintptr
switch sys.TheChar {
case '7':
switch sys.ArchFamily {
case sys.ARM64:
minsize = sys.SpAlign
default:
minsize = sys.MinFrameSize

View File

@ -634,8 +634,8 @@ func adjustframe(frame *stkframe, arg unsafe.Pointer) bool {
// Adjust local variables if stack frame has been allocated.
size := frame.varp - frame.sp
var minsize uintptr
switch sys.TheChar {
case '7':
switch sys.ArchFamily {
case sys.ARM64:
minsize = sys.SpAlign
default:
minsize = sys.MinFrameSize
@ -662,7 +662,7 @@ func adjustframe(frame *stkframe, arg unsafe.Pointer) bool {
}
// 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 {
print("runtime: found space for saved base pointer, but no framepointer experiment\n")
print("argp=", hex(frame.argp), " varp=", hex(frame.varp), "\n")
@ -969,7 +969,7 @@ func newstack() {
throw("missing stack in newstack")
}
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.
sp -= sys.PtrSize
}