]> Cypherpunks repositories - gostls13.git/commitdiff
runtime,reflect,cmd/internal/gc: Fix comments referring to .c/.h files
authorKeith Randall <khr@golang.org>
Wed, 11 Mar 2015 19:58:47 +0000 (12:58 -0700)
committerKeith Randall <khr@golang.org>
Wed, 11 Mar 2015 20:19:43 +0000 (20:19 +0000)
Everything has moved to Go, but comments still refer to .c/.h files.
Fix all of those up, at least for these three directories.

Fixes #10138

Change-Id: Ie5efe89b247841e0b3f82aac5256b2c606ef67dc
Reviewed-on: https://go-review.googlesource.com/7431
Reviewed-by: Russ Cox <rsc@golang.org>
28 files changed:
src/cmd/internal/gc/cplx.go
src/cmd/internal/gc/gsubr.go
src/cmd/internal/gc/obj.go
src/cmd/internal/gc/pgen.go
src/cmd/internal/gc/popt.go
src/cmd/internal/gc/racewalk.go
src/cmd/internal/gc/range.go
src/cmd/internal/gc/reflect.go
src/cmd/internal/gc/select.go
src/cmd/internal/gc/walk.go
src/reflect/type.go
src/reflect/value.go
src/runtime/cgocallback.go
src/runtime/chan_test.go
src/runtime/hashmap.go
src/runtime/malloc.go
src/runtime/mcentral.go
src/runtime/mfixalloc.go
src/runtime/mgcmark.go
src/runtime/mheap.go
src/runtime/msize.go
src/runtime/mstats.go
src/runtime/os1_freebsd.go
src/runtime/rune.go
src/runtime/runtime1.go
src/runtime/runtime2.go
src/runtime/select.go
src/runtime/type.go

index 5351d2b0c365c3ee4c42227f9c85e554f05f75f3..00975713901d108394dc61c66d7a1e6a9d9f144d 100644 (file)
@@ -238,9 +238,6 @@ func nodfconst(n *Node, t *Type, fval *Mpflt) {
        }
 }
 
