]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove remaining references to TheChar
authorJeremy Jackins <jeremyjackins@gmail.com>
Thu, 7 Apr 2016 06:42:35 +0000 (15:42 +0900)
committerMatthew Dempsky <mdempsky@google.com>
Mon, 11 Apr 2016 04:32:07 +0000 (04:32 +0000)
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>
37 files changed:
src/runtime/extern.go
src/runtime/heapdump.go
src/runtime/internal/sys/arch.go [new file with mode: 0644]
src/runtime/internal/sys/arch_386.go
src/runtime/internal/sys/arch_amd64.go
src/runtime/internal/sys/arch_amd64p32.go
src/runtime/internal/sys/arch_arm.go
src/runtime/internal/sys/arch_arm64.go
src/runtime/internal/sys/arch_mips64.go
src/runtime/internal/sys/arch_mips64le.go
src/runtime/internal/sys/arch_ppc64.go
src/runtime/internal/sys/arch_ppc64le.go
src/runtime/internal/sys/arch_s390x.go
src/runtime/internal/sys/gengoos.go
src/runtime/internal/sys/zgoarch_386.go
src/runtime/internal/sys/zgoarch_amd64.go
src/runtime/internal/sys/zgoarch_amd64p32.go
src/runtime/internal/sys/zgoarch_arm.go
src/runtime/internal/sys/zgoarch_arm64.go
src/runtime/internal/sys/zgoarch_mips64.go
src/runtime/internal/sys/zgoarch_mips64le.go
src/runtime/internal/sys/zgoarch_ppc64.go
src/runtime/internal/sys/zgoarch_ppc64le.go
src/runtime/internal/sys/zgoarch_s390x.go
src/runtime/internal/sys/zgoos_android.go
src/runtime/internal/sys/zgoos_darwin.go
src/runtime/internal/sys/zgoos_dragonfly.go
src/runtime/internal/sys/zgoos_freebsd.go
src/runtime/internal/sys/zgoos_linux.go
src/runtime/internal/sys/zgoos_nacl.go
src/runtime/internal/sys/zgoos_netbsd.go
src/runtime/internal/sys/zgoos_openbsd.go
src/runtime/internal/sys/zgoos_plan9.go
src/runtime/internal/sys/zgoos_solaris.go
src/runtime/internal/sys/zgoos_windows.go
src/runtime/mgcmark.go
src/runtime/stack.go

index 1d8304f4fc36fdf485c41cd32a0a84484ed3f50d..1df8691cfcfaaad9f9310b44de0008f7534d566d 100644 (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
index e6a41f7f97a2be9988e4990541cf706fdfe45620..2410b1954abeef6dce33d0fc8ab8dbd7f67fbd56 100644 (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))
 }
