Commit cd5b144d authored by Keith Randall's avatar Keith Randall

runtime,reflect,cmd/internal/gc: Fix comments referring to .c/.h files

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/7431Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent 4b981ed3
...@@ -238,9 +238,6 @@ func nodfconst(n *Node, t *Type, fval *Mpflt) { ...@@ -238,9 +238,6 @@ func nodfconst(n *Node, t *Type, fval *Mpflt) {
} }
} }
/*
* cplx.c
*/
func Complexop(n *Node, res *Node) bool { func Complexop(n *Node, res *Node) bool {
if n != nil && n.Type != nil { if n != nil && n.Type != nil {
if Iscomplex[n.Type.Etype] { if Iscomplex[n.Type.Etype] {
......
...@@ -76,9 +76,6 @@ func Samereg(a *Node, b *Node) bool { ...@@ -76,9 +76,6 @@ func Samereg(a *Node, b *Node) bool {
return true return true
} }
/*
* gsubr.c
*/
func Gbranch(as int, t *Type, likely int) *obj.Prog { func Gbranch(as int, t *Type, likely int) *obj.Prog {
p := Prog(as) p := Prog(as)
p.To.Type = obj.TYPE_BRANCH p.To.Type = obj.TYPE_BRANCH
......
...@@ -294,9 +294,6 @@ func dstringptr(s *Sym, off int, str string) int { ...@@ -294,9 +294,6 @@ func dstringptr(s *Sym, off int, str string) int {
return off return off
} }
/*
* gobj.c
*/
func Datastring(s string, a *obj.Addr) { func Datastring(s string, a *obj.Addr) {
sym := stringsym(s) sym := stringsym(s)
a.Type = obj.TYPE_MEM a.Type = obj.TYPE_MEM
......
...@@ -12,10 +12,6 @@ import ( ...@@ -12,10 +12,6 @@ import (
) )
// "Portable" code generation. // "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 var makefuncdatasym_nsym int32
...@@ -350,9 +346,6 @@ func Cgen_checknil(n *Node) { ...@@ -350,9 +346,6 @@ func Cgen_checknil(n *Node) {
Thearch.Gins(obj.ACHECKNIL, n, nil) Thearch.Gins(obj.ACHECKNIL, n, nil)
} }
/*
* ggen.c
*/
func compile(fn *Node) { func compile(fn *Node) {
if Newproc == nil { if Newproc == nil {
Newproc = Sysfunc("newproc") Newproc = Sysfunc("newproc")
......
...@@ -38,8 +38,6 @@ import ( ...@@ -38,8 +38,6 @@ import (
) )
// "Portable" optimizations. // "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 // Derived from Inferno utils/6c/gc.h
// http://code.google.com/p/inferno-os/source/browse/utils/6c/gc.h // http://code.google.com/p/inferno-os/source/browse/utils/6c/gc.h
...@@ -168,26 +166,9 @@ type OptStats struct { ...@@ -168,26 +166,9 @@ type OptStats struct {
var Ostats OptStats 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 var noreturn_symlist [10]*Sym
// p is a call instruction. Does the call fail to return?
func Noreturn(p *obj.Prog) bool { func Noreturn(p *obj.Prog) bool {
if noreturn_symlist[0] == nil { if noreturn_symlist[0] == nil {
noreturn_symlist[0] = Pkglookup("panicindex", Runtimepkg) noreturn_symlist[0] = Pkglookup("panicindex", Runtimepkg)
......
...@@ -629,7 +629,7 @@ func hascallspred(n *Node, c interface{}) { ...@@ -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. // but appends rather than prepends.
func appendinit(np **Node, init *NodeList) { func appendinit(np **Node, init *NodeList) {
if init == nil { if init == nil {
......
...@@ -306,7 +306,7 @@ func walkrange(n *Node) { ...@@ -306,7 +306,7 @@ func walkrange(n *Node) {
hit := n.Alloc hit := n.Alloc
hit.Type = th hit.Type = th
n.Left = nil 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 valname := newname(th.Type.Down.Sym) // ditto
fn := syslook("mapiterinit", 1) fn := syslook("mapiterinit", 1)
......
...@@ -107,7 +107,7 @@ func lsort(l *Sig, f func(*Sig, *Sig) int) *Sig { ...@@ -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 - // the given map type. This type is not visible to users -
// we include only enough information to generate a correct GC // we include only enough information to generate a correct GC
// program for it. // program for it.
// Make sure this stays in sync with ../../runtime/hashmap.c! // Make sure this stays in sync with ../../runtime/hashmap.go!
const ( const (
BUCKETSIZE = 8 BUCKETSIZE = 8
MAXKEYSIZE = 128 MAXKEYSIZE = 128
...@@ -236,7 +236,7 @@ func hiter(t *Type) *Type { ...@@ -236,7 +236,7 @@ func hiter(t *Type) *Type {
// bucket uintptr // bucket uintptr
// checkBucket uintptr // checkBucket uintptr
// } // }
// must match ../../runtime/hashmap.c:hash_iter. // must match ../../runtime/hashmap.go:hash_iter.
var field [12]*Type var field [12]*Type
field[0] = makefield("key", Ptrto(t.Down)) field[0] = makefield("key", Ptrto(t.Down))
......
...@@ -324,7 +324,7 @@ out: ...@@ -324,7 +324,7 @@ out:
lineno = int32(lno) 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 { func selecttype(size int32) *Type {
// TODO(dvyukov): it's possible to generate SudoG and Scase only once // TODO(dvyukov): it's possible to generate SudoG and Scase only once
// and then cache; and also cache Select per size. // and then cache; and also cache Select per size.
......
...@@ -2636,7 +2636,7 @@ func vmatch2(l *Node, r *Node) bool { ...@@ -2636,7 +2636,7 @@ func vmatch2(l *Node, r *Node) bool {
/* /*
* is any name mentioned in l also mentioned in r? * 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 { func vmatch1(l *Node, r *Node) bool {
/* /*
......
...@@ -201,9 +201,9 @@ type Type interface { ...@@ -201,9 +201,9 @@ type Type interface {
// See golang.org/issue/4876 for more details. // 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. * 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. // A Kind represents the specific kind of type that a Type represents.
...@@ -1143,7 +1143,7 @@ func implements(T, V *rtype) bool { ...@@ -1143,7 +1143,7 @@ func implements(T, V *rtype) bool {
// methods along the way, or else V does not implement T. // methods along the way, or else V does not implement T.
// This lets us run the scan in overall linear time instead of // This lets us run the scan in overall linear time instead of
// the quadratic time a naive search would require. // the quadratic time a naive search would require.
// See also ../runtime/iface.c. // See also ../runtime/iface.go.
if V.Kind() == Interface { if V.Kind() == Interface {
v := (*interfaceType)(unsafe.Pointer(V)) v := (*interfaceType)(unsafe.Pointer(V))
i := 0 i := 0
...@@ -1637,13 +1637,10 @@ func (gc *gcProg) align(a uintptr) { ...@@ -1637,13 +1637,10 @@ func (gc *gcProg) align(a uintptr) {
gc.size = align(gc.size, a) 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 ( const (
bitsScalar = 1 bitsScalar = 1
bitsPointer = 2 bitsPointer = 2
bitsIface = 2
bitsEface = 3
) )
// Make sure these routines stay in sync with ../../runtime/hashmap.go! // Make sure these routines stay in sync with ../../runtime/hashmap.go!
......
...@@ -176,7 +176,7 @@ type emptyInterface struct { ...@@ -176,7 +176,7 @@ type emptyInterface struct {
// nonEmptyInterface is the header for a interface value with methods. // nonEmptyInterface is the header for a interface value with methods.
type nonEmptyInterface struct { type nonEmptyInterface struct {
// see ../runtime/iface.c:/Itab // see ../runtime/iface.go:/Itab
itab *struct { itab *struct {
ityp *rtype // static interface type ityp *rtype // static interface type
typ *rtype // dynamic concrete type typ *rtype // dynamic concrete type
......
...@@ -6,7 +6,7 @@ package runtime ...@@ -6,7 +6,7 @@ package runtime
import "unsafe" 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 // Allocate memory. This allocates the requested number of bytes in
// memory controlled by the Go runtime. The allocated memory will be // memory controlled by the Go runtime. The allocated memory will be
......
...@@ -453,7 +453,7 @@ func TestMultiConsumer(t *testing.T) { ...@@ -453,7 +453,7 @@ func TestMultiConsumer(t *testing.T) {
func TestShrinkStackDuringBlockedSend(t *testing.T) { func TestShrinkStackDuringBlockedSend(t *testing.T) {
// make sure that channel operations still work when we are // make sure that channel operations still work when we are
// blocked on a channel send and we shrink the stack. // 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. // is set to >= 1.
const n = 10 const n = 10
c := make(chan int) c := make(chan int)
......
...@@ -68,7 +68,7 @@ const ( ...@@ -68,7 +68,7 @@ const (
// Maximum key or value size to keep inline (instead of mallocing per element). // Maximum key or value size to keep inline (instead of mallocing per element).
// Must fit in a uint8. // Must fit in a uint8.
// Fast versions cannot handle big values - the cutoff size for // 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 maxKeySize = 128
maxValueSize = 128 maxValueSize = 128
...@@ -103,7 +103,7 @@ const ( ...@@ -103,7 +103,7 @@ const (
// A header for a Go map. // A header for a Go map.
type hmap struct { 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! // ../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) count int // # live cells == size of map. Must be first (used by len() builtin)
flags uint8 flags uint8
...@@ -137,11 +137,11 @@ type bmap struct { ...@@ -137,11 +137,11 @@ type bmap struct {
} }
// A hash iteration structure. // 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. // the layout of this structure.
type hiter struct { type hiter struct {
key unsafe.Pointer // Must be in first position. Write nil to indicate iteration end (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/gc/range.c). value unsafe.Pointer // Must be in second position (see cmd/internal/gc/range.go).
t *maptype t *maptype
h *hmap h *hmap
buckets unsafe.Pointer // bucket ptr at hash_iter initialization time buckets unsafe.Pointer // bucket ptr at hash_iter initialization time
...@@ -597,7 +597,7 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) { ...@@ -597,7 +597,7 @@ func mapiterinit(t *maptype, h *hmap, it *hiter) {
} }
if unsafe.Sizeof(hiter{})/ptrSize != 12 { 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.t = t
it.h = h it.h = h
......
...@@ -114,7 +114,7 @@ const ( ...@@ -114,7 +114,7 @@ const (
_64bit = 1 << (^uintptr(0) >> 63) / 2 _64bit = 1 << (^uintptr(0) >> 63) / 2
// Computed constant. The definition of MaxSmallSize and the // 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 // size classes. NumSizeClasses is that number. It's needed here
// because there are static arrays of this length; when msize runs its // because there are static arrays of this length; when msize runs its
// size choosing algorithm it double-checks that NumSizeClasses agrees. // size choosing algorithm it double-checks that NumSizeClasses agrees.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Central free lists. // 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. // 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) // Each MCentral is two lists of MSpans: those with free objects (c->nonempty)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Fixed-size object allocator. Returned memory is not zeroed. // Fixed-size object allocator. Returned memory is not zeroed.
// //
// See malloc.h for overview. // See malloc.go for overview.
package runtime package runtime
......
...@@ -58,7 +58,7 @@ func markroot(desc *parfor, i uint32) { ...@@ -58,7 +58,7 @@ func markroot(desc *parfor, i uint32) {
var gcw gcWorkProducer var gcw gcWorkProducer
gcw.initFromCache() 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 { switch i {
case _RootData: case _RootData:
scanblock(uintptr(unsafe.Pointer(&data)), uintptr(unsafe.Pointer(&edata))-uintptr(unsafe.Pointer(&data)), gcdatamask.bytedata, &gcw) scanblock(uintptr(unsafe.Pointer(&data)), uintptr(unsafe.Pointer(&edata))-uintptr(unsafe.Pointer(&data)), gcdatamask.bytedata, &gcw)
......
...@@ -158,7 +158,7 @@ func recordspan(vh unsafe.Pointer, p unsafe.Pointer) { ...@@ -158,7 +158,7 @@ func recordspan(vh unsafe.Pointer, p unsafe.Pointer) {
if len(h_allspans) > 0 { if len(h_allspans) > 0 {
copy(new, h_allspans) copy(new, h_allspans)
// Don't free the old array if it's referenced by sweep. // 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 { if h.allspans != mheap_.gcspans {
sysFree(unsafe.Pointer(h.allspans), uintptr(cap(h_allspans))*ptrSize, &memstats.other_sys) sysFree(unsafe.Pointer(h.allspans), uintptr(cap(h_allspans))*ptrSize, &memstats.other_sys)
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// Malloc small size classes. // Malloc small size classes.
// //
// See malloc.h for overview. // See malloc.go for overview.
// //
// The size classes are chosen so that rounding an allocation // The size classes are chosen so that rounding an allocation
// request up to the next size class wastes at most 12.5% (1.125x). // request up to the next size class wastes at most 12.5% (1.125x).
......
...@@ -64,9 +64,6 @@ type mstats struct { ...@@ -64,9 +64,6 @@ type mstats struct {
var memstats mstats 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. // A MemStats records statistics about the memory allocator.
type MemStats struct { type MemStats struct {
// General statistics. // General statistics.
......
...@@ -28,7 +28,7 @@ func getncpu() int32 { ...@@ -28,7 +28,7 @@ func getncpu() int32 {
// FreeBSD's umtx_op syscall is effectively the same as Linux's futex, and // FreeBSD's umtx_op syscall is effectively the same as Linux's futex, and
// thus the code is largely similar. See Linux implementation // thus the code is largely similar. See Linux implementation
// and lock_futex.c for comments. // and lock_futex.go for comments.
//go:nosplit //go:nosplit
func futexsleep(addr *uint32, val uint32, ns int64) { func futexsleep(addr *uint32, val uint32, ns int64) {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
/* /*
* This code is copied, with slight editing due to type differences, * 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 package runtime
......
...@@ -435,7 +435,7 @@ func reflect_typelinks() []*_type { ...@@ -435,7 +435,7 @@ func reflect_typelinks() []*_type {
return ret return ret
} }
// TODO: move back into mgc0.c when converted to Go // TODO: move back into mgc.go
func readgogc() int32 { func readgogc() int32 {
p := gogetenv("GOGC") p := gogetenv("GOGC")
if p == "" { if p == "" {
......
...@@ -14,7 +14,7 @@ const ( ...@@ -14,7 +14,7 @@ const (
// //
// If you add to this list, add to the list // If you add to this list, add to the list
// of "okay during garbage collection" status // of "okay during garbage collection" status
// in mgc0.c too. // in mgcmark.go too.
_Gidle = iota // 0 _Gidle = iota // 0
_Grunnable // 1 runnable and on a run queue _Grunnable // 1 runnable and on a run queue
_Grunning // 2 _Grunning // 2
...@@ -129,7 +129,7 @@ type gobuf struct { ...@@ -129,7 +129,7 @@ type gobuf struct {
} }
// Known to compiler. // 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 { type sudog struct {
g *g g *g
selectdone *uint32 selectdone *uint32
...@@ -316,7 +316,7 @@ type p struct { ...@@ -316,7 +316,7 @@ type p struct {
m *m // back-link to associated m (nil if idle) m *m // back-link to associated m (nil if idle)
mcache *mcache 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 deferpoolbuf [5][32]*_defer
// Cache of goroutine ids, amortizes accesses to runtime·sched.goidgen. // Cache of goroutine ids, amortizes accesses to runtime·sched.goidgen.
...@@ -420,7 +420,7 @@ const ( ...@@ -420,7 +420,7 @@ const (
// Layout of in-memory per-function information prepared by linker // Layout of in-memory per-function information prepared by linker
// See http://golang.org/s/go12symtab. // 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. // and with package debug/gosym and with symtab.go in package runtime.
type _func struct { type _func struct {
entry uintptr // start pc entry uintptr // start pc
......
...@@ -371,7 +371,7 @@ loop: ...@@ -371,7 +371,7 @@ loop:
c = cas.c c = cas.c
sg := acquireSudog() sg := acquireSudog()
sg.g = gp 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.selectdone = (*uint32)(noescape(unsafe.Pointer(&done)))
sg.elem = cas.elem sg.elem = cas.elem
sg.releasetime = 0 sg.releasetime = 0
......
...@@ -8,7 +8,7 @@ package runtime ...@@ -8,7 +8,7 @@ package runtime
import "unsafe" 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 { type _type struct {
size uintptr size uintptr
hash uint32 hash uint32
......
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