Skip to content

Commit

Permalink
[dev.regabi] cmd/compile, runtime: fix up comments/error messages fro…
Browse files Browse the repository at this point in the history
…m recent renames

Went in a semi-automated way through the clearest renames of functions,
and updated comments and error messages where it made sense.

Change-Id: Ied8e152b562b705da7f52f715991a77dab60da35
Reviewed-on: https://go-review.googlesource.com/c/go/+/284216
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
  • Loading branch information
danscales committed Jan 16, 2021
1 parent ab3b67a commit a956a0e
Show file tree
Hide file tree
Showing 59 changed files with 176 additions and 177 deletions.
2 changes: 1 addition & 1 deletion src/cmd/asm/internal/asm/parse.go
Expand Up @@ -305,7 +305,7 @@ func (p *Parser) pseudo(word string, operands [][]lex.Token) bool {
// references and writes symabis information to w.
//
// The symabis format is documented at
// cmd/compile/internal/gc.readSymABIs.
// cmd/compile/internal/ssagen.ReadSymABIs.
func (p *Parser) symDefRef(w io.Writer, word string, operands [][]lex.Token) {
switch word {
case "TEXT":
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/base/flag.go
Expand Up @@ -174,7 +174,7 @@ func ParseFlags() {
if (*Flag.Shared || *Flag.Dynlink || *Flag.LinkShared) && !Ctxt.Arch.InFamily(sys.AMD64, sys.ARM, sys.ARM64, sys.I386, sys.PPC64, sys.RISCV64, sys.S390X) {
log.Fatalf("%s/%s does not support -shared", objabi.GOOS, objabi.GOARCH)
}
parseSpectre(Flag.Spectre) // left as string for recordFlags
parseSpectre(Flag.Spectre) // left as string for RecordFlags

Ctxt.Flag_shared = Ctxt.Flag_dynlink || Ctxt.Flag_shared
Ctxt.Flag_optimize = Flag.N == 0
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/base/print.go
Expand Up @@ -121,7 +121,7 @@ func ErrorfAt(pos src.XPos, format string, args ...interface{}) {
lasterror.syntax = pos
} else {
// only one of multiple equal non-syntax errors per line
// (flusherrors shows only one of them, so we filter them
// (FlushErrors shows only one of them, so we filter them
// here as best as we can (they may not appear in order)
// so that we don't count them here and exit early, and
// then have nothing to show for.)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/bitvec/bv.go
Expand Up @@ -37,7 +37,7 @@ func NewBulk(nbit int32, count int32) Bulk {
nword := (nbit + wordBits - 1) / wordBits
size := int64(nword) * int64(count)
if int64(int32(size*4)) != size*4 {
base.Fatalf("bvbulkalloc too big: nbit=%d count=%d nword=%d size=%d", nbit, count, nword, size)
base.Fatalf("NewBulk too big: nbit=%d count=%d nword=%d size=%d", nbit, count, nword, size)
}
return Bulk{
words: make([]uint32, size),
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/escape/escape.go
Expand Up @@ -856,7 +856,7 @@ func (e *escape) discards(l ir.Nodes) {
}
}

// addr evaluates an addressable expression n and returns an EscHole
// addr evaluates an addressable expression n and returns a hole
// that represents storing into the represented location.
func (e *escape) addr(n ir.Node) hole {
if n == nil || ir.IsBlank(n) {
Expand Down Expand Up @@ -1785,7 +1785,7 @@ func (l leaks) Encode() string {
return s
}

// parseLeaks parses a binary string representing an EscLeaks.
// parseLeaks parses a binary string representing a leaks
func parseLeaks(s string) leaks {
var l leaks
if !strings.HasPrefix(s, "esc:") {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/gc/compile.go
Expand Up @@ -72,7 +72,7 @@ func enqueueFunc(fn *ir.Func) {
func prepareFunc(fn *ir.Func) {
// Set up the function's LSym early to avoid data races with the assemblers.
// Do this before walk, as walk needs the LSym to set attributes/relocations
// (e.g. in markTypeUsedInInterface).
// (e.g. in MarkTypeUsedInInterface).
ssagen.InitLSym(fn, true)

// Calculate parameter offsets.
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/compile/internal/gc/main.go
Expand Up @@ -121,7 +121,7 @@ func Main(archInit func(*ssagen.ArchInfo)) {
log.Fatalf("compiler not built with support for -t")
}

// Enable inlining (after recordFlags, to avoid recording the rewritten -l). For now:
// Enable inlining (after RecordFlags, to avoid recording the rewritten -l). For now:
// default: inlining on. (Flag.LowerL == 1)
// -l: inlining off (Flag.LowerL == 0)
// -l=2, -l=3: inlining on again, with extra debugging (Flag.LowerL > 1)
Expand Down Expand Up @@ -193,7 +193,7 @@ func Main(archInit func(*ssagen.ArchInfo)) {
typecheck.Target = new(ir.Package)

typecheck.NeedITab = func(t, iface *types.Type) { reflectdata.ITabAddr(t, iface) }
typecheck.NeedRuntimeType = reflectdata.NeedRuntimeType // TODO(rsc): typenamesym for lock?
typecheck.NeedRuntimeType = reflectdata.NeedRuntimeType // TODO(rsc): TypeSym for lock?

base.AutogeneratedPos = makePos(src.NewFileBase("<autogenerated>", "<autogenerated>"), 1, 0)

Expand Down Expand Up @@ -261,15 +261,15 @@ func Main(archInit func(*ssagen.ArchInfo)) {
escape.Funcs(typecheck.Target.Decls)

// Collect information for go:nowritebarrierrec
// checking. This must happen before transformclosure.
// checking. This must happen before transforming closures during Walk
// We'll do the final check after write barriers are
// inserted.
if base.Flag.CompilingRuntime {
ssagen.EnableNoWriteBarrierRecCheck()
}

// Prepare for SSA compilation.
// This must be before peekitabs, because peekitabs
// This must be before CompileITabs, because CompileITabs
// can trigger function compilation.
typecheck.InitRuntime()
ssagen.InitConfig()
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/gc/obj.go
Expand Up @@ -121,7 +121,7 @@ func dumpdata() {
reflectdata.WriteBasicTypes()
dumpembeds()

// Calls to dumpsignats can generate functions,
// Calls to WriteRuntimeTypes can generate functions,
// like method wrappers and hash and equality routines.
// Compile any generated functions, process any new resulting types, repeat.
// This can't loop forever, because there is no way to generate an infinite
Expand Down
10 changes: 5 additions & 5 deletions src/cmd/compile/internal/inline/inl.go
Expand Up @@ -4,7 +4,7 @@
//
// The inlining facility makes 2 passes: first caninl determines which
// functions are suitable for inlining, and for those that are it
// saves a copy of the body. Then inlcalls walks each function body to
// saves a copy of the body. Then InlineCalls walks each function body to
// expand calls to inlinable functions.
//
// The Debug.l flag controls the aggressiveness. Note that main() swaps level 0 and 1,
Expand Down Expand Up @@ -79,7 +79,7 @@ func InlinePackage() {
// fn and ->nbody will already have been typechecked.
func CanInline(fn *ir.Func) {
if fn.Nname == nil {
base.Fatalf("caninl no nname %+v", fn)
base.Fatalf("CanInline no nname %+v", fn)
}

var reason string // reason, if any, that the function was not inlined
Expand Down Expand Up @@ -144,7 +144,7 @@ func CanInline(fn *ir.Func) {
}

if fn.Typecheck() == 0 {
base.Fatalf("caninl on non-typechecked function %v", fn)
base.Fatalf("CanInline on non-typechecked function %v", fn)
}

n := fn.Nname
Expand Down Expand Up @@ -200,11 +200,11 @@ func Inline_Flood(n *ir.Name, exportsym func(*ir.Name)) {
return
}
if n.Op() != ir.ONAME || n.Class != ir.PFUNC {
base.Fatalf("inlFlood: unexpected %v, %v, %v", n, n.Op(), n.Class)
base.Fatalf("Inline_Flood: unexpected %v, %v, %v", n, n.Op(), n.Class)
}
fn := n.Func
if fn == nil {
base.Fatalf("inlFlood: missing Func on %v", n)
base.Fatalf("Inline_Flood: missing Func on %v", n)
}
if fn.Inl == nil {
return
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ir/const.go
Expand Up @@ -77,7 +77,7 @@ func ConstOverflow(v constant.Value, t *types.Type) bool {
ft := types.FloatForComplex(t)
return ConstOverflow(constant.Real(v), ft) || ConstOverflow(constant.Imag(v), ft)
}
base.Fatalf("doesoverflow: %v, %v", v, t)
base.Fatalf("ConstOverflow: %v, %v", v, t)
panic("unreachable")
}

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ir/func.go
Expand Up @@ -63,7 +63,7 @@ type Func struct {
Exit Nodes

// ONAME nodes for all params/locals for this func/closure, does NOT
// include closurevars until transformclosure runs.
// include closurevars until transforming closures during walk.
// Names must be listed PPARAMs, PPARAMOUTs, then PAUTOs,
// with PPARAMs and PPARAMOUTs in order corresponding to the function signature.
// However, as anonymous or blank PPARAMs are not actually declared,
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/ir/stmt.go
Expand Up @@ -343,7 +343,7 @@ type SelectStmt struct {
HasBreak bool

// TODO(rsc): Instead of recording here, replace with a block?
Compiled Nodes // compiled form, after walkswitch
Compiled Nodes // compiled form, after walkSwitch
}

func NewSelectStmt(pos src.XPos, cases []*CommClause) *SelectStmt {
Expand Down Expand Up @@ -376,7 +376,7 @@ type SwitchStmt struct {
HasBreak bool

// TODO(rsc): Instead of recording here, replace with a block?
Compiled Nodes // compiled form, after walkswitch
Compiled Nodes // compiled form, after walkSwitch
}

func NewSwitchStmt(pos src.XPos, tag Node, cases []*CaseClause) *SwitchStmt {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/liveness/bvset.go
Expand Up @@ -47,7 +47,7 @@ func (m *bvecSet) grow() {
m.index = newIndex
}

// add adds bv to the set and returns its index in m.extractUniqe.
// add adds bv to the set and returns its index in m.extractUnique.
// The caller must not modify bv after this.
func (m *bvecSet) add(bv bitvec.BitVec) int {
if len(m.uniq)*4 >= len(m.index) {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/liveness/plive.go
Expand Up @@ -1060,7 +1060,7 @@ func (lv *liveness) printDebug() {
func (lv *liveness) emit() (argsSym, liveSym *obj.LSym) {
// Size args bitmaps to be just large enough to hold the largest pointer.
// First, find the largest Xoffset node we care about.
// (Nodes without pointers aren't in lv.vars; see livenessShouldTrack.)
// (Nodes without pointers aren't in lv.vars; see ShouldTrack.)
var maxArgNode *ir.Name
for _, n := range lv.vars {
switch n.Class {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/noder/import.go
Expand Up @@ -418,7 +418,7 @@ func clearImports() {
if types.IsDotAlias(s) {
// throw away top-level name left over
// from previous import . "x"
// We'll report errors after type checking in checkDotImports.
// We'll report errors after type checking in CheckDotImports.
s.Def = nil
continue
}
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/compile/internal/noder/noder.go
Expand Up @@ -86,7 +86,7 @@ func ParseFiles(filenames []string) uint {
if base.SyntaxErrors() != 0 {
base.ErrorExit()
}
// Always run testdclstack here, even when debug_dclstack is not set, as a sanity measure.
// Always run CheckDclstack here, even when debug_dclstack is not set, as a sanity measure.
types.CheckDclstack()
}

Expand Down Expand Up @@ -638,7 +638,7 @@ func (p *noder) funcDecl(fun *syntax.FuncDecl) ir.Node {
}
} else {
f.Shortname = name
name = ir.BlankNode.Sym() // filled in by typecheckfunc
name = ir.BlankNode.Sym() // filled in by tcFunc
}

f.Nname = ir.NewNameAt(p.pos(fun.Name), name)
Expand Down Expand Up @@ -1084,7 +1084,7 @@ func (p *noder) stmtsFall(stmts []syntax.Stmt, fallOK bool) []ir.Node {
if s == nil {
} else if s.Op() == ir.OBLOCK && len(s.(*ir.BlockStmt).List) > 0 {
// Inline non-empty block.
// Empty blocks must be preserved for checkreturn.
// Empty blocks must be preserved for CheckReturn.
nodes = append(nodes, s.(*ir.BlockStmt).List...)
} else {
nodes = append(nodes, s)
Expand Down Expand Up @@ -1860,7 +1860,7 @@ func (p *noder) funcLit(expr *syntax.FuncLit) ir.Node {
fn := ir.NewFunc(p.pos(expr))
fn.SetIsHiddenClosure(ir.CurFunc != nil)

fn.Nname = ir.NewNameAt(p.pos(expr), ir.BlankNode.Sym()) // filled in by typecheckclosure
fn.Nname = ir.NewNameAt(p.pos(expr), ir.BlankNode.Sym()) // filled in by tcClosure
fn.Nname.Func = fn
fn.Nname.Ntype = xtype
fn.Nname.Defn = fn
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/objw/prog.go
Expand Up @@ -205,7 +205,7 @@ func (pp *Progs) Append(p *obj.Prog, as obj.As, ftype obj.AddrType, freg int16,

func (pp *Progs) SetText(fn *ir.Func) {
if pp.Text != nil {
base.Fatalf("Progs.settext called twice")
base.Fatalf("Progs.SetText called twice")
}
ptxt := pp.Prog(obj.ATEXT)
pp.Text = ptxt
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/pkginit/init.go
Expand Up @@ -60,10 +60,10 @@ func Task() *ir.Name {
fns = append(fns, fn.Linksym())
}
if typecheck.InitTodoFunc.Dcl != nil {
// We only generate temps using initTodo if there
// We only generate temps using InitTodoFunc if there
// are package-scope initialization statements, so
// something's weird if we get here.
base.Fatalf("initTodo still has declarations")
base.Fatalf("InitTodoFunc still has declarations")
}
typecheck.InitTodoFunc = nil

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/reflectdata/alg.go
Expand Up @@ -689,7 +689,7 @@ func EqString(s, t ir.Node) (eqlen *ir.BinaryExpr, eqmem *ir.CallExpr) {
// eqtab must be evaluated before eqdata, and shortcircuiting is required.
func EqInterface(s, t ir.Node) (eqtab *ir.BinaryExpr, eqdata *ir.CallExpr) {
if !types.Identical(s.Type(), t.Type()) {
base.Fatalf("eqinterface %v %v", s.Type(), t.Type())
base.Fatalf("EqInterface %v %v", s.Type(), t.Type())
}
// func ifaceeq(tab *uintptr, x, y unsafe.Pointer) (ret bool)
// func efaceeq(typ *uintptr, x, y unsafe.Pointer) (ret bool)
Expand Down
20 changes: 10 additions & 10 deletions src/cmd/compile/internal/reflectdata/reflect.go
Expand Up @@ -32,7 +32,7 @@ type itabEntry struct {

// symbols of each method in
// the itab, sorted by byte offset;
// filled in by peekitabs
// filled in by CompileITabs
entries []*obj.LSym
}

Expand Down Expand Up @@ -401,7 +401,7 @@ func dimportpath(p *types.Pkg) {
}

// If we are compiling the runtime package, there are two runtime packages around
// -- localpkg and Runtimepkg. We don't want to produce import path symbols for
// -- localpkg and Pkgs.Runtime. We don't want to produce import path symbols for
// both of them, so just produce one for localpkg.
if base.Ctxt.Pkgpath == "runtime" && p == ir.Pkgs.Runtime {
return
Expand Down Expand Up @@ -811,7 +811,7 @@ func TypeSymPrefix(prefix string, t *types.Type) *types.Sym {

func TypeSym(t *types.Type) *types.Sym {
if t == nil || (t.IsPtr() && t.Elem() == nil) || t.IsUntyped() {
base.Fatalf("typenamesym %v", t)
base.Fatalf("TypeSym %v", t)
}
if t.Kind() == types.TFUNC && t.Recv() != nil {
base.Fatalf("misuse of method type: %v", t)
Expand Down Expand Up @@ -853,7 +853,7 @@ func TypePtr(t *types.Type) *ir.AddrExpr {

func ITabAddr(t, itype *types.Type) *ir.AddrExpr {
if t == nil || (t.IsPtr() && t.Elem() == nil) || t.IsUntyped() || !itype.IsInterface() || itype.IsEmptyInterface() {
base.Fatalf("itabname(%v, %v)", t, itype)
base.Fatalf("ITabAddr(%v, %v)", t, itype)
}
s := ir.Pkgs.Itab.Lookup(t.ShortString() + "," + itype.ShortString())
if s.Def == nil {
Expand Down Expand Up @@ -936,7 +936,7 @@ func formalType(t *types.Type) *types.Type {
func writeType(t *types.Type) *obj.LSym {
t = formalType(t)
if t.IsUntyped() {
base.Fatalf("dtypesym %v", t)
base.Fatalf("writeType %v", t)
}

s := types.TypeSym(t)
Expand Down Expand Up @@ -1275,7 +1275,7 @@ func genfun(t, it *types.Type) []*obj.LSym {
}

// ITabSym uses the information gathered in
// peekitabs to de-virtualize interface methods.
// CompileITabs to de-virtualize interface methods.
// Since this is called by the SSA backend, it shouldn't
// generate additional Nodes, Syms, etc.
func ITabSym(it *obj.LSym, offset int64) *obj.LSym {
Expand Down Expand Up @@ -1312,7 +1312,7 @@ func NeedRuntimeType(t *types.Type) {
}

func WriteRuntimeTypes() {
// Process signatset. Use a loop, as dtypesym adds
// Process signatset. Use a loop, as writeType adds
// entries to signatset while it is being processed.
signats := make([]typeAndStr, len(signatslice))
for len(signatslice) > 0 {
Expand Down Expand Up @@ -1617,13 +1617,13 @@ func (p *gcProg) emit(t *types.Type, offset int64) {
}
switch t.Kind() {
default:
base.Fatalf("GCProg.emit: unexpected type %v", t)
base.Fatalf("gcProg.emit: unexpected type %v", t)

case types.TSTRING:
p.w.Ptr(offset / int64(types.PtrSize))

case types.TINTER:
// Note: the first word isn't a pointer. See comment in plive.go:onebitwalktype1.
// Note: the first word isn't a pointer. See comment in typebits.Set
p.w.Ptr(offset/int64(types.PtrSize) + 1)

case types.TSLICE:
Expand All @@ -1632,7 +1632,7 @@ func (p *gcProg) emit(t *types.Type, offset int64) {
case types.TARRAY:
if t.NumElem() == 0 {
// should have been handled by haspointers check above
base.Fatalf("GCProg.emit: empty array")
base.Fatalf("gcProg.emit: empty array")
}

// Flatten array-of-array-of-array to just a big array by multiplying counts.
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ssagen/abi.go
Expand Up @@ -154,7 +154,7 @@ func InitLSym(f *ir.Func, hasBody bool) {
// makes calls to helpers to create ABI wrappers if needed.
func selectLSym(f *ir.Func, hasBody bool) {
if f.LSym != nil {
base.FatalfAt(f.Pos(), "Func.initLSym called twice on %v", f)
base.FatalfAt(f.Pos(), "InitLSym called twice on %v", f)
}

if nam := f.Nname; !ir.IsBlank(nam) {
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/ssagen/nowb.go
Expand Up @@ -45,7 +45,7 @@ type nowritebarrierrecCall struct {
}

// newNowritebarrierrecChecker creates a nowritebarrierrecChecker. It
// must be called before transformclosure and walk.
// must be called before walk
func newNowritebarrierrecChecker() *nowritebarrierrecChecker {
c := &nowritebarrierrecChecker{
extraCalls: make(map[*ir.Func][]nowritebarrierrecCall),
Expand All @@ -54,7 +54,7 @@ func newNowritebarrierrecChecker() *nowritebarrierrecChecker {
// Find all systemstack calls and record their targets. In
// general, flow analysis can't see into systemstack, but it's
// important to handle it for this check, so we model it
// directly. This has to happen before transformclosure since
// directly. This has to happen before transforming closures in walk since
// it's a lot harder to work out the argument after.
for _, n := range typecheck.Target.Decls {
if n.Op() != ir.ODCLFUNC {
Expand Down

0 comments on commit a956a0e

Please sign in to comment.