all: add missing periods in comments

Change-Id: I69065f8adf101fdb28682c55997f503013a50e29
Reviewed-on: https://go-review.googlesource.com/c/go/+/449757
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joedian Reid <joedian@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
cui fliter 2022-11-11 19:22:35 +08:00 committed by Gopher Robot
parent 893964b972
commit b2faff18ce
97 changed files with 174 additions and 174 deletions

View file

@ -304,7 +304,7 @@ func mergePAX(hdr *Header, paxHdrs map[string]string) (err error) {
} }
// parsePAX parses PAX headers. // parsePAX parses PAX headers.
// If an extended header (type 'x') is invalid, ErrHeader is returned // If an extended header (type 'x') is invalid, ErrHeader is returned.
func parsePAX(r io.Reader) (map[string]string, error) { func parsePAX(r io.Reader) (map[string]string, error) {
buf, err := readSpecialFile(r) buf, err := readSpecialFile(r)
if err != nil { if err != nil {

View file

@ -113,7 +113,7 @@ func IsARMSTREX(op obj.As) bool {
const aMCR = arm.ALAST + 1 const aMCR = arm.ALAST + 1
// IsARMMRC reports whether the op (as defined by an arm.A* constant) is // IsARMMRC reports whether the op (as defined by an arm.A* constant) is
// MRC or MCR // MRC or MCR.
func IsARMMRC(op obj.As) bool { func IsARMMRC(op obj.As) bool {
switch op { switch op {
case arm.AMRC, aMCR: // Note: aMCR is defined in this package. case arm.AMRC, aMCR: // Note: aMCR is defined in this package.

View file

@ -2222,7 +2222,7 @@ func (c *typeConv) Init(ptrSize, intSize int64) {
} }
} }
// base strips away qualifiers and typedefs to get the underlying type // base strips away qualifiers and typedefs to get the underlying type.
func base(dt dwarf.Type) dwarf.Type { func base(dt dwarf.Type) dwarf.Type {
for { for {
if d, ok := dt.(*dwarf.QualType); ok { if d, ok := dt.(*dwarf.QualType); ok {

View file

@ -529,7 +529,7 @@ type assignState struct {
spillOffset int64 // current spill offset spillOffset int64 // current spill offset
} }
// align returns a rounded up to t's alignment // align returns a rounded up to t's alignment.
func align(a int64, t *types.Type) int64 { func align(a int64, t *types.Type) int64 {
return alignTo(a, int(uint8(t.Alignment()))) return alignTo(a, int(uint8(t.Alignment())))
} }

View file

@ -72,7 +72,7 @@ func storeByType(t *types.Type) obj.As {
panic("bad store type") panic("bad store type")
} }
// shift type is used as Offset in obj.TYPE_SHIFT operands to encode shifted register operands // shift type is used as Offset in obj.TYPE_SHIFT operands to encode shifted register operands.
type shift int64 type shift int64
// copied from ../../../internal/obj/util.go:/TYPE_SHIFT // copied from ../../../internal/obj/util.go:/TYPE_SHIFT
@ -87,7 +87,7 @@ func (v shift) String() string {
} }
} }
// makeshift encodes a register shifted by a constant // makeshift encodes a register shifted by a constant.
func makeshift(v *ssa.Value, reg int16, typ int64, s int64) shift { func makeshift(v *ssa.Value, reg int16, typ int64, s int64) shift {
if s < 0 || s >= 32 { if s < 0 || s >= 32 {
v.Fatalf("shift out of range: %d", s) v.Fatalf("shift out of range: %d", s)
@ -95,7 +95,7 @@ func makeshift(v *ssa.Value, reg int16, typ int64, s int64) shift {
return shift(int64(reg&0xf) | typ | (s&31)<<7) return shift(int64(reg&0xf) | typ | (s&31)<<7)
} }
// genshift generates a Prog for r = r0 op (r1 shifted by n) // genshift generates a Prog for r = r0 op (r1 shifted by n).
func genshift(s *ssagen.State, v *ssa.Value, as obj.As, r0, r1, r int16, typ int64, n int64) *obj.Prog { func genshift(s *ssagen.State, v *ssa.Value, as obj.As, r0, r1, r int16, typ int64, n int64) *obj.Prog {
p := s.Prog(as) p := s.Prog(as)
p.From.Type = obj.TYPE_SHIFT p.From.Type = obj.TYPE_SHIFT
@ -108,12 +108,12 @@ func genshift(s *ssagen.State, v *ssa.Value, as obj.As, r0, r1, r int16, typ int
return p return p
} }
// makeregshift encodes a register shifted by a register // makeregshift encodes a register shifted by a register.
func makeregshift(r1 int16, typ int64, r2 int16) shift { func makeregshift(r1 int16, typ int64, r2 int16) shift {
return shift(int64(r1&0xf) | typ | int64(r2&0xf)<<8 | 1<<4) return shift(int64(r1&0xf) | typ | int64(r2&0xf)<<8 | 1<<4)
} }
// genregshift generates a Prog for r = r0 op (r1 shifted by r2) // genregshift generates a Prog for r = r0 op (r1 shifted by r2).
func genregshift(s *ssagen.State, as obj.As, r0, r1, r2, r int16, typ int64) *obj.Prog { func genregshift(s *ssagen.State, as obj.As, r0, r1, r2, r int16, typ int64) *obj.Prog {
p := s.Prog(as) p := s.Prog(as)
p.From.Type = obj.TYPE_SHIFT p.From.Type = obj.TYPE_SHIFT
@ -903,13 +903,13 @@ var blockJump = map[ssa.BlockKind]struct {
ssa.BlockARMGEnoov: {arm.ABPL, arm.ABMI}, ssa.BlockARMGEnoov: {arm.ABPL, arm.ABMI},
} }
// To model a 'LEnoov' ('<=' without overflow checking) branching // To model a 'LEnoov' ('<=' without overflow checking) branching.
var leJumps = [2][2]ssagen.IndexJump{ var leJumps = [2][2]ssagen.IndexJump{
{{Jump: arm.ABEQ, Index: 0}, {Jump: arm.ABPL, Index: 1}}, // next == b.Succs[0] {{Jump: arm.ABEQ, Index: 0}, {Jump: arm.ABPL, Index: 1}}, // next == b.Succs[0]
{{Jump: arm.ABMI, Index: 0}, {Jump: arm.ABEQ, Index: 0}}, // next == b.Succs[1] {{Jump: arm.ABMI, Index: 0}, {Jump: arm.ABEQ, Index: 0}}, // next == b.Succs[1]
} }
// To model a 'GTnoov' ('>' without overflow checking) branching // To model a 'GTnoov' ('>' without overflow checking) branching.
var gtJumps = [2][2]ssagen.IndexJump{ var gtJumps = [2][2]ssagen.IndexJump{
{{Jump: arm.ABMI, Index: 1}, {Jump: arm.ABEQ, Index: 1}}, // next == b.Succs[0] {{Jump: arm.ABMI, Index: 1}, {Jump: arm.ABEQ, Index: 1}}, // next == b.Succs[0]
{{Jump: arm.ABEQ, Index: 1}, {Jump: arm.ABPL, Index: 0}}, // next == b.Succs[1] {{Jump: arm.ABEQ, Index: 1}, {Jump: arm.ABPL, Index: 0}}, // next == b.Succs[1]

View file

@ -78,7 +78,7 @@ func storeByType(t *types.Type) obj.As {
panic("bad store type") panic("bad store type")
} }
// makeshift encodes a register shifted by a constant, used as an Offset in Prog // makeshift encodes a register shifted by a constant, used as an Offset in Prog.
func makeshift(v *ssa.Value, reg int16, typ int64, s int64) int64 { func makeshift(v *ssa.Value, reg int16, typ int64, s int64) int64 {
if s < 0 || s >= 64 { if s < 0 || s >= 64 {
v.Fatalf("shift out of range: %d", s) v.Fatalf("shift out of range: %d", s)
@ -86,7 +86,7 @@ func makeshift(v *ssa.Value, reg int16, typ int64, s int64) int64 {
return int64(reg&31)<<16 | typ | (s&63)<<10 return int64(reg&31)<<16 | typ | (s&63)<<10
} }
// genshift generates a Prog for r = r0 op (r1 shifted by n) // genshift generates a Prog for r = r0 op (r1 shifted by n).
func genshift(s *ssagen.State, v *ssa.Value, as obj.As, r0, r1, r int16, typ int64, n int64) *obj.Prog { func genshift(s *ssagen.State, v *ssa.Value, as obj.As, r0, r1, r int16, typ int64, n int64) *obj.Prog {
p := s.Prog(as) p := s.Prog(as)
p.From.Type = obj.TYPE_SHIFT p.From.Type = obj.TYPE_SHIFT
@ -1223,13 +1223,13 @@ var blockJump = map[ssa.BlockKind]struct {
ssa.BlockARM64GEnoov: {arm64.ABPL, arm64.ABMI}, ssa.BlockARM64GEnoov: {arm64.ABPL, arm64.ABMI},
} }
// To model a 'LEnoov' ('<=' without overflow checking) branching // To model a 'LEnoov' ('<=' without overflow checking) branching.
var leJumps = [2][2]ssagen.IndexJump{ var leJumps = [2][2]ssagen.IndexJump{
{{Jump: arm64.ABEQ, Index: 0}, {Jump: arm64.ABPL, Index: 1}}, // next == b.Succs[0] {{Jump: arm64.ABEQ, Index: 0}, {Jump: arm64.ABPL, Index: 1}}, // next == b.Succs[0]
{{Jump: arm64.ABMI, Index: 0}, {Jump: arm64.ABEQ, Index: 0}}, // next == b.Succs[1] {{Jump: arm64.ABMI, Index: 0}, {Jump: arm64.ABEQ, Index: 0}}, // next == b.Succs[1]
} }
// To model a 'GTnoov' ('>' without overflow checking) branching // To model a 'GTnoov' ('>' without overflow checking) branching.
var gtJumps = [2][2]ssagen.IndexJump{ var gtJumps = [2][2]ssagen.IndexJump{
{{Jump: arm64.ABMI, Index: 1}, {Jump: arm64.ABEQ, Index: 1}}, // next == b.Succs[0] {{Jump: arm64.ABMI, Index: 1}, {Jump: arm64.ABEQ, Index: 1}}, // next == b.Succs[0]
{{Jump: arm64.ABEQ, Index: 1}, {Jump: arm64.ABPL, Index: 0}}, // next == b.Succs[1] {{Jump: arm64.ABEQ, Index: 1}, {Jump: arm64.ABPL, Index: 0}}, // next == b.Succs[1]

View file

@ -36,7 +36,7 @@ func Errors() int {
return numErrors return numErrors
} }
// SyntaxErrors returns the number of syntax errors reported // SyntaxErrors returns the number of syntax errors reported.
func SyntaxErrors() int { func SyntaxErrors() int {
return numSyntaxErrors return numSyntaxErrors
} }

View file

@ -94,7 +94,7 @@ func (l leaks) Encode() string {
return s return s
} }
// parseLeaks parses a binary string representing a leaks // parseLeaks parses a binary string representing a leaks.
func parseLeaks(s string) leaks { func parseLeaks(s string) leaks {
var l leaks var l leaks
if !strings.HasPrefix(s, "esc:") { if !strings.HasPrefix(s, "esc:") {

View file

@ -299,7 +299,7 @@ func MarkFunc(n *Name) {
} }
// ClosureDebugRuntimeCheck applies boilerplate checks for debug flags // ClosureDebugRuntimeCheck applies boilerplate checks for debug flags
// and compiling runtime // and compiling runtime.
func ClosureDebugRuntimeCheck(clo *ClosureExpr) { func ClosureDebugRuntimeCheck(clo *ClosureExpr) {
if base.Debug.Closure > 0 { if base.Debug.Closure > 0 {
if clo.Esc() == EscHeap { if clo.Esc() == EscHeap {

View file

@ -296,7 +296,7 @@ func (lv *liveness) valueEffects(v *ssa.Value) (int32, liveEffect) {
return -1, 0 return -1, 0
} }
// affectedVar returns the *ir.Name node affected by v // affectedVar returns the *ir.Name node affected by v.
func affectedVar(v *ssa.Value) (*ir.Name, ssa.SymEffect) { func affectedVar(v *ssa.Value) (*ir.Name, ssa.SymEffect) {
// Special cases. // Special cases.
switch v.Op { switch v.Op {

View file

@ -304,7 +304,7 @@ func parseLogPath(destination string) (string, string) {
// checkLogPath does superficial early checking of the string specifying // checkLogPath does superficial early checking of the string specifying
// the directory to which optimizer logging is directed, and if // the directory to which optimizer logging is directed, and if
// it passes the test, stores the string in LO_dir // it passes the test, stores the string in LO_dir.
func checkLogPath(destination string) string { func checkLogPath(destination string) string {
path, complaint := parseLogPath(destination) path, complaint := parseLogPath(destination)
if complaint != "" { if complaint != "" {
@ -331,7 +331,7 @@ func NewLoggedOpt(pos src.XPos, what, pass, funcName string, args ...interface{}
// LogOpt logs information about a (usually missed) optimization performed by the compiler. // LogOpt logs information about a (usually missed) optimization performed by the compiler.
// Pos is the source position (including inlining), what is the message, pass is which pass created the message, // Pos is the source position (including inlining), what is the message, pass is which pass created the message,
// funcName is the name of the function // funcName is the name of the function.
func LogOpt(pos src.XPos, what, pass, funcName string, args ...interface{}) { func LogOpt(pos src.XPos, what, pass, funcName string, args ...interface{}) {
if Format == None { if Format == None {
return return
@ -499,13 +499,13 @@ func newPointRange(p src.Pos) Range {
End: Position{p.Line(), p.Col()}} End: Position{p.Line(), p.Col()}}
} }
// newLocation returns the Location for the compiler source location p // newLocation returns the Location for the compiler source location p.
func newLocation(p src.Pos) Location { func newLocation(p src.Pos) Location {
loc := Location{URI: uriIfy(uprootedPath(p.Filename())), Range: newPointRange(p)} loc := Location{URI: uriIfy(uprootedPath(p.Filename())), Range: newPointRange(p)}
return loc return loc
} }
// appendInlinedPos extracts inlining information from posTmp and append it to diagnostic // appendInlinedPos extracts inlining information from posTmp and append it to diagnostic.
func appendInlinedPos(posTmp []src.Pos, diagnostic *Diagnostic) { func appendInlinedPos(posTmp []src.Pos, diagnostic *Diagnostic) {
for i := 1; i < len(posTmp); i++ { for i := 1; i < len(posTmp); i++ {
p := posTmp[i] p := posTmp[i]

View file

@ -17,7 +17,7 @@ import (
"cmd/internal/obj/loong64" "cmd/internal/obj/loong64"
) )
// isFPreg reports whether r is an FP register // isFPreg reports whether r is an FP register.
func isFPreg(r int16) bool { func isFPreg(r int16) bool {
return loong64.REG_F0 <= r && r <= loong64.REG_F31 return loong64.REG_F0 <= r && r <= loong64.REG_F31
} }

View file

@ -17,12 +17,12 @@ import (
"cmd/internal/obj/mips" "cmd/internal/obj/mips"
) )
// isFPreg reports whether r is an FP register // isFPreg reports whether r is an FP register.
func isFPreg(r int16) bool { func isFPreg(r int16) bool {
return mips.REG_F0 <= r && r <= mips.REG_F31 return mips.REG_F0 <= r && r <= mips.REG_F31
} }
// isHILO reports whether r is HI or LO register // isHILO reports whether r is HI or LO register.
func isHILO(r int16) bool { func isHILO(r int16) bool {
return r == mips.REG_HI || r == mips.REG_LO return r == mips.REG_HI || r == mips.REG_LO
} }

View file

@ -17,12 +17,12 @@ import (
"cmd/internal/obj/mips" "cmd/internal/obj/mips"
) )
// isFPreg reports whether r is an FP register // isFPreg reports whether r is an FP register.
func isFPreg(r int16) bool { func isFPreg(r int16) bool {
return mips.REG_F0 <= r && r <= mips.REG_F31 return mips.REG_F0 <= r && r <= mips.REG_F31
} }
// isHILO reports whether r is HI or LO register // isHILO reports whether r is HI or LO register.
func isHILO(r int16) bool { func isHILO(r int16) bool {
return r == mips.REG_HI || r == mips.REG_LO return r == mips.REG_HI || r == mips.REG_LO
} }

View file

@ -179,7 +179,7 @@ func (f *Func) dfsOrig(entry *Block, succFn linkedBlocks, semi, vertex, label, p
return n return n
} }
// compressOrig is the "simple" compress function from LT paper // compressOrig is the "simple" compress function from LT paper.
func compressOrig(v ID, ancestor, semi, label []ID) { func compressOrig(v ID, ancestor, semi, label []ID) {
if ancestor[ancestor[v]] != 0 { if ancestor[ancestor[v]] != 0 {
compressOrig(ancestor[v], ancestor, semi, label) compressOrig(ancestor[v], ancestor, semi, label)
@ -190,7 +190,7 @@ func compressOrig(v ID, ancestor, semi, label []ID) {
} }
} }
// evalOrig is the "simple" eval function from LT paper // evalOrig is the "simple" eval function from LT paper.
func evalOrig(v ID, ancestor, semi, label []ID) ID { func evalOrig(v ID, ancestor, semi, label []ID) ID {
if ancestor[v] == 0 { if ancestor[v] == 0 {
return v return v

View file

@ -401,7 +401,7 @@ outer:
} }
} }
// findLastMems maps block ids to last memory-output op in a block, if any // findLastMems maps block ids to last memory-output op in a block, if any.
func findLastMems(f *Func) []*Value { func findLastMems(f *Func) []*Value {
var stores []*Value var stores []*Value

View file

@ -4,7 +4,7 @@
package ssa package ssa
// convert to machine-dependent ops // convert to machine-dependent ops.
func lower(f *Func) { func lower(f *Func) {
// repeat rewrites until we find no more rewrites // repeat rewrites until we find no more rewrites
applyRewrite(f, f.Config.lowerBlock, f.Config.lowerValue, removeDeadValues) applyRewrite(f, f.Config.lowerBlock, f.Config.lowerValue, removeDeadValues)

View file

@ -269,7 +269,7 @@ func (a *AuxCall) SizeOfArg(which int64) int64 {
return a.TypeOfArg(which).Size() return a.TypeOfArg(which).Size()
} }
// NResults returns the number of results // NResults returns the number of results.
func (a *AuxCall) NResults() int64 { func (a *AuxCall) NResults() int64 {
return int64(len(a.abiInfo.OutParams())) return int64(len(a.abiInfo.OutParams()))
} }
@ -335,7 +335,7 @@ func ClosureAuxCall(paramResultInfo *abi.ABIParamResultInfo) *AuxCall {
func (*AuxCall) CanBeAnSSAAux() {} func (*AuxCall) CanBeAnSSAAux() {}
// OwnAuxCall returns a function's own AuxCall // OwnAuxCall returns a function's own AuxCall.
func OwnAuxCall(fn *obj.LSym, paramResultInfo *abi.ABIParamResultInfo) *AuxCall { func OwnAuxCall(fn *obj.LSym, paramResultInfo *abi.ABIParamResultInfo) *AuxCall {
// TODO if this remains identical to ClosureAuxCall above after new ABI is done, should deduplicate. // TODO if this remains identical to ClosureAuxCall above after new ABI is done, should deduplicate.
var reg *regInfo var reg *regInfo

View file

@ -4,7 +4,7 @@
package ssa package ssa
// machine-independent optimization // machine-independent optimization.
func opt(f *Func) { func opt(f *Func) {
applyRewrite(f, rewriteBlockgeneric, rewriteValuegeneric, removeDeadValues) applyRewrite(f, rewriteBlockgeneric, rewriteValuegeneric, removeDeadValues)
} }

View file

@ -1604,7 +1604,7 @@ func isConstDelta(v *Value) (w *Value, delta int64) {
} }
// isCleanExt reports whether v is the result of a value-preserving // isCleanExt reports whether v is the result of a value-preserving
// sign or zero extension // sign or zero extension.
func isCleanExt(v *Value) bool { func isCleanExt(v *Value) bool {
switch v.Op { switch v.Op {
case OpSignExt8to16, OpSignExt8to32, OpSignExt8to64, case OpSignExt8to16, OpSignExt8to32, OpSignExt8to64,

View file

@ -412,13 +412,13 @@ func canMergeLoad(target, load *Value) bool {
return true return true
} }
// isSameCall reports whether sym is the same as the given named symbol // isSameCall reports whether sym is the same as the given named symbol.
func isSameCall(sym interface{}, name string) bool { func isSameCall(sym interface{}, name string) bool {
fn := sym.(*AuxCall).Fn fn := sym.(*AuxCall).Fn
return fn != nil && fn.String() == name return fn != nil && fn.String() == name
} }
// canLoadUnaligned reports if the architecture supports unaligned load operations // canLoadUnaligned reports if the architecture supports unaligned load operations.
func canLoadUnaligned(c *Config) bool { func canLoadUnaligned(c *Config) bool {
return c.ctxt.Arch.Alignment == 1 return c.ctxt.Arch.Alignment == 1
} }
@ -797,7 +797,7 @@ func loadLSymOffset(lsym *obj.LSym, offset int64) *obj.LSym {
} }
// de-virtualize an InterLECall // de-virtualize an InterLECall
// 'sym' is the symbol for the itab // 'sym' is the symbol for the itab.
func devirtLESym(v *Value, aux Aux, sym Sym, offset int64) *obj.LSym { func devirtLESym(v *Value, aux Aux, sym Sym, offset int64) *obj.LSym {
n, ok := sym.(*obj.LSym) n, ok := sym.(*obj.LSym)
if !ok { if !ok {
@ -898,7 +898,7 @@ func disjoint(p1 *Value, n1 int64, p2 *Value, n2 int64) bool {
return false return false
} }
// moveSize returns the number of bytes an aligned MOV instruction moves // moveSize returns the number of bytes an aligned MOV instruction moves.
func moveSize(align int64, c *Config) int64 { func moveSize(align int64, c *Config) int64 {
switch { switch {
case align%8 == 0 && c.PtrSize == 8: case align%8 == 0 && c.PtrSize == 8:
@ -1019,7 +1019,7 @@ func warnRule(cond bool, v *Value, s string) bool {
return true return true
} }
// for a pseudo-op like (LessThan x), extract x // for a pseudo-op like (LessThan x), extract x.
func flagArg(v *Value) *Value { func flagArg(v *Value) *Value {
if len(v.Args) != 1 || !v.Args[0].Type.IsFlags() { if len(v.Args) != 1 || !v.Args[0].Type.IsFlags() {
return nil return nil
@ -1250,7 +1250,7 @@ func reciprocalExact32(c float32) bool {
} }
} }
// check if an immediate can be directly encoded into an ARM's instruction // check if an immediate can be directly encoded into an ARM's instruction.
func isARMImmRot(v uint32) bool { func isARMImmRot(v uint32) bool {
for i := 0; i < 16; i++ { for i := 0; i < 16; i++ {
if v&^0xff == 0 { if v&^0xff == 0 {
@ -1312,7 +1312,7 @@ func zeroUpper32Bits(x *Value, depth int) bool {
return false return false
} }
// zeroUpper48Bits is similar to zeroUpper32Bits, but for upper 48 bits // zeroUpper48Bits is similar to zeroUpper32Bits, but for upper 48 bits.
func zeroUpper48Bits(x *Value, depth int) bool { func zeroUpper48Bits(x *Value, depth int) bool {
switch x.Op { switch x.Op {
case OpAMD64MOVWQZX, OpAMD64MOVWload, OpAMD64MOVWloadidx1, OpAMD64MOVWloadidx2: case OpAMD64MOVWQZX, OpAMD64MOVWload, OpAMD64MOVWloadidx1, OpAMD64MOVWloadidx2:
@ -1336,7 +1336,7 @@ func zeroUpper48Bits(x *Value, depth int) bool {
return false return false
} }
// zeroUpper56Bits is similar to zeroUpper32Bits, but for upper 56 bits // zeroUpper56Bits is similar to zeroUpper32Bits, but for upper 56 bits.
func zeroUpper56Bits(x *Value, depth int) bool { func zeroUpper56Bits(x *Value, depth int) bool {
switch x.Op { switch x.Op {
case OpAMD64MOVBQZX, OpAMD64MOVBload, OpAMD64MOVBloadidx1: case OpAMD64MOVBQZX, OpAMD64MOVBload, OpAMD64MOVBloadidx1:
@ -1486,7 +1486,7 @@ func encodePPC64RotateMask(rotate, mask, nbits int64) int64 {
return int64(me) | int64(mb<<8) | int64(rotate<<16) | int64(nbits<<24) return int64(me) | int64(mb<<8) | int64(rotate<<16) | int64(nbits<<24)
} }
// The inverse operation of encodePPC64RotateMask. The values returned as // DecodePPC64RotateMask is the inverse operation of encodePPC64RotateMask. The values returned as
// mb and me satisfy the POWER ISA definition of MASK(x,y) where MASK(mb,me) = mask. // mb and me satisfy the POWER ISA definition of MASK(x,y) where MASK(mb,me) = mask.
func DecodePPC64RotateMask(sauxint int64) (rotate, mb, me int64, mask uint64) { func DecodePPC64RotateMask(sauxint int64) (rotate, mb, me int64, mask uint64) {
auxint := uint64(sauxint) auxint := uint64(sauxint)
@ -1625,7 +1625,7 @@ func isARM64BFMask(lsb, mask, rshift int64) bool {
return shiftedMask != 0 && isPowerOfTwo64(shiftedMask+1) && nto(shiftedMask)+lsb < 64 return shiftedMask != 0 && isPowerOfTwo64(shiftedMask+1) && nto(shiftedMask)+lsb < 64
} }
// returns the bitfield width of mask >> rshift for arm64 bitfield ops // returns the bitfield width of mask >> rshift for arm64 bitfield ops.
func arm64BFWidth(mask, rshift int64) int64 { func arm64BFWidth(mask, rshift int64) int64 {
shiftedMask := int64(uint64(mask) >> uint64(rshift)) shiftedMask := int64(uint64(mask) >> uint64(rshift))
if shiftedMask == 0 { if shiftedMask == 0 {

View file

@ -13,7 +13,7 @@ type sparseSet struct {
} }
// newSparseSet returns a sparseSet that can represent // newSparseSet returns a sparseSet that can represent
// integers between 0 and n-1 // integers between 0 and n-1.
func newSparseSet(n int) *sparseSet { func newSparseSet(n int) *sparseSet {
return &sparseSet{dense: nil, sparse: make([]int32, n)} return &sparseSet{dense: nil, sparse: make([]int32, n)}
} }

View file

@ -55,7 +55,7 @@ const (
// such as whether one block dominates another. // such as whether one block dominates another.
type SparseTree []SparseTreeNode type SparseTree []SparseTreeNode
// newSparseTree creates a SparseTree from a block-to-parent map (array indexed by Block.ID) // newSparseTree creates a SparseTree from a block-to-parent map (array indexed by Block.ID).
func newSparseTree(f *Func, parentOf []*Block) SparseTree { func newSparseTree(f *Func, parentOf []*Block) SparseTree {
t := make(SparseTree, f.NumBlocks()) t := make(SparseTree, f.NumBlocks())
for _, b := range f.Blocks { for _, b := range f.Blocks {
@ -184,7 +184,7 @@ func (t SparseTree) Parent(x *Block) *Block {
return t[x.ID].parent return t[x.ID].parent
} }
// isAncestorEq reports whether x is an ancestor of or equal to y. // IsAncestorEq reports whether x is an ancestor of or equal to y.
func (t SparseTree) IsAncestorEq(x, y *Block) bool { func (t SparseTree) IsAncestorEq(x, y *Block) bool {
if x == y { if x == y {
return true return true

View file

@ -118,7 +118,7 @@ func trim(f *Func) {
} }
// emptyBlock reports whether the block does not contain actual // emptyBlock reports whether the block does not contain actual
// instructions // instructions.
func emptyBlock(b *Block) bool { func emptyBlock(b *Block) bool {
for _, v := range b.Values { for _, v := range b.Values {
if v.Op != OpPhi { if v.Op != OpPhi {
@ -130,11 +130,11 @@ func emptyBlock(b *Block) bool {
// trimmableBlock reports whether the block can be trimmed from the CFG, // trimmableBlock reports whether the block can be trimmed from the CFG,
// subject to the following criteria: // subject to the following criteria:
// - it should not be the first block // - it should not be the first block.
// - it should be BlockPlain // - it should be BlockPlain.
// - it should not loop back to itself // - it should not loop back to itself.
// - it either is the single predecessor of the successor block or // - it either is the single predecessor of the successor block or
// contains no actual instructions // contains no actual instructions.
func trimmableBlock(b *Block) bool { func trimmableBlock(b *Block) bool {
if b.Kind != BlockPlain || b == b.Func.Entry { if b.Kind != BlockPlain || b == b.Func.Entry {
return false return false

View file

@ -536,7 +536,7 @@ func wbcall(pos src.XPos, b *Block, fn, typ *obj.LSym, ptr, val, mem, sp, sb *Va
return b.NewValue1I(pos, OpSelectN, types.TypeMem, 0, call) return b.NewValue1I(pos, OpSelectN, types.TypeMem, 0, call)
} }
// round to a multiple of r, r is a power of 2 // round to a multiple of r, r is a power of 2.
func round(o int64, r int64) int64 { func round(o int64, r int64) int64 {
return (o + r - 1) &^ (r - 1) return (o + r - 1) &^ (r - 1)
} }

View file

@ -45,7 +45,7 @@ type nowritebarrierrecCall struct {
} }
// newNowritebarrierrecChecker creates a nowritebarrierrecChecker. It // newNowritebarrierrecChecker creates a nowritebarrierrecChecker. It
// must be called before walk // must be called before walk.
func newNowritebarrierrecChecker() *nowritebarrierrecChecker { func newNowritebarrierrecChecker() *nowritebarrierrecChecker {
c := &nowritebarrierrecChecker{ c := &nowritebarrierrecChecker{
extraCalls: make(map[*ir.Func][]nowritebarrierrecCall), extraCalls: make(map[*ir.Func][]nowritebarrierrecCall),

View file

@ -424,7 +424,7 @@ type sparseSet struct {
} }
// newSparseSet returns a sparseSet that can represent // newSparseSet returns a sparseSet that can represent
// integers between 0 and n-1 // integers between 0 and n-1.
func newSparseSet(n int) *sparseSet { func newSparseSet(n int) *sparseSet {
return &sparseSet{dense: nil, sparse: make([]int32, n)} return &sparseSet{dense: nil, sparse: make([]int32, n)}
} }

View file

@ -252,7 +252,7 @@ func abiForFunc(fn *ir.Func, abi0, abi1 *abi.ABIConfig) *abi.ABIConfig {
return a return a
} }
// dvarint writes a varint v to the funcdata in symbol x and returns the new offset // dvarint writes a varint v to the funcdata in symbol x and returns the new offset.
func dvarint(x *obj.LSym, off int, v int64) int { func dvarint(x *obj.LSym, off int, v int64) int {
if v < 0 || v > 1e9 { if v < 0 || v > 1e9 {
panic(fmt.Sprintf("dvarint: bad offset for funcdata - %v", v)) panic(fmt.Sprintf("dvarint: bad offset for funcdata - %v", v))

View file

@ -238,7 +238,7 @@ func Temp(t *types.Type) *ir.Name {
return TempAt(base.Pos, ir.CurFunc, t) return TempAt(base.Pos, ir.CurFunc, t)
} }
// make a new Node off the books // make a new Node off the books.
func TempAt(pos src.XPos, curfn *ir.Func, t *types.Type) *ir.Name { func TempAt(pos src.XPos, curfn *ir.Func, t *types.Type) *ir.Name {
if curfn == nil { if curfn == nil {
base.Fatalf("no curfn for TempAt") base.Fatalf("no curfn for TempAt")

View file

@ -14,13 +14,13 @@ import (
) )
// importalias declares symbol s as an imported type alias with type t. // importalias declares symbol s as an imported type alias with type t.
// ipkg is the package being imported // ipkg is the package being imported.
func importalias(pos src.XPos, s *types.Sym, t *types.Type) *ir.Name { func importalias(pos src.XPos, s *types.Sym, t *types.Type) *ir.Name {
return importobj(pos, s, ir.OTYPE, ir.PEXTERN, t) return importobj(pos, s, ir.OTYPE, ir.PEXTERN, t)
} }
// importconst declares symbol s as an imported constant with type t and value val. // importconst declares symbol s as an imported constant with type t and value val.
// ipkg is the package being imported // ipkg is the package being imported.
func importconst(pos src.XPos, s *types.Sym, t *types.Type, val constant.Value) *ir.Name { func importconst(pos src.XPos, s *types.Sym, t *types.Type, val constant.Value) *ir.Name {
n := importobj(pos, s, ir.OLITERAL, ir.PEXTERN, t) n := importobj(pos, s, ir.OLITERAL, ir.PEXTERN, t)
n.SetVal(val) n.SetVal(val)
@ -28,7 +28,7 @@ func importconst(pos src.XPos, s *types.Sym, t *types.Type, val constant.Value)
} }
// importfunc declares symbol s as an imported function with type t. // importfunc declares symbol s as an imported function with type t.
// ipkg is the package being imported // ipkg is the package being imported.
func importfunc(pos src.XPos, s *types.Sym, t *types.Type) *ir.Name { func importfunc(pos src.XPos, s *types.Sym, t *types.Type) *ir.Name {
n := importobj(pos, s, ir.ONAME, ir.PFUNC, t) n := importobj(pos, s, ir.ONAME, ir.PFUNC, t)
n.Func = ir.NewFunc(pos) n.Func = ir.NewFunc(pos)
@ -37,7 +37,7 @@ func importfunc(pos src.XPos, s *types.Sym, t *types.Type) *ir.Name {
} }
// importobj declares symbol s as an imported object representable by op. // importobj declares symbol s as an imported object representable by op.
// ipkg is the package being imported // ipkg is the package being imported.
func importobj(pos src.XPos, s *types.Sym, op ir.Op, ctxt ir.Class, t *types.Type) *ir.Name { func importobj(pos src.XPos, s *types.Sym, op ir.Op, ctxt ir.Class, t *types.Type) *ir.Name {
n := importsym(pos, s, op, ctxt) n := importsym(pos, s, op, ctxt)
n.SetType(t) n.SetType(t)
@ -60,7 +60,7 @@ func importsym(pos src.XPos, s *types.Sym, op ir.Op, ctxt ir.Class) *ir.Name {
// importtype returns the named type declared by symbol s. // importtype returns the named type declared by symbol s.
// If no such type has been declared yet, a forward declaration is returned. // If no such type has been declared yet, a forward declaration is returned.
// ipkg is the package being imported // ipkg is the package being imported.
func importtype(pos src.XPos, s *types.Sym) *ir.Name { func importtype(pos src.XPos, s *types.Sym) *ir.Name {
n := importsym(pos, s, ir.OTYPE, ir.PEXTERN) n := importsym(pos, s, ir.OTYPE, ir.PEXTERN)
n.SetType(types.NewNamed(n)) n.SetType(types.NewNamed(n))
@ -68,7 +68,7 @@ func importtype(pos src.XPos, s *types.Sym) *ir.Name {
} }
// importvar declares symbol s as an imported variable with type t. // importvar declares symbol s as an imported variable with type t.
// ipkg is the package being imported // ipkg is the package being imported.
func importvar(pos src.XPos, s *types.Sym, t *types.Type) *ir.Name { func importvar(pos src.XPos, s *types.Sym, t *types.Type) *ir.Name {
return importobj(pos, s, ir.ONAME, ir.PEXTERN, t) return importobj(pos, s, ir.ONAME, ir.PEXTERN, t)
} }

View file

@ -1484,7 +1484,7 @@ func fmtSignature(nl ir.Nodes, isddd bool) string {
return fmt.Sprintf("(%s)", strings.Join(typeStrings, ", ")) return fmt.Sprintf("(%s)", strings.Join(typeStrings, ", "))
} }
// type check composite // type check composite.
func fielddup(name string, hash map[string]bool) { func fielddup(name string, hash map[string]bool) {
if hash[name] { if hash[name] {
base.Errorf("duplicate field name in struct literal: %s", name) base.Errorf("duplicate field name in struct literal: %s", name)

View file

@ -513,7 +513,7 @@ func walkNew(n *ir.UnaryExpr, init *ir.Nodes) ir.Node {
return n return n
} }
// generate code for print // generate code for print.
func walkPrint(nn *ir.CallExpr, init *ir.Nodes) ir.Node { func walkPrint(nn *ir.CallExpr, init *ir.Nodes) ir.Node {
// Hoist all the argument evaluation up before the lock. // Hoist all the argument evaluation up before the lock.
walkExprListCheap(nn.Args, init) walkExprListCheap(nn.Args, init)

View file

@ -346,7 +346,7 @@ func walkExpr1(n ir.Node, init *ir.Nodes) ir.Node {
// expression or simple statement. // expression or simple statement.
// the types expressions are calculated. // the types expressions are calculated.
// compile-time constants are evaluated. // compile-time constants are evaluated.
// complex side effects like statements are appended to init // complex side effects like statements are appended to init.
func walkExprList(s []ir.Node, init *ir.Nodes) { func walkExprList(s []ir.Node, init *ir.Nodes) {
for i := range s { for i := range s {
s[i] = walkExpr(s[i], init) s[i] = walkExpr(s[i], init)
@ -867,7 +867,7 @@ func walkStringHeader(n *ir.StringHeaderExpr, init *ir.Nodes) ir.Node {
return n return n
} }
// return 1 if integer n must be in range [0, max), 0 otherwise // return 1 if integer n must be in range [0, max), 0 otherwise.
func bounded(n ir.Node, max int64) bool { func bounded(n ir.Node, max int64) bool {
if n.Type() == nil || !n.Type().IsInteger() { if n.Type() == nil || !n.Type().IsInteger() {
return false return false

View file

@ -379,7 +379,7 @@ func errprintf(format string, args ...interface{}) {
fmt.Fprintf(os.Stderr, format, args...) fmt.Fprintf(os.Stderr, format, args...)
} }
// xsamefile reports whether f1 and f2 are the same file (or dir) // xsamefile reports whether f1 and f2 are the same file (or dir).
func xsamefile(f1, f2 string) bool { func xsamefile(f1, f2 string) bool {
fi1, err1 := os.Stat(f1) fi1, err1 := os.Stat(f1)
fi2, err2 := os.Stat(f2) fi2, err2 := os.Stat(f2)

View file

@ -408,7 +408,7 @@ type modSumStatus struct {
} }
// Reset resets globals in the modfetch package, so previous loads don't affect // Reset resets globals in the modfetch package, so previous loads don't affect
// contents of go.sum files // contents of go.sum files.
func Reset() { func Reset() {
GoSumFile = "" GoSumFile = ""
WorkspaceGoSumFiles = nil WorkspaceGoSumFiles = nil

View file

@ -1159,8 +1159,8 @@ func isEmptyInlinedCall(slot int, calls *InlCalls) bool {
return !live return !live
} }
// Slot -1: return top-level inlines // Slot -1: return top-level inlines.
// Slot >= 0: return children of that slot // Slot >= 0: return children of that slot.
func inlChildren(slot int, calls *InlCalls) []int { func inlChildren(slot int, calls *InlCalls) []int {
var kids []int var kids []int
if slot != -1 { if slot != -1 {

View file

@ -1525,7 +1525,7 @@ func isbitcon(x uint64) bool {
return sequenceOfOnes(x) || sequenceOfOnes(^x) return sequenceOfOnes(x) || sequenceOfOnes(^x)
} }
// sequenceOfOnes tests whether a constant is a sequence of ones in binary, with leading and trailing zeros // sequenceOfOnes tests whether a constant is a sequence of ones in binary, with leading and trailing zeros.
func sequenceOfOnes(x uint64) bool { func sequenceOfOnes(x uint64) bool {
y := x & -x // lowest set bit of x. x is good iff x+y is a power of 2 y := x & -x // lowest set bit of x. x is good iff x+y is a power of 2
y += x y += x
@ -1778,7 +1778,7 @@ func (c *ctxt7) offsetshift(p *obj.Prog, v int64, cls int) int64 {
/* /*
* if v contains a single 16-bit value aligned * if v contains a single 16-bit value aligned
* on a 16-bit field, and thus suitable for movk/movn, * on a 16-bit field, and thus suitable for movk/movn,
* return the field index 0 to 3; otherwise return -1 * return the field index 0 to 3; otherwise return -1.
*/ */
func movcon(v int64) int { func movcon(v int64) int {
for s := 0; s < 64; s += 16 { for s := 0; s < 64; s += 16 {

View file

@ -1092,7 +1092,7 @@ func OP_IR(op uint32, i uint32, r2 uint32) uint32 {
return op | (i&0xFFFFF)<<5 | (r2&0x1F)<<0 // ui20, rd5 return op | (i&0xFFFFF)<<5 | (r2&0x1F)<<0 // ui20, rd5
} }
// Encoding for the 'b' or 'bl' instruction // Encoding for the 'b' or 'bl' instruction.
func OP_B_BL(op uint32, i uint32) uint32 { func OP_B_BL(op uint32, i uint32) uint32 {
return op | ((i & 0xFFFF) << 10) | ((i >> 16) & 0x3FF) return op | ((i & 0xFFFF) << 10) | ((i >> 16) & 0x3FF)
} }

View file

@ -539,7 +539,7 @@ var oprange [ALAST & obj.AMask][]Optab
var xcmp [C_NCLASS][C_NCLASS]bool var xcmp [C_NCLASS][C_NCLASS]bool
// padding bytes to add to align code as requested // padding bytes to add to align code as requested.
func addpad(pc, a int64, ctxt *obj.Link, cursym *obj.LSym) int { func addpad(pc, a int64, ctxt *obj.Link, cursym *obj.LSym) int {
// For 16 and 32 byte alignment, there is a tradeoff // For 16 and 32 byte alignment, there is a tradeoff
// between aligning the code and adding too many NOPs. // between aligning the code and adding too many NOPs.
@ -2105,7 +2105,7 @@ func OPMD(o, xo, rc uint32) uint32 {
return o<<26 | xo<<2 | rc&1 return o<<26 | xo<<2 | rc&1
} }
/* the order is dest, a/s, b/imm for both arithmetic and logical operations */ /* the order is dest, a/s, b/imm for both arithmetic and logical operations. */
func AOP_RRR(op uint32, d uint32, a uint32, b uint32) uint32 { func AOP_RRR(op uint32, d uint32, a uint32, b uint32) uint32 {
return op | (d&31)<<21 | (a&31)<<16 | (b&31)<<11 return op | (d&31)<<21 | (a&31)<<16 | (b&31)<<11
} }

View file

@ -4374,12 +4374,12 @@ func (c *ctxtz) regoff(a *obj.Addr) int32 {
return int32(c.vregoff(a)) return int32(c.vregoff(a))
} }
// find if the displacement is within 12 bit // find if the displacement is within 12 bit.
func isU12(displacement int32) bool { func isU12(displacement int32) bool {
return displacement >= 0 && displacement < DISP12 return displacement >= 0 && displacement < DISP12
} }
// zopload12 returns the RX op with 12 bit displacement for the given load // zopload12 returns the RX op with 12 bit displacement for the given load.
func (c *ctxtz) zopload12(a obj.As) (uint32, bool) { func (c *ctxtz) zopload12(a obj.As) (uint32, bool) {
switch a { switch a {
case AFMOVD: case AFMOVD:
@ -4390,7 +4390,7 @@ func (c *ctxtz) zopload12(a obj.As) (uint32, bool) {
return 0, false return 0, false
} }
// zopload returns the RXY op for the given load // zopload returns the RXY op for the given load.
func (c *ctxtz) zopload(a obj.As) uint32 { func (c *ctxtz) zopload(a obj.As) uint32 {
switch a { switch a {
// fixed point load // fixed point load
@ -4428,7 +4428,7 @@ func (c *ctxtz) zopload(a obj.As) uint32 {
return 0 return 0
} }
// zopstore12 returns the RX op with 12 bit displacement for the given store // zopstore12 returns the RX op with 12 bit displacement for the given store.
func (c *ctxtz) zopstore12(a obj.As) (uint32, bool) { func (c *ctxtz) zopstore12(a obj.As) (uint32, bool) {
switch a { switch a {
case AFMOVD: case AFMOVD:
@ -4445,7 +4445,7 @@ func (c *ctxtz) zopstore12(a obj.As) (uint32, bool) {
return 0, false return 0, false
} }
// zopstore returns the RXY op for the given store // zopstore returns the RXY op for the given store.
func (c *ctxtz) zopstore(a obj.As) uint32 { func (c *ctxtz) zopstore(a obj.As) uint32 {
switch a { switch a {
// fixed point store // fixed point store
@ -4477,7 +4477,7 @@ func (c *ctxtz) zopstore(a obj.As) uint32 {
return 0 return 0
} }
// zoprre returns the RRE op for the given a // zoprre returns the RRE op for the given a.
func (c *ctxtz) zoprre(a obj.As) uint32 { func (c *ctxtz) zoprre(a obj.As) uint32 {
switch a { switch a {
case ACMP: case ACMP:
@ -4495,7 +4495,7 @@ func (c *ctxtz) zoprre(a obj.As) uint32 {
return 0 return 0
} }
// zoprr returns the RR op for the given a // zoprr returns the RR op for the given a.
func (c *ctxtz) zoprr(a obj.As) uint32 { func (c *ctxtz) zoprr(a obj.As) uint32 {
switch a { switch a {
case ACMPW: case ACMPW:
@ -4507,7 +4507,7 @@ func (c *ctxtz) zoprr(a obj.As) uint32 {
return 0 return 0
} }
// zopril returns the RIL op for the given a // zopril returns the RIL op for the given a.
func (c *ctxtz) zopril(a obj.As) uint32 { func (c *ctxtz) zopril(a obj.As) uint32 {
switch a { switch a {
case ACMP: case ACMP:

View file

@ -91,7 +91,7 @@ func gentext(ctxt *ld.Link, ldr *loader.Loader) {
} }
// Preserve highest 8 bits of a, and do addition to lower 24-bit // Preserve highest 8 bits of a, and do addition to lower 24-bit
// of a and b; used to adjust ARM branch instruction's target // of a and b; used to adjust ARM branch instruction's target.
func braddoff(a int32, b int32) int32 { func braddoff(a int32, b int32) int32 {
return int32((uint32(a))&0xff000000 | 0x00ffffff&uint32(a+b)) return int32((uint32(a))&0xff000000 | 0x00ffffff&uint32(a+b))
} }
@ -363,7 +363,7 @@ func pereloc1(arch *sys.Arch, out *ld.OutBuf, ldr *loader.Loader, s loader.Sym,
return true return true
} }
// sign extend a 24-bit integer // sign extend a 24-bit integer.
func signext24(x int64) int32 { func signext24(x int64) int32 {
return (int32(x) << 8) >> 8 return (int32(x) << 8) >> 8
} }
@ -379,7 +379,7 @@ func immrot(v uint32) uint32 {
return 0 return 0
} }
// Convert the direct jump relocation r to refer to a trampoline if the target is too far // Convert the direct jump relocation r to refer to a trampoline if the target is too far.
func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) { func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) {
relocs := ldr.Relocs(s) relocs := ldr.Relocs(s)
r := relocs.At(ri) r := relocs.At(ri)
@ -459,7 +459,7 @@ func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) {
} }
} }
// generate a trampoline to target+offset // generate a trampoline to target+offset.
func gentramp(arch *sys.Arch, linkmode ld.LinkMode, ldr *loader.Loader, tramp *loader.SymbolBuilder, target loader.Sym, offset int64) { func gentramp(arch *sys.Arch, linkmode ld.LinkMode, ldr *loader.Loader, tramp *loader.SymbolBuilder, target loader.Sym, offset int64) {
tramp.SetSize(12) // 3 instructions tramp.SetSize(12) // 3 instructions
P := make([]byte, tramp.Size()) P := make([]byte, tramp.Size())
@ -481,7 +481,7 @@ func gentramp(arch *sys.Arch, linkmode ld.LinkMode, ldr *loader.Loader, tramp *l
} }
} }
// generate a trampoline to target+offset in position independent code // generate a trampoline to target+offset in position independent code.
func gentramppic(arch *sys.Arch, tramp *loader.SymbolBuilder, target loader.Sym, offset int64) { func gentramppic(arch *sys.Arch, tramp *loader.SymbolBuilder, target loader.Sym, offset int64) {
tramp.SetSize(16) // 4 instructions tramp.SetSize(16) // 4 instructions
P := make([]byte, tramp.Size()) P := make([]byte, tramp.Size())
@ -502,7 +502,7 @@ func gentramppic(arch *sys.Arch, tramp *loader.SymbolBuilder, target loader.Sym,
r.SetAdd(offset + 4) r.SetAdd(offset + 4)
} }
// generate a trampoline to target+offset in dynlink mode (using GOT) // generate a trampoline to target+offset in dynlink mode (using GOT).
func gentrampdyn(arch *sys.Arch, tramp *loader.SymbolBuilder, target loader.Sym, offset int64) { func gentrampdyn(arch *sys.Arch, tramp *loader.SymbolBuilder, target loader.Sym, offset int64) {
tramp.SetSize(20) // 5 instructions tramp.SetSize(20) // 5 instructions
o1 := uint32(0xe5900000 | 12<<12 | 15<<16 | 8) // MOVW 8(R15), R12 // R15 is actual pc + 8 o1 := uint32(0xe5900000 | 12<<12 | 15<<16 | 8) // MOVW 8(R15), R12 // R15 is actual pc + 8

View file

@ -1271,7 +1271,7 @@ func offsetLabelName(ldr *loader.Loader, s loader.Sym, off int64) string {
return fmt.Sprintf("%s+%d", ldr.SymExtname(s), off) return fmt.Sprintf("%s+%d", ldr.SymExtname(s), off)
} }
// Convert the direct jump relocation r to refer to a trampoline if the target is too far // Convert the direct jump relocation r to refer to a trampoline if the target is too far.
func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) { func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) {
relocs := ldr.Relocs(s) relocs := ldr.Relocs(s)
r := relocs.At(ri) r := relocs.At(ri)

View file

@ -51,7 +51,7 @@ import (
"sync/atomic" "sync/atomic"
) )
// isRuntimeDepPkg reports whether pkg is the runtime package or its dependency // isRuntimeDepPkg reports whether pkg is the runtime package or its dependency.
func isRuntimeDepPkg(pkg string) bool { func isRuntimeDepPkg(pkg string) bool {
switch pkg { switch pkg {
case "runtime", case "runtime",
@ -2349,7 +2349,7 @@ func (ctxt *Link) textaddress() {
} }
} }
// assigns address for a text symbol, returns (possibly new) section, its number, and the address // assigns address for a text symbol, returns (possibly new) section, its number, and the address.
func assignAddress(ctxt *Link, sect *sym.Section, n int, s loader.Sym, va uint64, isTramp, big bool) (*sym.Section, int, uint64) { func assignAddress(ctxt *Link, sect *sym.Section, n int, s loader.Sym, va uint64, isTramp, big bool) (*sym.Section, int, uint64) {
ldr := ctxt.loader ldr := ctxt.loader
if thearch.AssignAddress != nil { if thearch.AssignAddress != nil {

View file

@ -458,7 +458,7 @@ func elfwritehdr(out *OutBuf) uint32 {
return elf32writehdr(out) return elf32writehdr(out)
} }
/* Taken directly from the definition document for ELF64 */ /* Taken directly from the definition document for ELF64. */
func elfhash(name string) uint32 { func elfhash(name string) uint32 {
var h uint32 var h uint32
for i := 0; i < len(name); i++ { for i := 0; i < len(name); i++ {
@ -1097,7 +1097,7 @@ func elfshname(name string) *ElfShdr {
} }
// Create an ElfShdr for the section with name. // Create an ElfShdr for the section with name.
// Create a duplicate if one already exists with that name // Create a duplicate if one already exists with that name.
func elfshnamedup(name string) *ElfShdr { func elfshnamedup(name string) *ElfShdr {
for i := 0; i < nelfstr; i++ { for i := 0; i < nelfstr; i++ {
if name == elfstr[i].s { if name == elfstr[i].s {

View file

@ -539,7 +539,7 @@ func (f *xcoffFile) getXCOFFscnum(sect *sym.Section) int16 {
} }
// Xcoffinit initialised some internal value and setups // Xcoffinit initialised some internal value and setups
// already known header information // already known header information.
func Xcoffinit(ctxt *Link) { func Xcoffinit(ctxt *Link) {
xfile.dynLibraries = make(map[string]int) xfile.dynLibraries = make(map[string]int)
@ -872,7 +872,7 @@ func (f *xcoffFile) writeSymbolFunc(ctxt *Link, x loader.Sym) []xcoffSym {
return syms return syms
} }
// put function used by genasmsym to write symbol table // put function used by genasmsym to write symbol table.
func putaixsym(ctxt *Link, x loader.Sym, t SymbolType) { func putaixsym(ctxt *Link, x loader.Sym, t SymbolType) {
// All XCOFF symbols generated by this GO symbols // All XCOFF symbols generated by this GO symbols
// Can be a symbol entry or a auxiliary entry // Can be a symbol entry or a auxiliary entry
@ -1355,7 +1355,7 @@ func (ctxt *Link) doxcoff() {
// Currently, this section is created from scratch when assembling the XCOFF file // Currently, this section is created from scratch when assembling the XCOFF file
// according to information retrieved in xfile object. // according to information retrieved in xfile object.
// Create loader section and returns its size // Create loader section and returns its size.
func Loaderblk(ctxt *Link, off uint64) { func Loaderblk(ctxt *Link, off uint64) {
xfile.writeLdrScn(ctxt, off) xfile.writeLdrScn(ctxt, off)
} }
@ -1582,7 +1582,7 @@ func xcoffwrite(ctxt *Link) {
} }
} }
// Generate XCOFF assembly file // Generate XCOFF assembly file.
func asmbXcoff(ctxt *Link) { func asmbXcoff(ctxt *Link) {
ctxt.Out.SeekSet(0) ctxt.Out.SeekSet(0)
fileoff := int64(Segdwarf.Fileoff + Segdwarf.Filelen) fileoff := int64(Segdwarf.Fileoff + Segdwarf.Filelen)

View file

@ -133,7 +133,7 @@ func genpltstub(ctxt *ld.Link, ldr *loader.Loader, r loader.Reloc, s loader.Sym)
return stub.Sym(), firstUse return stub.Sym(), firstUse
} }
// Scan relocs and generate PLT stubs and generate/fixup ABI defined functions created by the linker // Scan relocs and generate PLT stubs and generate/fixup ABI defined functions created by the linker.
func genstubs(ctxt *ld.Link, ldr *loader.Loader) { func genstubs(ctxt *ld.Link, ldr *loader.Loader) {
var stubs []loader.Sym var stubs []loader.Sym
var abifuncs []loader.Sym var abifuncs []loader.Sym
@ -933,7 +933,7 @@ func archrelocaddr(ldr *loader.Loader, target *ld.Target, syms *ld.ArchSyms, r l
return packInstPair(target, o1, o2) return packInstPair(target, o1, o2)
} }
// Determine if the code was compiled so that the TOC register R2 is initialized and maintained // Determine if the code was compiled so that the TOC register R2 is initialized and maintained.
func r2Valid(ctxt *ld.Link) bool { func r2Valid(ctxt *ld.Link) bool {
switch ctxt.BuildMode { switch ctxt.BuildMode {
case ld.BuildModeCArchive, ld.BuildModeCShared, ld.BuildModePIE, ld.BuildModeShared, ld.BuildModePlugin: case ld.BuildModeCArchive, ld.BuildModeCShared, ld.BuildModePIE, ld.BuildModeShared, ld.BuildModePlugin:
@ -943,7 +943,7 @@ func r2Valid(ctxt *ld.Link) bool {
return ctxt.IsSharedGoLink() return ctxt.IsSharedGoLink()
} }
// resolve direct jump relocation r in s, and add trampoline if necessary // resolve direct jump relocation r in s, and add trampoline if necessary.
func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) { func trampoline(ctxt *ld.Link, ldr *loader.Loader, ri int, rs, s loader.Sym) {
// Trampolines are created if the branch offset is too large and the linker cannot insert a call stub to handle it. // Trampolines are created if the branch offset is too large and the linker cannot insert a call stub to handle it.
@ -1462,7 +1462,7 @@ func addpltsym(ctxt *ld.Link, ldr *loader.Loader, s loader.Sym) {
} }
} }
// Generate the glink resolver stub if necessary and return the .glink section // Generate the glink resolver stub if necessary and return the .glink section.
func ensureglinkresolver(ctxt *ld.Link, ldr *loader.Loader) *loader.SymbolBuilder { func ensureglinkresolver(ctxt *ld.Link, ldr *loader.Loader) *loader.SymbolBuilder {
glink := ldr.CreateSymForUpdate(".glink", 0) glink := ldr.CreateSymForUpdate(".glink", 0)
if glink.Size() != 0 { if glink.Size() != 0 {

View file

@ -104,7 +104,7 @@ func statusCodeError(resp *http.Response) error {
// cpuProfileHandler is the Go pprof CPU profile handler URL. // cpuProfileHandler is the Go pprof CPU profile handler URL.
const cpuProfileHandler = "/debug/pprof/profile" const cpuProfileHandler = "/debug/pprof/profile"
// adjustURL applies the duration/timeout values and Go specific defaults // adjustURL applies the duration/timeout values and Go specific defaults.
func adjustURL(source string, duration, timeout time.Duration) (string, time.Duration) { func adjustURL(source string, duration, timeout time.Duration) (string, time.Duration) {
u, err := url.Parse(source) u, err := url.Parse(source)
if err != nil || (u.Host == "" && u.Scheme != "" && u.Scheme != "file") { if err != nil || (u.Host == "" && u.Scheme != "" && u.Scheme != "file") {

View file

@ -297,7 +297,7 @@ func hash4(b []byte) uint32 {
} }
// bulkHash4 will compute hashes using the same // bulkHash4 will compute hashes using the same
// algorithm as hash4 // algorithm as hash4.
func bulkHash4(b []byte, dst []uint32) { func bulkHash4(b []byte, dst []uint32) {
if len(b) < minMatchLength { if len(b) < minMatchLength {
return return

View file

@ -60,7 +60,7 @@ func newHuffmanEncoder(size int) *huffmanEncoder {
return &huffmanEncoder{codes: make([]hcode, size)} return &huffmanEncoder{codes: make([]hcode, size)}
} }
// Generates a HuffmanCode corresponding to the fixed literal table // Generates a HuffmanCode corresponding to the fixed literal table.
func generateFixedLiteralEncoding() *huffmanEncoder { func generateFixedLiteralEncoding() *huffmanEncoder {
h := newHuffmanEncoder(maxNumLit) h := newHuffmanEncoder(maxNumLit)
codes := h.codes codes := h.codes

View file

@ -75,17 +75,17 @@ func matchToken(xlength uint32, xoffset uint32) token {
return token(matchType + xlength<<lengthShift + xoffset) return token(matchType + xlength<<lengthShift + xoffset)
} }
// Returns the literal of a literal token // Returns the literal of a literal token.
func (t token) literal() uint32 { return uint32(t - literalType) } func (t token) literal() uint32 { return uint32(t - literalType) }
// Returns the extra offset of a match token // Returns the extra offset of a match token.
func (t token) offset() uint32 { return uint32(t) & offsetMask } func (t token) offset() uint32 { return uint32(t) & offsetMask }
func (t token) length() uint32 { return uint32((t - matchType) >> lengthShift) } func (t token) length() uint32 { return uint32((t - matchType) >> lengthShift) }
func lengthCode(len uint32) uint32 { return lengthCodes[len] } func lengthCode(len uint32) uint32 { return lengthCodes[len] }
// Returns the offset code corresponding to a specific offset // Returns the offset code corresponding to a specific offset.
func offsetCode(off uint32) uint32 { func offsetCode(off uint32) uint32 {
if off < uint32(len(offsetCodes)) { if off < uint32(len(offsetCodes)) {
return offsetCodes[off] return offsetCodes[off]

View file

@ -83,7 +83,7 @@ var feistelBox [8][64]uint32
var feistelBoxOnce sync.Once var feistelBoxOnce sync.Once
// general purpose function to perform DES block permutations // general purpose function to perform DES block permutations.
func permuteBlock(src uint64, permutation []uint8) (block uint64) { func permuteBlock(src uint64, permutation []uint8) (block uint64) {
for position, n := range permutation { for position, n := range permutation {
bit := (src >> n) & 1 bit := (src >> n) & 1
@ -209,7 +209,7 @@ func permuteFinalBlock(block uint64) uint64 {
} }
// creates 16 28-bit blocks rotated according // creates 16 28-bit blocks rotated according
// to the rotation schedule // to the rotation schedule.
func ksRotate(in uint32) (out []uint32) { func ksRotate(in uint32) (out []uint32) {
out = make([]uint32, 16) out = make([]uint32, 16)
last := in last := in
@ -223,7 +223,7 @@ func ksRotate(in uint32) (out []uint32) {
return return
} }
// creates 16 56-bit subkeys from the original key // creates 16 56-bit subkeys from the original key.
func (c *desCipher) generateSubkeys(keyBytes []byte) { func (c *desCipher) generateSubkeys(keyBytes []byte) {
feistelBoxOnce.Do(initFeistelBox) feistelBoxOnce.Do(initFeistelBox)

View file

@ -36,7 +36,7 @@ func Unreachable() {
panic("boringcrypto: invalid code execution") panic("boringcrypto: invalid code execution")
} }
// provided by runtime to avoid os import // provided by runtime to avoid os import.
func runtime_arg0() string func runtime_arg0() string
func hasSuffix(s, t string) bool { func hasSuffix(s, t string) bool {

View file

@ -47,7 +47,7 @@ func CFStringToString(ref CFRef) string {
return string(b) return string(b)
} }
// TimeToCFDateRef converts a time.Time into an apple CFDateRef // TimeToCFDateRef converts a time.Time into an apple CFDateRef.
func TimeToCFDateRef(t time.Time) CFRef { func TimeToCFDateRef(t time.Time) CFRef {
secs := t.Sub(time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)).Seconds() secs := t.Sub(time.Date(2001, 1, 1, 0, 0, 0, 0, time.UTC)).Seconds()
ref := CFDateCreate(secs) ref := CFDateCreate(secs)

View file

@ -594,7 +594,7 @@ func (s *scanner) error(c byte, context string) int {
return scanError return scanError
} }
// quoteChar formats c as a quoted character literal // quoteChar formats c as a quoted character literal.
func quoteChar(c byte) string { func quoteChar(c byte) string {
// special cases - different from quoted strings // special cases - different from quoted strings
if c == '\'' { if c == '\'' {

View file

@ -112,7 +112,7 @@ func Examples(testFiles ...*ast.File) []*Example {
var outputPrefix = lazyregexp.New(`(?i)^[[:space:]]*(unordered )?output:`) var outputPrefix = lazyregexp.New(`(?i)^[[:space:]]*(unordered )?output:`)
// Extracts the expected output and whether there was a valid output comment // Extracts the expected output and whether there was a valid output comment.
func exampleOutput(b *ast.BlockStmt, comments []*ast.CommentGroup) (output string, unordered, ok bool) { func exampleOutput(b *ast.BlockStmt, comments []*ast.CommentGroup) (output string, unordered, ok bool) {
if _, last := lastComment(b, comments); last != nil { if _, last := lastComment(b, comments); last != nil {
// test that it begins with the correct prefix // test that it begins with the correct prefix

View file

@ -826,7 +826,7 @@ func (d *data) Len() int { return d.n }
func (d *data) Swap(i, j int) { d.swap(i, j) } func (d *data) Swap(i, j int) { d.swap(i, j) }
func (d *data) Less(i, j int) bool { return d.less(i, j) } func (d *data) Less(i, j int) bool { return d.less(i, j) }
// sortBy is a helper function for sorting // sortBy is a helper function for sorting.
func sortBy(less func(i, j int) bool, swap func(i, j int), n int) { func sortBy(less func(i, j int) bool, swap func(i, j int), n int) {
sort.Sort(&data{n, swap, less}) sort.Sort(&data{n, swap, less})
} }

View file

@ -180,7 +180,7 @@ func report(err error) {
errorCount++ errorCount++
} }
// parse may be called concurrently // parse may be called concurrently.
func parse(filename string, src any) (*ast.File, error) { func parse(filename string, src any) (*ast.File, error) {
if *verbose { if *verbose {
fmt.Println(filename) fmt.Println(filename)

View file

@ -18,7 +18,7 @@ const (
//go:noescape //go:noescape
func ppc64SlicingUpdateBy8(crc uint32, table8 *slicing8Table, p []byte) uint32 func ppc64SlicingUpdateBy8(crc uint32, table8 *slicing8Table, p []byte) uint32
// this function requires the buffer to be 16 byte aligned and > 16 bytes long // this function requires the buffer to be 16 byte aligned and > 16 bytes long.
// //
//go:noescape //go:noescape
func vectorCrc32(crc uint32, poly uint32, p []byte) uint32 func vectorCrc32(crc uint32, poly uint32, p []byte) uint32

View file

@ -134,7 +134,7 @@ var (
// indirectToStringerOrError returns the value, after dereferencing as many times // indirectToStringerOrError returns the value, after dereferencing as many times
// as necessary to reach the base type (or nil) or an implementation of fmt.Stringer // as necessary to reach the base type (or nil) or an implementation of fmt.Stringer
// or error, // or error.
func indirectToStringerOrError(a any) any { func indirectToStringerOrError(a any) any {
if a == nil { if a == nil {
return nil return nil

View file

@ -67,7 +67,7 @@ func countNewCoverageBits(base, snapshot []byte) int {
} }
// isCoverageSubset returns true if all the base coverage bits are set in // isCoverageSubset returns true if all the base coverage bits are set in
// snapshot // snapshot.
func isCoverageSubset(base, snapshot []byte) bool { func isCoverageSubset(base, snapshot []byte) bool {
for i, v := range base { for i, v := range base {
if v&snapshot[i] != v { if v&snapshot[i] != v {

View file

@ -131,7 +131,7 @@ func (p *Profile) FilterSamplesByTag(focus, ignore TagMatch) (fm, im bool) {
} }
// focusedSample checks a sample against focus and ignore regexps. // focusedSample checks a sample against focus and ignore regexps.
// Returns whether the focus/ignore regexps match any tags // Returns whether the focus/ignore regexps match any tags.
func focusedSample(s *Sample, focus, ignore TagMatch) (fm, im bool) { func focusedSample(s *Sample, focus, ignore TagMatch) (fm, im bool) {
fm = focus == nil fm = focus == nil
for key, vals := range s.Label { for key, vals := range s.Label {

View file

@ -671,7 +671,7 @@ func lehmerSimulate(A, B *Int) (u0, u1, v0, v1 Word, even bool) {
// where the signs of u0, u1, v0, v1 are given by even // where the signs of u0, u1, v0, v1 are given by even
// For even == true: u0, v1 >= 0 && u1, v0 <= 0 // For even == true: u0, v1 >= 0 && u1, v0 <= 0
// For even == false: u0, v1 <= 0 && u1, v0 >= 0 // For even == false: u0, v1 <= 0 && u1, v0 >= 0
// q, r, s, t are temporary variables to avoid allocations in the multiplication // q, r, s, t are temporary variables to avoid allocations in the multiplication.
func lehmerUpdate(A, B, q, r, s, t *Int, u0, u1, v0, v1 Word, even bool) { func lehmerUpdate(A, B, q, r, s, t *Int, u0, u1, v0, v1 Word, even bool) {
t.abs = t.abs.setWord(u0) t.abs = t.abs.setWord(u0)
@ -695,7 +695,7 @@ func lehmerUpdate(A, B, q, r, s, t *Int, u0, u1, v0, v1 Word, even bool) {
} }
// euclidUpdate performs a single step of the Euclidean GCD algorithm // euclidUpdate performs a single step of the Euclidean GCD algorithm
// if extended is true, it also updates the cosequence Ua, Ub // if extended is true, it also updates the cosequence Ua, Ub.
func euclidUpdate(A, B, Ua, Ub, q, r, s, t *Int, extended bool) { func euclidUpdate(A, B, Ua, Ub, q, r, s, t *Int, extended bool) {
q, r = q.QuoRem(A, B, r) q, r = q.QuoRem(A, B, r)

View file

@ -40,7 +40,7 @@ func (x *Int) String() string {
return x.Text(10) return x.Text(10)
} }
// write count copies of text to s // write count copies of text to s.
func writeMultiple(s fmt.State, text string, count int) { func writeMultiple(s fmt.State, text string, count int) {
if len(text) > 0 { if len(text) > 0 {
b := []byte(text) b := []byte(text)

View file

@ -455,7 +455,7 @@ func (z nat) expWW(x, y Word) nat {
return z.expNN(nat(nil).setWord(x), nat(nil).setWord(y), nil, false) return z.expNN(nat(nil).setWord(x), nat(nil).setWord(y), nil, false)
} }
// construct table of powers of bb*leafSize to use in subdivisions // construct table of powers of bb*leafSize to use in subdivisions.
func divisors(m int, b Word, ndigits int, bb Word) []divisor { func divisors(m int, b Word, ndigits int, bb Word) []divisor {
// only compute table when recursive conversion is enabled and x is large // only compute table when recursive conversion is enabled and x is large
if leafSize == 0 || m <= leafSize { if leafSize == 0 || m <= leafSize {

View file

@ -172,7 +172,7 @@ func Cosh(x complex128) complex128 {
return complex(c*ch, s*sh) return complex(c*ch, s*sh)
} }
// calculate sinh and cosh // calculate sinh and cosh.
func sinhcosh(x float64) (sh, ch float64) { func sinhcosh(x float64) (sh, ch float64) {
if math.Abs(x) <= 0.5 { if math.Abs(x) <= 0.5 {
return math.Sinh(x), math.Cosh(x) return math.Sinh(x), math.Cosh(x)

View file

@ -499,7 +499,7 @@ func (c *Client) checkRedirect(req *Request, via []*Request) error {
} }
// redirectBehavior describes what should happen when the // redirectBehavior describes what should happen when the
// client encounters a 3xx status code from the server // client encounters a 3xx status code from the server.
func redirectBehavior(reqMethod string, resp *Response, ireq *Request) (redirectMethod string, shouldRedirect, includeBody bool) { func redirectBehavior(reqMethod string, resp *Response, ireq *Request) (redirectMethod string, shouldRedirect, includeBody bool) {
switch resp.StatusCode { switch resp.StatusCode {
case 301, 302, 303: case 301, 302, 303:

View file

@ -273,7 +273,7 @@ func (c *Cookie) Valid() error {
// readCookies parses all "Cookie" values from the header h and // readCookies parses all "Cookie" values from the header h and
// returns the successfully parsed Cookies. // returns the successfully parsed Cookies.
// //
// if filter isn't empty, only cookies of that name are returned // if filter isn't empty, only cookies of that name are returned.
func readCookies(h Header, filter string) []*Cookie { func readCookies(h Header, filter string) []*Cookie {
lines := h["Cookie"] lines := h["Cookie"]
if len(lines) == 0 { if len(lines) == 0 {

View file

@ -600,7 +600,7 @@ func readTransfer(msg any, r *bufio.Reader) (err error) {
return nil return nil
} }
// Checks whether chunked is part of the encodings stack // Checks whether chunked is part of the encodings stack.
func chunked(te []string) bool { return len(te) > 0 && te[0] == "chunked" } func chunked(te []string) bool { return len(te) > 0 && te[0] == "chunked" }
// Checks whether the encoding is explicitly "identity". // Checks whether the encoding is explicitly "identity".
@ -738,7 +738,7 @@ func fixLength(isResponse bool, status int, requestMethod string, header Header,
// Determine whether to hang up after sending a request and body, or // Determine whether to hang up after sending a request and body, or
// receiving a response and body // receiving a response and body
// 'header' is the request headers // 'header' is the request headers.
func shouldClose(major, minor int, header Header, removeCloseHeader bool) bool { func shouldClose(major, minor int, header Header, removeCloseHeader bool) bool {
if major < 1 { if major < 1 {
return true return true
@ -757,7 +757,7 @@ func shouldClose(major, minor int, header Header, removeCloseHeader bool) bool {
return hasClose return hasClose
} }
// Parse the trailer header // Parse the trailer header.
func fixTrailer(header Header, chunked bool) (Header, error) { func fixTrailer(header Header, chunked bool) (Header, error) {
vv, ok := header["Trailer"] vv, ok := header["Trailer"]
if !ok { if !ok {
@ -1081,7 +1081,7 @@ var nopCloserWriterToType = reflect.TypeOf(io.NopCloser(struct {
}{})) }{}))
// unwrapNopCloser return the underlying reader and true if r is a NopCloser // unwrapNopCloser return the underlying reader and true if r is a NopCloser
// else it return false // else it return false.
func unwrapNopCloser(r io.Reader) (underlyingReader io.Reader, isNopCloser bool) { func unwrapNopCloser(r io.Reader) (underlyingReader io.Reader, isNopCloser bool) {
switch reflect.TypeOf(r) { switch reflect.TypeOf(r) {
case nopCloserType, nopCloserWriterToType: case nopCloserType, nopCloserWriterToType:

View file

@ -2743,7 +2743,7 @@ var portMap = map[string]string{
"socks5": "1080", "socks5": "1080",
} }
// canonicalAddr returns url.Host but always with a ":port" suffix // canonicalAddr returns url.Host but always with a ":port" suffix.
func canonicalAddr(url *url.URL) string { func canonicalAddr(url *url.URL) string {
addr := url.Hostname() addr := url.Hostname()
if v, err := idnaASCII(addr); err == nil { if v, err := idnaASCII(addr); err == nil {

View file

@ -101,7 +101,7 @@ func (ch Chan) ServeHTTP(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, fmt.Sprintf("channel send #%d\n", <-ch)) io.WriteString(w, fmt.Sprintf("channel send #%d\n", <-ch))
} }
// exec a program, redirecting output // exec a program, redirecting output.
func DateServer(rw http.ResponseWriter, req *http.Request) { func DateServer(rw http.ResponseWriter, req *http.Request) {
rw.Header().Set("Content-Type", "text/plain; charset=utf-8") rw.Header().Set("Content-Type", "text/plain; charset=utf-8")

View file

@ -383,7 +383,7 @@ func (r *Resolver) lookupAddr(ctx context.Context, addr string) ([]string, error
const dnsSectionMask = 0x0003 const dnsSectionMask = 0x0003
// returns only results applicable to name and resolves CNAME entries // returns only results applicable to name and resolves CNAME entries.
func validRecs(r *syscall.DNSRecord, dnstype uint16, name string) []*syscall.DNSRecord { func validRecs(r *syscall.DNSRecord, dnstype uint16, name string) []*syscall.DNSRecord {
cname := syscall.StringToUTF16Ptr(name) cname := syscall.StringToUTF16Ptr(name)
if dnstype != syscall.DNS_TYPE_CNAME { if dnstype != syscall.DNS_TYPE_CNAME {
@ -406,7 +406,7 @@ func validRecs(r *syscall.DNSRecord, dnstype uint16, name string) []*syscall.DNS
return rec return rec
} }
// returns the last CNAME in chain // returns the last CNAME in chain.
func resolveCNAME(name *uint16, r *syscall.DNSRecord) *uint16 { func resolveCNAME(name *uint16, r *syscall.DNSRecord) *uint16 {
// limit cname resolving to 10 in case of an infinite CNAME loop // limit cname resolving to 10 in case of an infinite CNAME loop
Cname: Cname:

View file

@ -850,7 +850,7 @@ func isVchar(r rune) bool {
} }
// isMultibyte reports whether r is a multi-byte UTF-8 character // isMultibyte reports whether r is a multi-byte UTF-8 character
// as supported by RFC 6532 // as supported by RFC 6532.
func isMultibyte(r rune) bool { func isMultibyte(r rune) bool {
return r >= utf8.RuneSelf return r >= utf8.RuneSelf
} }

View file

@ -423,7 +423,7 @@ func (c *Client) Quit() error {
return c.Text.Close() return c.Text.Close()
} }
// validateLine checks to see if a line has CR or LF as per RFC 5321 // validateLine checks to see if a line has CR or LF as per RFC 5321.
func validateLine(line string) error { func validateLine(line string) error {
if strings.ContainsAny(line, "\n\r") { if strings.ContainsAny(line, "\n\r") {
return errors.New("smtp: A line must not contain CR or LF") return errors.New("smtp: A line must not contain CR or LF")

View file

@ -61,7 +61,7 @@ func isShellSpecialVar(c uint8) bool {
return false return false
} }
// isAlphaNum reports whether the byte is an ASCII letter, number, or underscore // isAlphaNum reports whether the byte is an ASCII letter, number, or underscore.
func isAlphaNum(c uint8) bool { func isAlphaNum(c uint8) bool {
return c == '_' || '0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' return c == '_' || '0' <= c && c <= '9' || 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z'
} }

View file

@ -146,10 +146,10 @@ var (
plugins map[string]*Plugin plugins map[string]*Plugin
) )
// lastmoduleinit is defined in package runtime // lastmoduleinit is defined in package runtime.
func lastmoduleinit() (pluginpath string, syms map[string]any, errstr string) func lastmoduleinit() (pluginpath string, syms map[string]any, errstr string)
// doInit is defined in package runtime // doInit is defined in package runtime.
// //
//go:linkname doInit runtime.doInit //go:linkname doInit runtime.doInit
func doInit(t unsafe.Pointer) // t should be a *runtime.initTask func doInit(t unsafe.Pointer) // t should be a *runtime.initTask

View file

@ -37,7 +37,7 @@ type onePassInst struct {
// regexp must start with. Complete is true if the prefix // regexp must start with. Complete is true if the prefix
// is the entire match. Pc is the index of the last rune instruction // is the entire match. Pc is the index of the last rune instruction
// in the string. The onePassPrefix skips over the mandatory // in the string. The onePassPrefix skips over the mandatory
// EmptyBeginText // EmptyBeginText.
func onePassPrefix(p *syntax.Prog) (prefix string, complete bool, pc uint32) { func onePassPrefix(p *syntax.Prog) (prefix string, complete bool, pc uint32) {
i := &p.Inst[p.Start] i := &p.Inst[p.Start]
if i.Op != syntax.InstEmptyWidth || (syntax.EmptyOp(i.Arg))&syntax.EmptyBeginText == 0 { if i.Op != syntax.InstEmptyWidth || (syntax.EmptyOp(i.Arg))&syntax.EmptyBeginText == 0 {
@ -218,7 +218,7 @@ func cleanupOnePass(prog *onePassProg, original *syntax.Prog) {
} }
} }
// onePassCopy creates a copy of the original Prog, as we'll be modifying it // onePassCopy creates a copy of the original Prog, as we'll be modifying it.
func onePassCopy(prog *syntax.Prog) *onePassProg { func onePassCopy(prog *syntax.Prog) *onePassProg {
p := &onePassProg{ p := &onePassProg{
Start: prog.Start, Start: prog.Start,

View file

@ -270,7 +270,7 @@ func (re *Regexp) put(m *machine) {
matchPool[re.mpool].Put(m) matchPool[re.mpool].Put(m)
} }
// minInputLen walks the regexp to find the minimum length of any matchable input // minInputLen walks the regexp to find the minimum length of any matchable input.
func minInputLen(re *syntax.Regexp) int { func minInputLen(re *syntax.Regexp) int {
switch re.Op { switch re.Op {
default: default:

View file

@ -346,12 +346,12 @@ func unwindm(restore *bool) {
} }
} }
// called from assembly // called from assembly.
func badcgocallback() { func badcgocallback() {
throw("misaligned stack in cgocallback") throw("misaligned stack in cgocallback")
} }
// called from (incomplete) assembly // called from (incomplete) assembly.
func cgounimpl() { func cgounimpl() {
throw("cgo not implemented") throw("cgo not implemented")
} }

View file

@ -138,7 +138,7 @@ func full(c *hchan) bool {
return c.qcount == c.dataqsiz return c.qcount == c.dataqsiz
} }
// entry point for c <- x from compiled code // entry point for c <- x from compiled code.
// //
//go:nosplit //go:nosplit
func chansend1(c *hchan, elem unsafe.Pointer) { func chansend1(c *hchan, elem unsafe.Pointer) {
@ -435,7 +435,7 @@ func empty(c *hchan) bool {
return atomic.Loaduint(&c.qcount) == 0 return atomic.Loaduint(&c.qcount) == 0
} }
// entry points for <- c from compiled code // entry points for <- c from compiled code.
// //
//go:nosplit //go:nosplit
func chanrecv1(c *hchan, elem unsafe.Pointer) { func chanrecv1(c *hchan, elem unsafe.Pointer) {

View file

@ -11,7 +11,7 @@ import (
"strings" "strings"
) )
// exported from runtime // exported from runtime.
func modinfo() string func modinfo() string
// ReadBuildInfo returns the build information embedded // ReadBuildInfo returns the build information embedded

View file

@ -120,7 +120,7 @@ type typeCacheBucket struct {
var typecache [typeCacheBuckets]typeCacheBucket var typecache [typeCacheBuckets]typeCacheBucket
// dump a uint64 in a varint format parseable by encoding/binary // dump a uint64 in a varint format parseable by encoding/binary.
func dumpint(v uint64) { func dumpint(v uint64) {
var buf [10]byte var buf [10]byte
var n int var n int
@ -142,7 +142,7 @@ func dumpbool(b bool) {
} }
} }
// dump varint uint64 length followed by memory contents // dump varint uint64 length followed by memory contents.
func dumpmemrange(data unsafe.Pointer, len uintptr) { func dumpmemrange(data unsafe.Pointer, len uintptr) {
dumpint(uint64(len)) dumpint(uint64(len))
dwrite(data, len) dwrite(data, len)
@ -159,7 +159,7 @@ func dumpstr(s string) {
dumpmemrange(unsafe.Pointer(unsafe.StringData(s)), uintptr(len(s))) dumpmemrange(unsafe.Pointer(unsafe.StringData(s)), uintptr(len(s)))
} }
// dump information for a type // dump information for a type.
func dumptype(t *_type) { func dumptype(t *_type) {
if t == nil { if t == nil {
return return
@ -206,7 +206,7 @@ func dumptype(t *_type) {
dumpbool(t.kind&kindDirectIface == 0 || t.ptrdata != 0) dumpbool(t.kind&kindDirectIface == 0 || t.ptrdata != 0)
} }
// dump an object // dump an object.
func dumpobj(obj unsafe.Pointer, size uintptr, bv bitvector) { func dumpobj(obj unsafe.Pointer, size uintptr, bv bitvector) {
dumpint(tagObject) dumpint(tagObject)
dumpint(uint64(uintptr(obj))) dumpint(uint64(uintptr(obj)))
@ -239,7 +239,7 @@ type childInfo struct {
depth uintptr // depth in call stack (0 == most recent) depth uintptr // depth in call stack (0 == most recent)
} }
// dump kinds & offsets of interesting fields in bv // dump kinds & offsets of interesting fields in bv.
func dumpbv(cbv *bitvector, offset uintptr) { func dumpbv(cbv *bitvector, offset uintptr) {
for i := uintptr(0); i < uintptr(cbv.n); i++ { for i := uintptr(0); i < uintptr(cbv.n); i++ {
if cbv.ptrbit(i) == 1 { if cbv.ptrbit(i) == 1 {

View file

@ -226,7 +226,7 @@ func notetsleep(n *note, ns int64) bool {
} }
// same as runtime·notetsleep, but called on user g (not g0) // same as runtime·notetsleep, but called on user g (not g0)
// calls only nosplit functions between entersyscallblock/exitsyscall // calls only nosplit functions between entersyscallblock/exitsyscall.
func notetsleepg(n *note, ns int64) bool { func notetsleepg(n *note, ns int64) bool {
gp := getg() gp := getg()
if gp == gp.m.g0 { if gp == gp.m.g0 {

View file

@ -284,7 +284,7 @@ func notetsleep(n *note, ns int64) bool {
} }
// same as runtime·notetsleep, but called on user g (not g0) // same as runtime·notetsleep, but called on user g (not g0)
// calls only nosplit functions between entersyscallblock/exitsyscall // calls only nosplit functions between entersyscallblock/exitsyscall.
func notetsleepg(n *note, ns int64) bool { func notetsleepg(n *note, ns int64) bool {
gp := getg() gp := getg()
if gp == gp.m.g0 { if gp == gp.m.g0 {

View file

@ -1249,7 +1249,7 @@ func memclrNoHeapPointersChunked(size uintptr, x unsafe.Pointer) {
// implementation of new builtin // implementation of new builtin
// compiler (both frontend and SSA backend) knows the signature // compiler (both frontend and SSA backend) knows the signature
// of this function // of this function.
func newobject(typ *_type) unsafe.Pointer { func newobject(typ *_type) unsafe.Pointer {
return mallocgc(typ.size, typ, true) return mallocgc(typ.size, typ, true)
} }

View file

@ -514,7 +514,7 @@ bucketloop:
return unsafe.Pointer(&zeroVal[0]), false return unsafe.Pointer(&zeroVal[0]), false
} }
// returns both key and elem. Used by map iterator // returns both key and elem. Used by map iterator.
func mapaccessK(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, unsafe.Pointer) { func mapaccessK(t *maptype, h *hmap, key unsafe.Pointer) (unsafe.Pointer, unsafe.Pointer) {
if h == nil || h.count == 0 { if h == nil || h.count == 0 {
return nil, nil return nil, nil

View file

@ -172,7 +172,7 @@ func finalizercommit(gp *g, lock unsafe.Pointer) bool {
return true return true
} }
// This is the goroutine that runs all of the finalizers // This is the goroutine that runs all of the finalizers.
func runfinq() { func runfinq() {
var ( var (
frame unsafe.Pointer frame unsafe.Pointer

View file

@ -421,7 +421,7 @@ func putfull(b *workbuf) {
} }
// trygetfull tries to get a full or partially empty workbuffer. // trygetfull tries to get a full or partially empty workbuffer.
// If one is not immediately available return nil // If one is not immediately available return nil.
// //
//go:nowritebarrier //go:nowritebarrier
func trygetfull() *workbuf { func trygetfull() *workbuf {

View file

@ -163,7 +163,7 @@ func mpreinit(mp *m) {
} }
// errno address must be retrieved by calling _Errno libc function. // errno address must be retrieved by calling _Errno libc function.
// This will return a pointer to errno // This will return a pointer to errno.
func miniterrno() { func miniterrno() {
mp := getg().m mp := getg().m
r, _ := syscall0(&libc__Errno) r, _ := syscall0(&libc__Errno)

View file

@ -47,7 +47,7 @@ func write1(fd uintptr, p unsafe.Pointer, n int32) int32
//go:noescape //go:noescape
func open(name *byte, mode, perm int32) int32 func open(name *byte, mode, perm int32) int32
// return value is only set on linux to be used in osinit() // return value is only set on linux to be used in osinit().
func madvise(addr unsafe.Pointer, n uintptr, flags int32) int32 func madvise(addr unsafe.Pointer, n uintptr, flags int32) int32
// exitThread terminates the current thread, writing *wait = freeMStack when // exitThread terminates the current thread, writing *wait = freeMStack when

View file

@ -861,7 +861,7 @@ func writeMutex(w io.Writer, debug int) error {
return writeProfileInternal(w, debug, "mutex", runtime.MutexProfile) return writeProfileInternal(w, debug, "mutex", runtime.MutexProfile)
} }
// writeProfileInternal writes the current blocking or mutex profile depending on the passed parameters // writeProfileInternal writes the current blocking or mutex profile depending on the passed parameters.
func writeProfileInternal(w io.Writer, debug int, name string, runtimeProfile func([]runtime.BlockProfileRecord) (int, bool)) error { func writeProfileInternal(w io.Writer, debug int, name string, runtimeProfile func([]runtime.BlockProfileRecord) (int, bool)) error {
var p []runtime.BlockProfileRecord var p []runtime.BlockProfileRecord
n, ok := runtimeProfile(nil) n, ok := runtimeProfile(nil)

View file

@ -481,7 +481,7 @@ func releaseSudog(s *sudog) {
releasem(mp) releasem(mp)
} }
// called from assembly // called from assembly.
func badmcall(fn func(*g)) { func badmcall(fn func(*g)) {
throw("runtime: mcall called on m->g0 stack") throw("runtime: mcall called on m->g0 stack")
} }
@ -3534,7 +3534,7 @@ func gosched_m(gp *g) {
goschedImpl(gp) goschedImpl(gp)
} }
// goschedguarded is a forbidden-states-avoided version of gosched_m // goschedguarded is a forbidden-states-avoided version of gosched_m.
func goschedguarded_m(gp *g) { func goschedguarded_m(gp *g) {
if !canPreemptM(gp.m) { if !canPreemptM(gp.m) {

View file

@ -350,7 +350,7 @@ func racecallbackthunk(uintptr)
// with up to 4 uintptr arguments. // with up to 4 uintptr arguments.
func racecall(fn *byte, arg0, arg1, arg2, arg3 uintptr) func racecall(fn *byte, arg0, arg1, arg2, arg3 uintptr)
// checks if the address has shadow (i.e. heap or data/bss) // checks if the address has shadow (i.e. heap or data/bss).
// //
//go:nosplit //go:nosplit
func isvalidaddr(addr unsafe.Pointer) bool { func isvalidaddr(addr unsafe.Pointer) bool {

View file

@ -56,7 +56,7 @@ var (
argv **byte argv **byte
) )
// nosplit for use in linux startup sysargs // nosplit for use in linux startup sysargs.
// //
//go:nosplit //go:nosplit
func argv_index(argv **byte, i int32) *byte { func argv_index(argv **byte, i int32) *byte {

View file

@ -34,7 +34,7 @@ func write1(fd uintptr, p unsafe.Pointer, n int32) int32
//go:noescape //go:noescape
func open(name *byte, mode, perm int32) int32 func open(name *byte, mode, perm int32) int32
// return value is only set on linux to be used in osinit() // return value is only set on linux to be used in osinit().
func madvise(addr unsafe.Pointer, n uintptr, flags int32) int32 func madvise(addr unsafe.Pointer, n uintptr, flags int32) int32
// exitThread terminates the current thread, writing *wait = freeMStack when // exitThread terminates the current thread, writing *wait = freeMStack when

View file

@ -6,7 +6,7 @@
package runtime package runtime
// This is needed for vet // This is needed for vet.
// //
//go:noescape //go:noescape
func callCgoSigaction(sig uintptr, new, old *sigactiont) int32 func callCgoSigaction(sig uintptr, new, old *sigactiont) int32

View file

@ -544,7 +544,7 @@ func recoverErr(errPtr *error) {
} }
} }
// mapJSError maps an error given by Node.js to the appropriate Go error // mapJSError maps an error given by Node.js to the appropriate Go error.
func mapJSError(jsErr js.Value) error { func mapJSError(jsErr js.Value) error {
errno, ok := errnoByCode[jsErr.Get("code").String()] errno, ok := errnoByCode[jsErr.Get("code").String()]
if !ok { if !ok {

View file

@ -1469,7 +1469,7 @@ func parseGMT(value string) int {
// parseSignedOffset parses a signed timezone offset (e.g. "+03" or "-04"). // parseSignedOffset parses a signed timezone offset (e.g. "+03" or "-04").
// The function checks for a signed number in the range -23 through +23 excluding zero. // The function checks for a signed number in the range -23 through +23 excluding zero.
// Returns length of the found offset string or 0 otherwise // Returns length of the found offset string or 0 otherwise.
func parseSignedOffset(value string) int { func parseSignedOffset(value string) int {
sign := value[0] sign := value[0]
if sign != '-' && sign != '+' { if sign != '-' && sign != '+' {