all: fix some comments for method

Change-Id: I4cff6b2a1fed6acdf754539c3c53a61eaa3b3f84
Reviewed-on: https://go-review.googlesource.com/c/go/+/450176
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
cui fliter 2022-11-14 20:13:10 +08:00 committed by Gopher Robot
parent c0497d1a81
commit 3a7a528c2d
18 changed files with 31 additions and 31 deletions

View File

@ -166,7 +166,7 @@ func (b *block) toSTAR() *headerSTAR { return (*headerSTAR)(b) }
func (b *block) toUSTAR() *headerUSTAR { return (*headerUSTAR)(b) } func (b *block) toUSTAR() *headerUSTAR { return (*headerUSTAR)(b) }
func (b *block) toSparse() sparseArray { return sparseArray(b[:]) } func (b *block) toSparse() sparseArray { return sparseArray(b[:]) }
// GetFormat checks that the block is a valid tar header based on the checksum. // getFormat checks that the block is a valid tar header based on the checksum.
// It then attempts to guess the specific format based on magic values. // It then attempts to guess the specific format based on magic values.
// If the checksum fails, then FormatUnknown is returned. // If the checksum fails, then FormatUnknown is returned.
func (b *block) getFormat() Format { func (b *block) getFormat() Format {
@ -239,7 +239,7 @@ func (b *block) computeChecksum() (unsigned, signed int64) {
return unsigned, signed return unsigned, signed
} }
// Reset clears the block with all zeros. // reset clears the block with all zeros.
func (b *block) reset() { func (b *block) reset() {
*b = block{} *b = block{}
} }

View File

@ -696,7 +696,7 @@ func (fr regFileReader) logicalRemaining() int64 {
return fr.nb return fr.nb
} }
// logicalRemaining implements fileState.physicalRemaining. // physicalRemaining implements fileState.physicalRemaining.
func (fr regFileReader) physicalRemaining() int64 { func (fr regFileReader) physicalRemaining() int64 {
return fr.nb return fr.nb
} }

View File

@ -519,7 +519,7 @@ func (fw regFileWriter) logicalRemaining() int64 {
return fw.nb return fw.nb
} }
// logicalRemaining implements fileState.physicalRemaining. // physicalRemaining implements fileState.physicalRemaining.
func (fw regFileWriter) physicalRemaining() int64 { func (fw regFileWriter) physicalRemaining() int64 {
return fw.nb return fw.nb
} }

View File

@ -37,7 +37,7 @@ func makeNode(key int32) *node32 {
return &node32{key: key, height_: LEAF_HEIGHT} return &node32{key: key, height_: LEAF_HEIGHT}
} }
// IsSingle returns true iff t is empty. // IsEmpty returns true iff t is empty.
func (t *T) IsEmpty() bool { func (t *T) IsEmpty() bool {
return t.root == nil return t.root == nil
} }

View File

