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>
}
}
-/*
- * cplx.c
- */
func Complexop(n *Node, res *Node) bool {
if n != nil && n.Type != nil {
if Iscomplex[n.Type.Etype] {
return true
}
-/*
- * gsubr.c
- */
func Gbranch(as int, t *Type, likely int) *obj.Prog {
p := Prog(as)
p.To.Type = obj.TYPE_BRANCH
return off
}
-/*
- * gobj.c
- */
func Datastring(s string, a *obj.Addr) {
sym := stringsym(s)
a.Type = obj.TYPE_MEM
)
// "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
Thearch.Gins(obj.ACHECKNIL, n, nil)
}
-/*
- * ggen.c
- */
func compile(fn *Node) {
if Newproc == nil {
Newproc = Sysfunc("newproc")
)
// "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
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)
}
}
-// 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 {
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)
// 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
// 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))
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.
/*
* 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 {
/*
// 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.
// 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
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!
// 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
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
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)
// 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
// 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
}
// 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
}
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
_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.
// 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)
// Fixed-size object allocator. Returned memory is not zeroed.
//
-// See malloc.h for overview.
+// See malloc.go for overview.
package runtime
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)
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)
}
// 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).
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.
// 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) {
/*
* 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
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 == "" {
//
// 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
}
// 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
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.
// 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
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
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