-/*
- * cplx.c
- */
 func Complexop(n *Node, res *Node) bool {
        if n != nil && n.Type != nil {
                if Iscomplex[n.Type.Etype] {
index 44e0d22a8705e98f5c9793ada1985066537ef385..8540b920b55b6a2b341965a0a5a64d1f90b3eb04 100644 (file)
@@ -76,9 +76,6 @@ func Samereg(a *Node, b *Node) bool {
        return true
 }
 
-/*
- * gsubr.c
- */
 func Gbranch(as int, t *Type, likely int) *obj.Prog {
        p := Prog(as)
        p.To.Type = obj.TYPE_BRANCH
index cb5b9148030db7e90bf71d92e544e2493a2e23cf..d59898f28611556dc7af9efcc94702da9d1cbdea 100644 (file)
@@ -294,9 +294,6 @@ func dstringptr(s *Sym, off int, str string) int {
        return off
 }
 
-/*
- * gobj.c
- */
 func Datastring(s string, a *obj.Addr) {
        sym := stringsym(s)
        a.Type = obj.TYPE_MEM
index 81b02e1e1b0b0dbe26802600e944b3afe7677257..208ecb80ff0cc1bdb42b9d6569e5a7dc7ce5249f 100644 (file)
@@ -12,10 +12,6 @@ import (
 )
 
 // "Portable" code generation.
-// Compiled separately for 5g, 6g, and 8g, so allowed to use gg.h, opt.h.
-// Must code to the intersection of the three back ends.
-
-//#include     "opt.h"
 
 var makefuncdatasym_nsym int32
 
@@ -350,9 +346,6 @@ func Cgen_checknil(n *Node) {
        Thearch.Gins(obj.ACHECKNIL, n, nil)
 }
 
-/*
- * ggen.c
- */
 func compile(fn *Node) {
        if Newproc == nil {
                Newproc = Sysfunc("newproc")
index 46f844e08cd5dac5cc049ef2e428e5de8df8aa9d..d4cb4b676aecd92a7aa1a24dc64b5fc6e700f3fe 100644 (file)
@@ -38,8 +38,6 @@ import (
 )
 
 // "Portable" optimizations.
-// Compiled separately for 5g, 6g, and 8g, so allowed to use gg.h, opt.h.
-// Must code to the intersection of the three back ends.
 
 // Derived from Inferno utils/6c/gc.h
 // http://code.google.com/p/inferno-os/source/browse/utils/6c/gc.h
@@ -168,26 +166,9 @@ type OptStats struct {
 
 var Ostats OptStats
 
-/*
- * reg.c
- */
-
-/*
- * peep.c
-void   peep(Prog*);
-void   excise(Flow*);
-int    copyu(Prog*, Adr*, Adr*);
-*/
-
-/*
- * prog.c
-
-void proginfo(ProgInfo*, Prog*);
-*/
-// p is a call instruction. Does the call fail to return?
-
 var noreturn_symlist [10]*Sym
 
+// p is a call instruction. Does the call fail to return?
 func Noreturn(p *obj.Prog) bool {
        if noreturn_symlist[0] == nil {
                noreturn_symlist[0] = Pkglookup("panicindex", Runtimepkg)
index 3fd2c268f3712fa2b0bf8fc76b7e34f12907c65a..2b3fc306f9b8fbc35ff21301dd8b2b125b9a908e 100644 (file)
@@ -629,7 +629,7 @@ func hascallspred(n *Node, c interface{}) {
        }
 }
 
-// appendinit is like addinit in subr.c
+// appendinit is like addinit in subr.go
 // but appends rather than prepends.
 func appendinit(np **Node, init *NodeList) {
        if init == nil {
index 8dbb002b24fb31bb92df889073c1f933fa68d0c9..ca901d2bb34d6e6e1e07a1ce1192b371ebf36725 100644 (file)
@@ -306,7 +306,7 @@ func walkrange(n *Node) {
                hit := n.Alloc
                hit.Type = th
                n.Left = nil
-               keyname := newname(th.Type.Sym)      // depends on layout of iterator struct.  See reflect.c:hiter
+               keyname := newname(th.Type.Sym)      // depends on layout of iterator struct.  See reflect.go:hiter
                valname := newname(th.Type.Down.Sym) // ditto
 
                fn := syslook("mapiterinit", 1)
index 19694ad3d876e6f177a1073c878e3bae0324c7a9..60d6ea510fa68ac72be1def802c73546d1184952 100644 (file)
@@ -107,7 +107,7 @@ func lsort(l *Sig, f func(*Sig, *Sig) int) *Sig {
 // the given map type.  This type is not visible to users -
 // we include only enough information to generate a correct GC
 // program for it.
-// Make sure this stays in sync with ../../runtime/hashmap.c!
+// Make sure this stays in sync with ../../runtime/hashmap.go!
 const (
        BUCKETSIZE = 8
        MAXKEYSIZE = 128
@@ -236,7 +236,7 @@ func hiter(t *Type) *Type {
        //    bucket uintptr
        //    checkBucket uintptr
        // }
-       // must match ../../runtime/hashmap.c:hash_iter.
+       // must match ../../runtime/hashmap.go:hash_iter.
        var field [12]*Type
        field[0] = makefield("key", Ptrto(t.Down))
 
index 5816428debc2390a41f2ef21a724dca62df82998..e3c92947bc8f8e842c20e4c41b6ed493fcecd0af 100644 (file)
@@ -324,7 +324,7 @@ out:
        lineno = int32(lno)
 }
 
-// Keep in sync with src/runtime/chan.h.
+// Keep in sync with src/runtime/runtime2.go and src/runtime/select.go.
 func selecttype(size int32) *Type {
        // TODO(dvyukov): it's possible to generate SudoG and Scase only once
        // and then cache; and also cache Select per size.
index af45015ccb3e82a3d2e3b6026a3ec923e937932e..e88b4c28b09cc70bdb33d3fbf8a96abd122a5d46 100644 (file)
@@ -2636,7 +2636,7 @@ func vmatch2(l *Node, r *Node) bool {
 
 /*
  * is any name mentioned in l also mentioned in r?
- * called by sinit.c
+ * called by sinit.go
  */
 func vmatch1(l *Node, r *Node) bool {
        /*
index 1752dddd8d91f7d9a100ab5c34eb4dfdca70f791..bf1148fd07237059904daed6aaae1e0bcc0b8bde 100644 (file)
@@ -201,9 +201,9 @@ type Type interface {
 // See golang.org/issue/4876 for more details.
 
 /*
- * These data structures are known to the compiler (../../cmd/gc/reflect.c).
+ * These data structures are known to the compiler (../../cmd/internal/gc/reflect.go).
  * A few are known to ../runtime/type.go to convey to debuggers.
- * They are also known to ../runtime/type.h.
+ * They are also known to ../runtime/type.go.
  */
 
 // A Kind represents the specific kind of type that a Type represents.
@@ -1143,7 +1143,7 @@ func implements(T, V *rtype) bool {
        // methods along the way, or else V does not implement T.
        // This lets us run the scan in overall linear time instead of
        // the quadratic time  a naive search would require.
-       // See also ../runtime/iface.c.
+       // See also ../runtime/iface.go.
        if V.Kind() == Interface {
                v := (*interfaceType)(unsafe.Pointer(V))
                i := 0
@@ -1637,13 +1637,10 @@ func (gc *gcProg) align(a uintptr) {
        gc.size = align(gc.size, a)
 }
 
-// These constants must stay in sync with ../runtime/mgc0.h.
+// These constants must stay in sync with ../runtime/mbitmap.go.
 const (
        bitsScalar  = 1
        bitsPointer = 2
-
-       bitsIface = 2
-       bitsEface = 3
 )
 
 // Make sure these routines stay in sync with ../../runtime/hashmap.go!
index ad48152730435c8613f8727dad7a677c4a579cea..ad106f53dd97adc0ddb3ac52fad7ae4c76ca8ba0 100644 (file)
@@ -176,7 +176,7 @@ type emptyInterface struct {
 
 // nonEmptyInterface is the header for a interface value with methods.
 type nonEmptyInterface struct {
-       // see ../runtime/iface.c:/Itab
+       // see ../runtime/iface.go:/Itab
        itab *struct {
                ityp   *rtype // static interface type
                typ    *rtype // dynamic concrete type
index 2c89143208ae05c862e18afd8a6e8a729d898cd6..20ce87d4ca35145fe6bfe019a16ec14b3d78a18b 100644 (file)
@@ -6,7 +6,7 @@ package runtime
 
 import "unsafe"
 
-// These functions are called from C code via cgo/callbacks.c.
+// These functions are called from C code via cgo/callbacks.go.
 
 // Allocate memory.  This allocates the requested number of bytes in
 // memory controlled by the Go runtime.  The allocated memory will be
index 8a357c1f2330ddfa3f3a6a2cd32dac044a93a43d..66dfd6f8d873e7c78c773f26560f38ae63e4f4b9 100644 (file)
@@ -453,7 +453,7 @@ func TestMultiConsumer(t *testing.T) {
 func TestShrinkStackDuringBlockedSend(t *testing.T) {
        // make sure that channel operations still work when we are
        // blocked on a channel send and we shrink the stack.
-       // NOTE: this test probably won't fail unless stack.c:StackDebug
+       // NOTE: this test probably won't fail unless stack1.go:StackDebug
        // is set to >= 1.
        const n = 10
        c := make(chan int)
index ca049dd6320a7a3b01d7ff54d6709de1b73c30d1..aaaef483811acf5ae7a6e022d38a9470af63248e 100644 (file)
@@ -68,7 +68,7 @@ const (
        // Maximum key or value size to keep inline (instead of mallocing per element).
        // Must fit in a uint8.
        // Fast versions cannot handle big values - the cutoff size for
-       // fast versions in ../../cmd/gc/walk.c must be at most this value.
+       // fast versions in ../../cmd/internal/gc/walk.go must be at most this value.
        maxKeySize   = 128
        maxValueSize = 128
 
@@ -103,7 +103,7 @@ const (
 
 // A header for a Go map.
 type hmap struct {
-       // Note: the format of the Hmap is encoded in ../../cmd/gc/reflect.c and
+       // Note: the format of the Hmap is encoded in ../../cmd/internal/gc/reflect.go and
        // ../reflect/type.go.  Don't change this structure without also changing that code!
        count int // # live cells == size of map.  Must be first (used by len() builtin)
        flags uint8
@@ -137,11 +137,11 @@ type bmap struct {
 }
 
 // A hash iteration structure.
-// If you modify hiter, also change cmd/gc/reflect.c to indicate
+// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate
 // the layout of this structure.
 type hiter struct {
-       key         unsafe.Pointer // Must be in first position.  Write nil to indicate iteration end (see cmd/gc/range.c).
-       value       unsafe.Pointer // Must be in second position (see cmd/gc/range.c).
+       key         unsafe.Pointer // Must be in first position.  Write nil to indicate iteration end (see cmd/internal/gc/range.go).
+       value       unsafe.Pointer // Must be in second position (see cmd/internal/gc/range.go).
        t           *maptype
        h           *hmap
        buckets     unsafe.Pointer // bucket ptr at hash_iter initialization time
@@ -597,7 +597,7 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
        }
 
        if unsafe.Sizeof(hiter{})/ptrSize != 12 {
-               throw("hash_iter size incorrect") // see ../../cmd/gc/reflect.c
+               throw("hash_iter size incorrect") // see ../../cmd/internal/gc/reflect.go
        }
        it.t = t
        it.h = h
index 87ccc13df9b1e3a2e5c272680fbce6eb37c2e1d4..c33456258f2e7a30c46be0ec2b61dcb83a188732 100644 (file)
@@ -114,7 +114,7 @@ const (
        _64bit = 1 << (^uintptr(0) >> 63) / 2
 
        // Computed constant.  The definition of MaxSmallSize and the
-       // algorithm in msize.c produce some number of different allocation
+       // algorithm in msize.go produces some number of different allocation
        // size classes.  NumSizeClasses is that number.  It's needed here
        // because there are static arrays of this length; when msize runs its
        // size choosing algorithm it double-checks that NumSizeClasses agrees.
index a6dbe45ba17f60762eeabc405104332f09680786..8aab903ab942abe943da4d0d7f6964c4e727c30c 100644 (file)
@@ -4,7 +4,7 @@
 
 // Central free lists.
 //
-// See malloc.h for an overview.
+// See malloc.go for an overview.
 //
 // The MCentral doesn't actually contain the list of free objects; the MSpan does.
 // Each MCentral is two lists of MSpans: those with free objects (c->nonempty)
index c1106b6281823a70b7f2f7470b7b0d4df0556ebb..bb2f4e7e24534da4cd6dff57bad520758bb0a3e8 100644 (file)
@@ -4,7 +4,7 @@
 
 // Fixed-size object allocator.  Returned memory is not zeroed.
 //
-// See malloc.h for overview.
+// See malloc.go for overview.
 
 package runtime
 
index 3276ab834446a5e33492120b95ff8c59e4ac868c..b17be9287577c9e4f31e2da2a5853d1db3437696 100644 (file)
@@ -58,7 +58,7 @@ func markroot(desc *parfor, i uint32) {
        var gcw gcWorkProducer
        gcw.initFromCache()
 
-       // Note: if you add a case here, please also update heapdump.c:dumproots.
+       // Note: if you add a case here, please also update heapdump.go:dumproots.
        switch i {
        case _RootData:
                scanblock(uintptr(unsafe.Pointer(&data)), uintptr(unsafe.Pointer(&edata))-uintptr(unsafe.Pointer(&data)), gcdatamask.bytedata, &gcw)
index fc4dfeea975c6016eba34fa31d5776fa7665d0da..e94b79fb8f49366fde491af6cb366e9f7246aeab 100644 (file)
@@ -158,7 +158,7 @@ func recordspan(vh unsafe.Pointer, p unsafe.Pointer) {
                if len(h_allspans) > 0 {
                        copy(new, h_allspans)
                        // Don't free the old array if it's referenced by sweep.
-                       // See the comment in mgc0.c.
+                       // See the comment in mgc.go.
                        if h.allspans != mheap_.gcspans {
                                sysFree(unsafe.Pointer(h.allspans), uintptr(cap(h_allspans))*ptrSize, &memstats.other_sys)
                        }
index f2a7cb9dddf0ce9d84b95b3edd686ab1975a2632..9ba145dbf6fe778689b023835fa71124817823f7 100644 (file)
@@ -4,7 +4,7 @@
 
 // Malloc small size classes.
 //
-// See malloc.h for overview.
+// See malloc.go for overview.
 //
 // The size classes are chosen so that rounding an allocation
 // request up to the next size class wastes at most 12.5% (1.125x).
index 19b6833a32a22937220d3ec9ad8c9648dc23d7e1..88cf42fe415d8eda1311046c05113f57e2eb90b0 100644 (file)
@@ -64,9 +64,6 @@ type mstats struct {
 
 var memstats mstats
 
-// Note: the MemStats struct should be kept in sync with
-// struct MStats in malloc.h
-
 // A MemStats records statistics about the memory allocator.
 type MemStats struct {
        // General statistics.
index f49f28edfffb7c751a3dfdab724842d43255be2c..ae9f78c27b304788bb935c58e8859ac221e6fce3 100644 (file)
@@ -28,7 +28,7 @@ func getncpu() int32 {
 
 // FreeBSD's umtx_op syscall is effectively the same as Linux's futex, and
 // thus the code is largely similar. See Linux implementation
-// and lock_futex.c for comments.
+// and lock_futex.go for comments.
 
 //go:nosplit
 func futexsleep(addr *uint32, val uint32, ns int64) {
index a9f6835818d22d53142bfca868dc97ef7fd330e2..99c38e0bd91b7ab96d96b788400bf21833fe99cd 100644 (file)
@@ -15,7 +15,7 @@
 
 /*
  * This code is copied, with slight editing due to type differences,
- * from a subset of ../lib9/utf/rune.c
+ * from a subset of ../lib9/utf/rune.c [which no longer exists]
  */
 
 package runtime
index f0d26c8edcea8cb08403d4a583b000274570b421..ae30adb2fc13c2716d5d4c74f56a7023c7198ee9 100644 (file)
@@ -435,7 +435,7 @@ func reflect_typelinks() []*_type {
        return ret
 }
 
-// TODO: move back into mgc0.c when converted to Go
+// TODO: move back into mgc.go
 func readgogc() int32 {
        p := gogetenv("GOGC")
        if p == "" {
index abd12544ae70194b053f50e3dd6b552ff5899f51..13c5dee078172921e3743609d2749ec1f54691f6 100644 (file)
@@ -14,7 +14,7 @@ const (
        //
        // If you add to this list, add to the list
        // of "okay during garbage collection" status
-       // in mgc0.c too.
+       // in mgcmark.go too.
        _Gidle            = iota // 0
        _Grunnable               // 1 runnable and on a run queue
        _Grunning                // 2
@@ -129,7 +129,7 @@ type gobuf struct {
 }
 
 // Known to compiler.
-// Changes here must also be made in src/cmd/gc/select.c's selecttype.
+// Changes here must also be made in src/cmd/internal/gc/select.go's selecttype.
 type sudog struct {
        g           *g
        selectdone  *uint32
@@ -316,7 +316,7 @@ type p struct {
        m           *m     // back-link to associated m (nil if idle)
        mcache      *mcache
 
-       deferpool    [5][]*_defer // pool of available defer structs of different sizes (see panic.c)
+       deferpool    [5][]*_defer // pool of available defer structs of different sizes (see panic.go)
        deferpoolbuf [5][32]*_defer
 
        // Cache of goroutine ids, amortizes accesses to runtime·sched.goidgen.
@@ -420,7 +420,7 @@ const (
 
 // Layout of in-memory per-function information prepared by linker
 // See http://golang.org/s/go12symtab.
-// Keep in sync with linker and with ../../libmach/sym.c
+// Keep in sync with linker
 // and with package debug/gosym and with symtab.go in package runtime.
 type _func struct {
        entry   uintptr // start pc
index 8a4ff681970b945457eff97c3d1fbbe5e10b6c78..73fcb439f1d1a253f8a69e21cbbbfed534b74ea4 100644 (file)
@@ -371,7 +371,7 @@ loop:
                c = cas.c
                sg := acquireSudog()
                sg.g = gp
-               // Note: selectdone is adjusted for stack copies in stack.c:adjustsudogs
+               // Note: selectdone is adjusted for stack copies in stack1.go:adjustsudogs
                sg.selectdone = (*uint32)(noescape(unsafe.Pointer(&done)))
                sg.elem = cas.elem
                sg.releasetime = 0
index 64d7c300566d0101fc8c7b8ea21c3bcca568c1af..70ed24cd8701a0bf4398b16c22876c84b6bb7133 100644 (file)
@@ -8,7 +8,7 @@ package runtime
 
 import "unsafe"
 
-// Needs to be in sync with ../../cmd/ld/decodesym.c:/^commonsize and pkg/reflect/type.go:/type.
+// Needs to be in sync with ../../cmd/internal/ld/decodesym.go:/^commonsize and pkg/reflect/type.go:/type.
 type _type struct {
        size       uintptr
        hash       uint32