@ -20,7 +20,7 @@ import (
"cmd/internal/obj/x86" "cmd/internal/obj/x86"
) )
// markMoves marks any MOVXconst ops that need to avoid clobbering flags. // ssaMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
func ssaMarkMoves(s *ssagen.State, b *ssa.Block) { func ssaMarkMoves(s *ssagen.State, b *ssa.Block) {
flive := b.FlagsLiveAtEnd flive := b.FlagsLiveAtEnd
for _, c := range b.ControlValues() { for _, c := range b.ControlValues() {

View File

@ -270,7 +270,7 @@ func parseLogFlag(flag, value string) (version int, directory string) {
return return
} }
// isWindowsDriveURI returns true if the file URI is of the format used by // isWindowsDriveURIPath returns true if the file URI is of the format used by
// Windows URIs. The url.Parse package does not specially handle Windows paths // Windows URIs. The url.Parse package does not specially handle Windows paths
// (see golang/go#6027), so we check if the URI path has a drive prefix (e.g. "/C:"). // (see golang/go#6027), so we check if the URI path has a drive prefix (e.g. "/C:").
// (copied from tools/internal/span/uri.go) // (copied from tools/internal/span/uri.go)

View File

@ -19,7 +19,7 @@ import (
"strings" "strings"
) )
// markMoves marks any MOVXconst ops that need to avoid clobbering flags. // ssaMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
func ssaMarkMoves(s *ssagen.State, b *ssa.Block) { func ssaMarkMoves(s *ssagen.State, b *ssa.Block) {
// flive := b.FlagsLiveAtEnd // flive := b.FlagsLiveAtEnd
// if b.Control != nil && b.Control.Type.IsFlags() { // if b.Control != nil && b.Control.Type.IsFlags() {

View File

@ -179,7 +179,7 @@ func largestMove(alignment int64) (obj.As, int64) {
} }
} }
// markMoves marks any MOVXconst ops that need to avoid clobbering flags. // ssaMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
// RISC-V has no flags, so this is a no-op. // RISC-V has no flags, so this is a no-op.
func ssaMarkMoves(s *ssagen.State, b *ssa.Block) {} func ssaMarkMoves(s *ssagen.State, b *ssa.Block) {}

View File

@ -16,7 +16,7 @@ import (
"cmd/internal/obj/s390x" "cmd/internal/obj/s390x"
) )
// markMoves marks any MOVXconst ops that need to avoid clobbering flags. // ssaMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
func ssaMarkMoves(s *ssagen.State, b *ssa.Block) { func ssaMarkMoves(s *ssagen.State, b *ssa.Block) {
flive := b.FlagsLiveAtEnd flive := b.FlagsLiveAtEnd
for _, c := range b.ControlValues() { for _, c := range b.ControlValues() {

View File

@ -144,7 +144,7 @@ func (f *Func) dominatorsLTOrig(entry *Block, predFn linkedBlocks, succFn linked
return idom return idom
} }
// dfs performs a depth first search over the blocks starting at entry block // dfsOrig performs a depth first search over the blocks starting at entry block
// (in arbitrary order). This is a de-recursed version of dfs from the // (in arbitrary order). This is a de-recursed version of dfs from the
// original Tarjan-Lengauer TOPLAS article. It's important to return the // original Tarjan-Lengauer TOPLAS article. It's important to return the
// same values for parent as the original algorithm. // same values for parent as the original algorithm.
@ -203,7 +203,7 @@ func linkOrig(v, w ID, ancestor []ID) {
ancestor[w] = v ancestor[w] = v
} }
// dominators computes the dominator tree for f. It returns a slice // dominatorsSimple computes the dominator tree for f. It returns a slice
// which maps block ID to the immediate dominator of that block. // which maps block ID to the immediate dominator of that block.
// Unreachable blocks map to nil. The entry block maps to nil. // Unreachable blocks map to nil. The entry block maps to nil.
func dominatorsSimple(f *Func) []*Block { func dominatorsSimple(f *Func) []*Block {

View File

@ -304,7 +304,7 @@ func (f *Func) newValueNoBlock(op Op, t *types.Type, pos src.XPos) *Value {
return v return v
} }
// logPassStat writes a string key and int value as a warning in a // LogStat writes a string key and int value as a warning in a
// tab-separated format easily handled by spreadsheets or awk. // tab-separated format easily handled by spreadsheets or awk.
// file names, lines, and function names are included to provide enough (?) // file names, lines, and function names are included to provide enough (?)
// context to allow item-by-item comparisons across runs. // context to allow item-by-item comparisons across runs.
@ -387,7 +387,7 @@ func (f *Func) freeValue(v *Value) {
f.freeValues = v f.freeValues = v
} }
// newBlock allocates a new Block of the given kind and places it at the end of f.Blocks. // NewBlock allocates a new Block of the given kind and places it at the end of f.Blocks.
func (f *Func) NewBlock(kind BlockKind) *Block { func (f *Func) NewBlock(kind BlockKind) *Block {
var b *Block var b *Block
if f.freeBlocks != nil { if f.freeBlocks != nil {
@ -433,7 +433,7 @@ func (b *Block) NewValue0(pos src.XPos, op Op, t *types.Type) *Value {
return v return v
} }
// NewValue returns a new value in the block with no arguments and an auxint value. // NewValue0I returns a new value in the block with no arguments and an auxint value.
func (b *Block) NewValue0I(pos src.XPos, op Op, t *types.Type, auxint int64) *Value { func (b *Block) NewValue0I(pos src.XPos, op Op, t *types.Type, auxint int64) *Value {
v := b.Func.newValue(op, t, b, pos) v := b.Func.newValue(op, t, b, pos)
v.AuxInt = auxint v.AuxInt = auxint
@ -441,7 +441,7 @@ func (b *Block) NewValue0I(pos src.XPos, op Op, t *types.Type, auxint int64) *Va
return v return v
} }
// NewValue returns a new value in the block with no arguments and an aux value. // NewValue0A returns a new value in the block with no arguments and an aux value.
func (b *Block) NewValue0A(pos src.XPos, op Op, t *types.Type, aux Aux) *Value { func (b *Block) NewValue0A(pos src.XPos, op Op, t *types.Type, aux Aux) *Value {
v := b.Func.newValue(op, t, b, pos) v := b.Func.newValue(op, t, b, pos)
v.AuxInt = 0 v.AuxInt = 0
@ -450,7 +450,7 @@ func (b *Block) NewValue0A(pos src.XPos, op Op, t *types.Type, aux Aux) *Value {
return v return v
} }
// NewValue returns a new value in the block with no arguments and both an auxint and aux values. // NewValue0IA returns a new value in the block with no arguments and both an auxint and aux values.
func (b *Block) NewValue0IA(pos src.XPos, op Op, t *types.Type, auxint int64, aux Aux) *Value { func (b *Block) NewValue0IA(pos src.XPos, op Op, t *types.Type, auxint int64, aux Aux) *Value {
v := b.Func.newValue(op, t, b, pos) v := b.Func.newValue(op, t, b, pos)
v.AuxInt = auxint v.AuxInt = auxint
@ -654,7 +654,7 @@ const (
constEmptyStringMagic = 4455667788 constEmptyStringMagic = 4455667788
) )
// ConstInt returns an int constant representing its argument. // ConstBool returns an int constant representing its argument.
func (f *Func) ConstBool(t *types.Type, c bool) *Value { func (f *Func) ConstBool(t *types.Type, c bool) *Value {
i := int64(0) i := int64(0)
if c { if c {

View File

@ -181,7 +181,7 @@ type smagicData struct {
m uint64 // ⎡2^(n+s)/c⎤ m uint64 // ⎡2^(n+s)/c⎤
} }
// magic computes the constants needed to strength reduce signed n-bit divides by the constant c. // smagic computes the constants needed to strength reduce signed n-bit divides by the constant c.
// Must have c>0. // Must have c>0.
// The return values satisfy for all -2^(n-1) <= x < 2^(n-1) // The return values satisfy for all -2^(n-1) <= x < 2^(n-1)
// //

View File

@ -423,7 +423,7 @@ func canLoadUnaligned(c *Config) bool {
return c.ctxt.Arch.Alignment == 1 return c.ctxt.Arch.Alignment == 1
} }
// nlz returns the number of leading zeros. // nlzX returns the number of leading zeros.
func nlz64(x int64) int { return bits.LeadingZeros64(uint64(x)) } func nlz64(x int64) int { return bits.LeadingZeros64(uint64(x)) }
func nlz32(x int32) int { return bits.LeadingZeros32(uint32(x)) } func nlz32(x int32) int { return bits.LeadingZeros32(uint32(x)) }
func nlz16(x int16) int { return bits.LeadingZeros16(uint16(x)) } func nlz16(x int16) int { return bits.LeadingZeros16(uint16(x)) }
@ -467,7 +467,7 @@ func log2uint32(n int64) int64 {
return int64(bits.Len32(uint32(n))) - 1 return int64(bits.Len32(uint32(n))) - 1
} }
// isPowerOfTwo functions report whether n is a power of 2. // isPowerOfTwoX functions report whether n is a power of 2.
func isPowerOfTwo8(n int8) bool { func isPowerOfTwo8(n int8) bool {
return n > 0 && n&(n-1) == 0 return n > 0 && n&(n-1) == 0
} }

View File

@ -1113,7 +1113,7 @@ func (s *state) newValue4(op ssa.Op, t *types.Type, arg0, arg1, arg2, arg3 *ssa.
return s.curBlock.NewValue4(s.peekPos(), op, t, arg0, arg1, arg2, arg3) return s.curBlock.NewValue4(s.peekPos(), op, t, arg0, arg1, arg2, arg3)
} }
// newValue4 adds a new value with four arguments and an auxint value to the current block. // newValue4I adds a new value with four arguments and an auxint value to the current block.
func (s *state) newValue4I(op ssa.Op, t *types.Type, aux int64, arg0, arg1, arg2, arg3 *ssa.Value) *ssa.Value { func (s *state) newValue4I(op ssa.Op, t *types.Type, aux int64, arg0, arg1, arg2, arg3 *ssa.Value) *ssa.Value {
return s.curBlock.NewValue4I(s.peekPos(), op, t, aux, arg0, arg1, arg2, arg3) return s.curBlock.NewValue4I(s.peekPos(), op, t, aux, arg0, arg1, arg2, arg3)
} }
@ -1145,7 +1145,7 @@ func (s *state) entryNewValue1(op ssa.Op, t *types.Type, arg *ssa.Value) *ssa.Va
return s.entryBlock().NewValue1(src.NoXPos, op, t, arg) return s.entryBlock().NewValue1(src.NoXPos, op, t, arg)
} }
// entryNewValue1 adds a new value with one argument and an auxint value to the entry block. // entryNewValue1I adds a new value with one argument and an auxint value to the entry block.
func (s *state) entryNewValue1I(op ssa.Op, t *types.Type, auxint int64, arg *ssa.Value) *ssa.Value { func (s *state) entryNewValue1I(op ssa.Op, t *types.Type, auxint int64, arg *ssa.Value) *ssa.Value {
return s.entryBlock().NewValue1I(src.NoXPos, op, t, auxint, arg) return s.entryBlock().NewValue1I(src.NoXPos, op, t, auxint, arg)
} }
@ -7813,7 +7813,7 @@ func (e *ssafn) Line(pos src.XPos) string {
return base.FmtPos(pos) return base.FmtPos(pos)
} }
// Log logs a message from the compiler. // Logf logs a message from the compiler.
func (e *ssafn) Logf(msg string, args ...interface{}) { func (e *ssafn) Logf(msg string, args ...interface{}) {
if e.log { if e.log {
fmt.Printf(msg, args...) fmt.Printf(msg, args...)
@ -7824,7 +7824,7 @@ func (e *ssafn) Log() bool {
return e.log return e.log
} }
// Fatal reports a compiler error and exits. // Fatalf reports a compiler error and exits.
func (e *ssafn) Fatalf(pos src.XPos, msg string, args ...interface{}) { func (e *ssafn) Fatalf(pos src.XPos, msg string, args ...interface{}) {
base.Pos = pos base.Pos = pos
nargs := append([]interface{}{ir.FuncName(e.curfn)}, args...) nargs := append([]interface{}{ir.FuncName(e.curfn)}, args...)
@ -7952,7 +7952,7 @@ func deferstruct() *types.Type {
return s return s
} }
// SlotAddr uses LocalSlot information to initialize an obj.Addr // SpillSlotAddr uses LocalSlot information to initialize an obj.Addr
// The resulting addr is used in a non-standard context -- in the prologue // The resulting addr is used in a non-standard context -- in the prologue
// of a function, before the frame has been constructed, so the standard // of a function, before the frame has been constructed, so the standard
// addressing for the parameters will be wrong. // addressing for the parameters will be wrong.

View File

@ -217,7 +217,7 @@ func (p *parser) posAt(line, col uint) Pos {
return MakePos(p.base, line, col) return MakePos(p.base, line, col)
} }
// error reports an error at the given position. // errorAt reports an error at the given position.
func (p *parser) errorAt(pos Pos, msg string) { func (p *parser) errorAt(pos Pos, msg string) {
err := Error{pos, msg} err := Error{pos, msg}
if p.first == nil { if p.first == nil {
@ -314,7 +314,7 @@ const stopset uint64 = 1<<_Break |
1<<_Type | 1<<_Type |
1<<_Var 1<<_Var
// Advance consumes tokens until it finds a token of the stopset or followlist. // advance consumes tokens until it finds a token of the stopset or followlist.
// The stopset is only considered if we are inside a function (p.fnest > 0). // The stopset is only considered if we are inside a function (p.fnest > 0).
// The followlist is the list of valid tokens that can follow a production; // The followlist is the list of valid tokens that can follow a production;
// if it is empty, exactly one (non-EOF) token is consumed to ensure progress. // if it is empty, exactly one (non-EOF) token is consumed to ensure progress.

View File

@ -18,7 +18,7 @@ import (
"cmd/internal/obj/x86" "cmd/internal/obj/x86"
) )
// markMoves marks any MOVXconst ops that need to avoid clobbering flags. // ssaMarkMoves marks any MOVXconst ops that need to avoid clobbering flags.
func ssaMarkMoves(s *ssagen.State, b *ssa.Block) { func ssaMarkMoves(s *ssagen.State, b *ssa.Block) {
flive := b.FlagsLiveAtEnd flive := b.FlagsLiveAtEnd
for _, c := range b.ControlValues() { for _, c := range b.ControlValues() {

View File

@ -47,7 +47,7 @@ type _ListNum[T OrderedNum] struct {
const Clip = 5 const Clip = 5
// clippedLargest returns the largest in the list of OrderNums, but a max of 5. // ClippedLargest returns the largest in the list of OrderNums, but a max of 5.
// Test use of untyped constant in an expression with a generically-typed parameter // Test use of untyped constant in an expression with a generically-typed parameter
func (l *_ListNum[T]) ClippedLargest() T { func (l *_ListNum[T]) ClippedLargest() T {
var max T var max T

View File

@ -41,7 +41,7 @@ type ListNum[T OrderedNum] struct {
const Clip = 5 const Clip = 5
// clippedLargest returns the largest in the list of OrderNums, but a max of 5. // ClippedLargest returns the largest in the list of OrderNums, but a max of 5.
func (l *ListNum[T]) ClippedLargest() T { func (l *ListNum[T]) ClippedLargest() T {
var max T var max T
for p := l; p != nil; p = p.Next { for p := l; p != nil; p = p.Next {