diff --git a/src/runtime/internal/sys/arch.go b/src/runtime/internal/sys/arch.go
new file mode 100644 (file)
index 0000000..c175704
--- /dev/null
@@ -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
+)
index 1f1c704f9aac873e541fcb240b8461b7669140b1..48c42f75845e7f30707f8df4533e230ddde2a494 100644 (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
index 80fff557f25559d2040c5ad083a633c7ad293276..1bbdb99e0720042040d8275ff212e2b4af516d06 100644 (file)
@@ -5,7 +5,7 @@
 package sys
 
 const (
-       TheChar       = '6'
+       ArchFamily    = AMD64
        BigEndian     = 0
        CacheLineSize = 64
        PhysPageSize  = 4096
index ca29f698a2369870415cfa76adba40398bcd1989..b7011a4ff2d6cd5d813ee2aa19af6003bf3f9a30 100644 (file)
@@ -5,7 +5,7 @@
 package sys
 
 const (
-       TheChar       = '6'
+       ArchFamily    = AMD64
        BigEndian     = 0
        CacheLineSize = 64
        PhysPageSize  = 65536*GoosNacl + 4096*(1-GoosNacl)
index b185e8fb698783c5d6055835771216ff3b790b96..f90f52da7f49a39c4f76b578cb5a3cc8d2a14139 100644 (file)
@@ -5,7 +5,7 @@
 package sys
 
 const (
-       TheChar       = '5'
+       ArchFamily    = ARM
        BigEndian     = 0
        CacheLineSize = 32
        PhysPageSize  = 65536*GoosNacl + 4096*(1-GoosNacl)
index b63a7a6f9a2ad554a8c3e0432b0adba65faa1745..aaaa4b0947c8045f7e2c822eea82c1f1e1a8fa1c 100644 (file)
@@ -5,7 +5,7 @@
 package sys
 
 const (
-       TheChar       = '7'
+       ArchFamily    = ARM64
        BigEndian     = 0
        CacheLineSize = 32
        PhysPageSize  = 65536
index 5b933d4e1a9db653f29df6eea93b4fbebdee9d0c..d5672599d2a6957e9cd6d3f6d8758f2225152093 100644 (file)
@@ -5,7 +5,7 @@
 package sys
 
 const (
-       TheChar       = '0'
+       ArchFamily    = MIPS64
        BigEndian     = 1
        CacheLineSize = 32
        PhysPageSize  = 16384
index ce2e98b19f083f687a8d33bc35f402142734bacc..f8cdf2b2d2fd74c4c69d08f44f8f84d9cab563e4 100644 (file)
@@ -5,7 +5,7 @@
 package sys
 
 const (
-       TheChar       = '0'
+       ArchFamily    = MIPS64
        BigEndian     = 0
        CacheLineSize = 32
        PhysPageSize  = 16384
index 3aa07e1f5648ab3af0f0f617a9106dd7dfd697ef..cdec63ff71125dd3a29662b9cab69a526df84da5 100644 (file)
@@ -5,7 +5,7 @@
 package sys
 
 const (
-       TheChar       = '9'
+       ArchFamily    = PPC64
        BigEndian     = 1
        CacheLineSize = 64
        PhysPageSize  = 65536
index 0f02f0bf3c4a3d80f82a636a79999edb955790b4..4fd68f9ce3aa66b239d318f19e5882e0c2844732 100644 (file)
@@ -5,7 +5,7 @@
 package sys
 
 const (
-       TheChar       = '9'
+       ArchFamily    = PPC64
        BigEndian     = 0
        CacheLineSize = 64
        PhysPageSize  = 65536
index 8690571c8157fbb2b16d7fd9420702204fb03ce9..ca1cb8646e4c3a734a05dde6f30e3e40620cd051 100644 (file)
@@ -5,7 +5,7 @@
 package sys
 
 const (
-       TheChar       = 'z'
+       ArchFamily    = S390X
        BigEndian     = 1
        CacheLineSize = 256
        PhysPageSize  = 4096
index e2bd87de4e4ab148be9470e2b04e09ae30264af6..4c45c0af028775d07c202ac96789b74b2b4ea824 100644 (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 {
index 3ad244509da4e6cb45eee6917e68d9ee93405a5d..3bcf83b8e3f1d393461bfdd4c115c14fefd34def 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `386`
+const GOARCH = `386`
 
 const Goarch386 = 1
 const GoarchAmd64 = 0
index 7c858e3f5d4d9f964e06cdeff16d46f4eb47bc81..699f191fba41626ed1d8472bd17fba1ef3b54e28 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `amd64`
+const GOARCH = `amd64`
 
 const Goarch386 = 0
 const GoarchAmd64 = 1
index 772031c0902ce942f2a28cc82e298df2615b9bfd..cc2d658406c14ce9a2fcb92fb01796e2e95da6f3 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `amd64p32`
+const GOARCH = `amd64p32`
 
 const Goarch386 = 0
 const GoarchAmd64 = 0
index 276e8a869b409f1b2d8dd38ee41a01f242e31a0b..a5fd789f1369c6b1ce4ce5fef5e08c4aad32ae27 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `arm`
+const GOARCH = `arm`
 
 const Goarch386 = 0
 const GoarchAmd64 = 0
index d124ec0343a71d6f160d39af613e01e94540d9f7..084d2c73303f71a542146023b8b9edc25a567767 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `arm64`
+const GOARCH = `arm64`
 
 const Goarch386 = 0
 const GoarchAmd64 = 0
index b4a97d6da9a07adb4940697ae45b52cf511933ad..2ad62bd68ceff3f30635c9b0249573be1d2ddd3e 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `mips64`
+const GOARCH = `mips64`
 
 const Goarch386 = 0
 const GoarchAmd64 = 0
index 3328a35bd29d5e50387e3077a51dfddec0829301..047c8b425a35aeb7354c4a06a8e7db2f22069226 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `mips64le`
+const GOARCH = `mips64le`
 
 const Goarch386 = 0
 const GoarchAmd64 = 0
index 06f78b2023fd279cfa88d9c129b151a66e06d51d..748b5b562c40476fdaae90a4b6014bed7482cdfc 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `ppc64`
+const GOARCH = `ppc64`
 
 const Goarch386 = 0
 const GoarchAmd64 = 0
index 50b56dbe3f7b2ebe78c28969585b1b01a97b6e9f..d3dcba467d1bdb57da0bf5a18e9a6c4eff14fbbe 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `ppc64le`
+const GOARCH = `ppc64le`
 
 const Goarch386 = 0
 const GoarchAmd64 = 0
index ce85f20e0a88600cdd6f937f467da1ab4f18f1ce..1ead5d573c9dbb801dae9df14a9d54f5c0465752 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoarch = `s390x`
+const GOARCH = `s390x`
 
 const Goarch386 = 0
 const GoarchAmd64 = 0
index 03d91760ed0089053ac9af7929090512f358486b..6503b15246bcd89652f506f56e39fa1e456007e8 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `android`
+const GOOS = `android`
 
 const GoosAndroid = 1
 const GoosDarwin = 0
index eb2efeb7af8c0fe4d5a26bf516186caabe2521f3..6a285984bd07844364227a43b9bfdf489a8ae1b7 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `darwin`
+const GOOS = `darwin`
 
 const GoosAndroid = 0
 const GoosDarwin = 1
index 403cf6531105ea75c3197703de02013d0f7f202d..886ac2698f5711f88fabd3c9734ed4167a5846c0 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `dragonfly`
+const GOOS = `dragonfly`
 
 const GoosAndroid = 0
 const GoosDarwin = 0
index 632d5db9dbdf3533eff6f79efae455333dcf412c..0bf2403eab8cb005d500f9b6eeabe6ae3ebbf45a 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `freebsd`
+const GOOS = `freebsd`
 
 const GoosAndroid = 0
 const GoosDarwin = 0
index 2d43869a84a6e6aec92568a2d3c04a23b9987f47..c8664db15d6c8540909fcec631bd580d11e42cb0 100644 (file)
@@ -4,7 +4,7 @@
 
 package sys
 
-const TheGoos = `linux`
+const GOOS = `linux`
 
 const GoosAndroid = 0
 const GoosDarwin = 0
index a56b6ef3c9598aac7de5d577b2d736c81a96a87e..054122638aa333df18f0dee06bcc3d4cdf243565 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `nacl`
+const GOOS = `nacl`
 
 const GoosAndroid = 0
 const GoosDarwin = 0
index 46fd0a7cd5d76f86fe08adb05888b5184d8c2a04..5c509a12504f85c8e3ae9bb817730f7e9ebf9dc1 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `netbsd`
+const GOOS = `netbsd`
 
 const GoosAndroid = 0
 const GoosDarwin = 0
index 7ee650afbb0d221cf0be8237f1d31518531dfa1f..dc43157d49c214fabe98269f0eaff09e457d8acc 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `openbsd`
+const GOOS = `openbsd`
 
 const GoosAndroid = 0
 const GoosDarwin = 0
index 162e7f62603c2966cfaafdb3d6aa4efa8d233d9f..4b0934f77ae5781ff2e1906191d5ae5fec78848b 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `plan9`
+const GOOS = `plan9`
 
 const GoosAndroid = 0
 const GoosDarwin = 0
index b2a8f98504b02da2f5c6a81ef0fd9cd01a933027..42511a36ad7f12448ff166f3bb30d875b18b42f8 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `solaris`
+const GOOS = `solaris`
 
 const GoosAndroid = 0
 const GoosDarwin = 0
index 817ec79e4c189f67d4ad43e533224697d486f2dc..d77f62c39641dfbac76f85cdf87edf9a0ab4090c 100644 (file)
@@ -2,7 +2,7 @@
 
 package sys
 
-const TheGoos = `windows`
+const GOOS = `windows`
 
 const GoosAndroid = 0
 const GoosDarwin = 0
index 66d61bae1e81e71d4a145d531f3fd6c03f09062c..1ab8315a29fa0e7d57acb6d5d8d79a443dd34f2f 100644 (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
index fdd6710bad81da29d4013ed2628214add4958523..dcb1b06dbd5a9aeb917c17310ecdfdde04cbeb5d 100644 (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
        }