Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cmd/asm/internal/asm/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ func (p *Parser) asmData(operands [][]lex.Token) {
case obj.TYPE_CONST:
switch sz {
case 1, 2, 4, 8:
nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Offset)
nameAddr.Sym.WriteInt(p.ctxt, nameAddr.Offset, sz, valueAddr.Offset)
default:
p.errorf("bad int size for DATA argument: %d", sz)
}
Expand All @@ -262,10 +262,10 @@ func (p *Parser) asmData(operands [][]lex.Token) {
p.errorf("bad float size for DATA argument: %d", sz)
}
case obj.TYPE_SCONST:
nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Val.(string))
nameAddr.Sym.WriteString(p.ctxt, nameAddr.Offset, sz, valueAddr.Val.(string))
case obj.TYPE_ADDR:
if sz == p.arch.PtrSize {
nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, int(sz), valueAddr.Sym, valueAddr.Offset)
nameAddr.Sym.WriteAddr(p.ctxt, nameAddr.Offset, sz, valueAddr.Sym, valueAddr.Offset)
} else {
p.errorf("bad addr size for DATA argument: %d", sz)
}
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/cgo/gcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
for _, s := range f.Symbols {
switch {
case isDebugInts(s.Name):
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
sect := f.Sections[i]
if s.Value < sect.Size {
if sdat, err := sect.Data(); err == nil {
Expand All @@ -2167,7 +2167,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
}
}
case isDebugFloats(s.Name):
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
sect := f.Sections[i]
if s.Value < sect.Size {
if sdat, err := sect.Data(); err == nil {
Expand All @@ -2181,7 +2181,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
}
default:
if n := indexOfDebugStr(s.Name); n != -1 {
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
sect := f.Sections[i]
if s.Value < sect.Size {
if sdat, err := sect.Data(); err == nil {
Expand All @@ -2193,7 +2193,7 @@ func (p *Package) gccDebug(stdin []byte, nnames int) (d *dwarf.Data, ints []int6
break
}
if n := indexOfDebugStrlen(s.Name); n != -1 {
if i := int(s.SectionNumber) - 1; 0 <= i && i < len(f.Sections) {
if i := s.SectionNumber - 1; 0 <= i && i < len(f.Sections) {
sect := f.Sections[i]
if s.Value < sect.Size {
if sdat, err := sect.Data(); err == nil {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/cgo/internal/swig/swig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func mustHaveCxx(t *testing.T) {
if len(args) == 0 {
t.Skip("no C++ compiler")
}
testenv.MustHaveExecPath(t, string(args[0]))
testenv.MustHaveExecPath(t, args[0])
}

var (
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/cgo/internal/testcarchive/carchive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ func testMain(m *testing.M) int {
bin = cmdToRun("./testp")

ccOut := goEnv("CC")
cc = []string{string(ccOut)}
cc = []string{ccOut}

out := goEnv("GOGCCFLAGS")
quote := '\000'
start := 0
lastSpace := true
backslash := false
s := string(out)
s := out
for i, c := range s {
if quote == '\000' && unicode.IsSpace(c) {
if !lastSpace {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/cgo/internal/testcshared/cshared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func testMain(m *testing.M) int {
start := 0
lastSpace := true
backslash := false
s := string(out)
s := out
for i, c := range s {
if quote == '\000' && unicode.IsSpace(c) {
if !lastSpace {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/cgo/internal/testerrors/badsym_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func cCompilerCmd(t *testing.T) []string {
start := 0
lastSpace := true
backslash := false
s := string(out)
s := out
for i, c := range s {
if quote == '\000' && unicode.IsSpace(c) {
if !lastSpace {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/coverage/cover.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func metaHashAndLen() ([16]byte, int) {
}
var hv [16]byte
for i := 0; i < 16; i++ {
nib := string(mhash[i*2 : i*2+2])
nib := mhash[i*2 : i*2+2]
x, err := strconv.ParseInt(nib, 16, 32)
if err != nil {
base.Fatalf("metahash bad byte %q", nib)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/inline/inl.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func CanInline(fn *ir.Func, profile *pgoir.Profile) {
// function is inlinable.
func noteInlinableFunc(n *ir.Name, fn *ir.Func, cost int32) {
if base.Flag.LowerM > 1 {
fmt.Printf("%v: can inline %v with cost %d as: %v { %v }\n", ir.Line(fn), n, cost, fn.Type(), ir.Nodes(fn.Body))
fmt.Printf("%v: can inline %v with cost %d as: %v { %v }\n", ir.Line(fn), n, cost, fn.Type(), fn.Body)
} else if base.Flag.LowerM != 0 {
fmt.Printf("%v: can inline %v\n", ir.Line(fn), n)
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ir/bitset.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (f *bitset8) set2(shift uint8, b uint8) {
// Clear old bits.
*(*uint8)(f) &^= 3 << shift
// Set new bits.
*(*uint8)(f) |= uint8(b&3) << shift
*(*uint8)(f) |= (b & 3) << shift
}

type bitset16 uint16
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/loong64/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,8 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p.From.Type = obj.TYPE_MEM
p.From.Reg = v.Args[0].Reg()
p.AddRestSourceArgs([]obj.Addr{
{Type: obj.TYPE_CONST, Offset: int64((v.AuxInt >> 5) & 0x1fffffffff)},
{Type: obj.TYPE_CONST, Offset: int64((v.AuxInt >> 0) & 0x1f)},
{Type: obj.TYPE_CONST, Offset: (v.AuxInt >> 5) & 0x1fffffffff},
{Type: obj.TYPE_CONST, Offset: (v.AuxInt >> 0) & 0x1f},
})

case ssa.OpLOONG64ADDshiftLLV:
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/noder/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -3577,7 +3577,7 @@ func unifiedInlineCall(callerfn *ir.Func, call *ir.CallExpr, fn *ir.Func, inlInd
edit(r.curfn)
})

body := ir.Nodes(r.curfn.Body)
body := r.curfn.Body

// Reparent any declarations into the caller function.
for _, name := range r.curfn.Dcl {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ppc64/ssa.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
p := s.Prog(v.Op.Asm())
p.To = obj.Addr{Type: obj.TYPE_REG, Reg: v.Reg()}
p.Reg = v.Args[0].Reg()
p.From = obj.Addr{Type: obj.TYPE_CONST, Offset: int64(sh)}
p.From = obj.Addr{Type: obj.TYPE_CONST, Offset: sh}
p.AddRestSourceArgs([]obj.Addr{{Type: obj.TYPE_CONST, Offset: mb}, {Type: obj.TYPE_CONST, Offset: me}})
// Auxint holds mask

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ssa/biasedsparsemap.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (s *biasedSparseMap) cap() int {
if s == nil || s.s == nil {
return 0
}
return s.s.cap() + int(s.first)
return s.s.cap() + s.first
}

// size returns the number of entries stored in s
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/compile/internal/ssa/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -1553,11 +1553,11 @@ func (debugInfo *FuncDebug) PutLocationListDwarf4(list []byte, ctxt *obj.Link, l
}

if ctxt.UseBASEntries {
listSym.WriteInt(ctxt, listSym.Size, ctxt.Arch.PtrSize, int64(begin))
listSym.WriteInt(ctxt, listSym.Size, ctxt.Arch.PtrSize, int64(end))
listSym.WriteInt(ctxt, listSym.Size, ctxt.Arch.PtrSize, begin)
listSym.WriteInt(ctxt, listSym.Size, ctxt.Arch.PtrSize, end)
} else {
listSym.WriteCURelativeAddr(ctxt, listSym.Size, startPC, int64(begin))
listSym.WriteCURelativeAddr(ctxt, listSym.Size, startPC, int64(end))
listSym.WriteCURelativeAddr(ctxt, listSym.Size, startPC, begin)
listSym.WriteCURelativeAddr(ctxt, listSym.Size, startPC, end)
}

i += 2 * ctxt.Arch.PtrSize
Expand Down
28 changes: 14 additions & 14 deletions src/cmd/compile/internal/ssa/magic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func testMagicExhaustive(t *testing.T, n uint) {
min := -int64(1) << (n - 1)
max := int64(1) << (n - 1)
for c := int64(1); c < max; c++ {
if !smagicOK(n, int64(c)) {
if !smagicOK(n, c) {
continue
}
m := int64(smagic(n, c).m)
Expand Down Expand Up @@ -164,11 +164,11 @@ func TestMagicSigned(t *testing.T) {
if c>>(n-1) != 0 {
continue // not appropriate for the given n.
}
if !smagicOK(n, int64(c)) {
if !smagicOK(n, c) {
t.Errorf("expected n=%d c=%d to pass\n", n, c)
}
m := smagic(n, int64(c)).m
s := smagic(n, int64(c)).s
m := smagic(n, c).m
s := smagic(n, c).s

C := new(big.Int).SetInt64(c)
M := new(big.Int).SetUint64(m)
Expand Down Expand Up @@ -308,13 +308,13 @@ func testDivisibleExhaustive(t *testing.T, n uint) {
minI := -int64(1) << (n - 1)
maxI := int64(1) << (n - 1)
for c := int64(1); c < maxI; c++ {
if !sdivisibleOK(n, int64(c)) {
if !sdivisibleOK(n, c) {
continue
}
k := sdivisible(n, int64(c)).k
m := sdivisible(n, int64(c)).m
a := sdivisible(n, int64(c)).a
max := sdivisible(n, int64(c)).max
k := sdivisible(n, c).k
m := sdivisible(n, c).m
a := sdivisible(n, c).a
max := sdivisible(n, c).max
mask := ^uint64(0) >> (64 - n)
for i := minI; i < maxI; i++ {
want := i%c == 0
Expand Down Expand Up @@ -369,13 +369,13 @@ func TestDivisibleSigned(t *testing.T) {
if c>>(n-1) != 0 {
continue // not appropriate for the given n.
}
if !sdivisibleOK(n, int64(c)) {
if !sdivisibleOK(n, c) {
t.Errorf("expected n=%d c=%d to pass\n", n, c)
}
k := sdivisible(n, int64(c)).k
m := sdivisible(n, int64(c)).m
a := sdivisible(n, int64(c)).a
max := sdivisible(n, int64(c)).max
k := sdivisible(n, c).k
m := sdivisible(n, c).m
a := sdivisible(n, c).a
max := sdivisible(n, c).max
mask := ^uint64(0) >> (64 - n)

C := new(big.Int).SetInt64(c)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ssa/memcombine.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ func combineStores(root *Value) {
if isLittleEndian && shift0 != 0 {
sv = rightShift(root.Block, root.Pos, sv, shift0)
}
shiftedSize = int64(aTotalSize - a[0].size)
shiftedSize = aTotalSize - a[0].size
if isBigEndian && shift0-shiftedSize*8 != 0 {
sv = rightShift(root.Block, root.Pos, sv, shift0-shiftedSize*8)
}
Expand Down
16 changes: 8 additions & 8 deletions src/cmd/compile/internal/ssa/rewrite.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ func int32ToAuxInt(i int32) int64 {
return int64(i)
}
func int64ToAuxInt(i int64) int64 {
return int64(i)
return i
}
func uint8ToAuxInt(i uint8) int64 {
return int64(int8(i))
Expand Down Expand Up @@ -1603,7 +1603,7 @@ func encodePPC64RotateMask(rotate, mask, nbits int64) int64 {
mb, me = men, mbn
}

return int64(me) | int64(mb<<8) | int64(rotate<<16) | int64(nbits<<24)
return int64(me) | int64(mb<<8) | rotate<<16 | nbits<<24
}

// Merge (RLDICL [encoded] (SRDconst [s] x)) into (RLDICL [new_encoded] x)
Expand Down Expand Up @@ -1712,7 +1712,7 @@ func mergePPC64AndSldi(m, s int64) int64 {
func mergePPC64ClrlsldiSrw(sld, srw int64) int64 {
mask_1 := uint64(0xFFFFFFFF >> uint(srw))
// for CLRLSLDI, it's more convenient to think of it as a mask left bits then rotate left.
mask_2 := uint64(0xFFFFFFFFFFFFFFFF) >> uint(GetPPC64Shiftmb(int64(sld)))
mask_2 := uint64(0xFFFFFFFFFFFFFFFF) >> uint(GetPPC64Shiftmb(sld))

// Rewrite mask to apply after the final left shift.
mask_3 := (mask_1 & mask_2) << uint(GetPPC64Shiftsh(sld))
Expand All @@ -1724,15 +1724,15 @@ func mergePPC64ClrlsldiSrw(sld, srw int64) int64 {
if uint64(uint32(mask_3)) != mask_3 || mask_3 == 0 {
return 0
}
return encodePPC64RotateMask(int64(r_3), int64(mask_3), 32)
return encodePPC64RotateMask(r_3, int64(mask_3), 32)
}

// Test if a doubleword shift right feeding into a CLRLSLDI can be merged into RLWINM.
// Return the encoded RLWINM constant, or 0 if they cannot be merged.
func mergePPC64ClrlsldiSrd(sld, srd int64) int64 {
mask_1 := uint64(0xFFFFFFFFFFFFFFFF) >> uint(srd)
// for CLRLSLDI, it's more convenient to think of it as a mask left bits then rotate left.
mask_2 := uint64(0xFFFFFFFFFFFFFFFF) >> uint(GetPPC64Shiftmb(int64(sld)))
mask_2 := uint64(0xFFFFFFFFFFFFFFFF) >> uint(GetPPC64Shiftmb(sld))

// Rewrite mask to apply after the final left shift.
mask_3 := (mask_1 & mask_2) << uint(GetPPC64Shiftsh(sld))
Expand All @@ -1749,7 +1749,7 @@ func mergePPC64ClrlsldiSrd(sld, srd int64) int64 {
if v1&mask_3 != 0 {
return 0
}
return encodePPC64RotateMask(int64(r_3&31), int64(mask_3), 32)
return encodePPC64RotateMask(r_3&31, int64(mask_3), 32)
}

// Test if a RLWINM feeding into a CLRLSLDI can be merged into RLWINM. Return
Expand Down Expand Up @@ -2155,11 +2155,11 @@ func rewriteFixedLoad(v *Value, sym Sym, sb *Value, off int64) *Value {
switch f.Sym.Name {
case "Size_":
v.reset(ptrSizedOpConst)
v.AuxInt = int64(t.Size())
v.AuxInt = t.Size()
return v
case "PtrBytes":
v.reset(ptrSizedOpConst)
v.AuxInt = int64(types.PtrDataSize(t))
v.AuxInt = types.PtrDataSize(t)
return v
case "Hash":
v.reset(OpConst32)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/compile/internal/ssa/sccp.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func (t *worklist) visitValue(val *Value) {
// re-visit all uses of value if its lattice is changed
newLt := t.getLatticeCell(val)
if !equals(newLt, oldLt) {
if int8(oldLt.tag) > int8(newLt.tag) {
if oldLt.tag > newLt.tag {
t.f.Fatalf("Must lower lattice\n")
}
t.addUses(val)
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/compile/internal/test/divconst_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,28 @@ func BenchmarkDivconstU64(b *testing.B) {
x := uint64(123456789123456789)
for i := 0; i < b.N; i++ {
x += x << 4
u64res = uint64(x) / 3
u64res = x / 3
}
})
b.Run("5", func(b *testing.B) {
x := uint64(123456789123456789)
for i := 0; i < b.N; i++ {
x += x << 4
u64res = uint64(x) / 5
u64res = x / 5
}
})
b.Run("37", func(b *testing.B) {
x := uint64(123456789123456789)
for i := 0; i < b.N; i++ {
x += x << 4
u64res = uint64(x) / 37
u64res = x / 37
}
})
b.Run("1234567", func(b *testing.B) {
x := uint64(123456789123456789)
for i := 0; i < b.N; i++ {
x += x << 4
u64res = uint64(x) / 1234567
u64res = x / 1234567
}
})
}
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/go/internal/modindex/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ func cleanDecls(m map[string][]token.Position) ([]string, map[string][]token.Pos
}

var (
bSlashSlash = []byte(slashSlash)
bStarSlash = []byte(starSlash)
bSlashStar = []byte(slashStar)
bSlashSlash = slashSlash
bStarSlash = starSlash
bSlashStar = slashStar
bPlusBuild = []byte("+build")

goBuildComment = []byte("//go:build")
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func parseRevTime(out []byte) (string, time.Time, error) {
}
rev := buf[:i]

secs, err := strconv.ParseInt(string(buf[i+1:]), 10, 64)
secs, err := strconv.ParseInt(buf[i+1:], 10, 64)
if err != nil {
return "", time.Time{}, fmt.Errorf("unrecognized VCS tool output: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/vet/vet.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func printJSONDiagnostics(r io.Reader) error {
// unitchecker emits a JSON map of the form:
// output maps Package ID -> Analyzer.Name -> (error | []Diagnostic);
var tree jsonTree
if err := json.Unmarshal([]byte(stdout), &tree); err != nil {
if err := json.Unmarshal(stdout, &tree); err != nil {
return fmt.Errorf("parsing JSON: %v", err)
}
for _, units := range tree {
Expand Down
Loading