mirror of
https://github.com/golang/go.git
synced 2026-06-28 03:40:37 +00:00
runtime/_mkmalloc: set position in substituteWithBasicLit
In substituteWithBasicLit, set the position to the position of the literal we're replacing, so the new identifier has the correct position. This helps the formatter avoid breaking lines spuriously. For #79286 Change-Id: Ia5b0e6057b02430d247ba832e6619c806a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/777700 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
e212a16d1e
commit
b23aea0c94
4 changed files with 28 additions and 153 deletions
|
|
@ -1,5 +1,5 @@
|
|||
module _mkmalloc
|
||||
|
||||
go 1.24
|
||||
go 1.26
|
||||
|
||||
require golang.org/x/tools v0.33.0
|
||||
|
|
|
|||
|
|
@ -305,12 +305,15 @@ func substituteWithBasicLit(node ast.Node, from, to string) ast.Node {
|
|||
if err != nil {
|
||||
log.Fatalf("parsing expr %q: %v", to, err)
|
||||
}
|
||||
if _, ok := toExpr.(*ast.BasicLit); !ok {
|
||||
toLit, ok := toExpr.(*ast.BasicLit)
|
||||
if !ok {
|
||||
log.Fatalf("op 'to' expr %q is not a basic literal", to)
|
||||
}
|
||||
return astutil.Apply(node, func(cursor *astutil.Cursor) bool {
|
||||
if isIdentWithName(cursor.Node(), from) {
|
||||
cursor.Replace(toExpr)
|
||||
if ident, ok := cursor.Node().(*ast.Ident); ok && ident.Name == from {
|
||||
replacement := *toLit
|
||||
replacement.ValuePos = ident.NamePos
|
||||
cursor.Replace(new(replacement))
|
||||
}
|
||||
return true
|
||||
}, nil)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
func benchmarkMallocgcNoscan8(b *testing.B) {
|
||||
const size = 8
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -32,7 +31,6 @@ func benchmarkMallocgcNoscan8(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan8(b *testing.B) {
|
||||
const size = 8
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -53,7 +51,6 @@ func benchmarkMallocgcScan8(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan16(b *testing.B) {
|
||||
const size = 16
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -74,7 +71,6 @@ func benchmarkMallocgcNoscan16(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan16(b *testing.B) {
|
||||
const size = 16
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -95,7 +91,6 @@ func benchmarkMallocgcScan16(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan24(b *testing.B) {
|
||||
const size = 24
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -116,7 +111,6 @@ func benchmarkMallocgcNoscan24(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan24(b *testing.B) {
|
||||
const size = 24
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -137,7 +131,6 @@ func benchmarkMallocgcScan24(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan32(b *testing.B) {
|
||||
const size = 32
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -158,7 +151,6 @@ func benchmarkMallocgcNoscan32(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan32(b *testing.B) {
|
||||
const size = 32
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -179,7 +171,6 @@ func benchmarkMallocgcScan32(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan48(b *testing.B) {
|
||||
const size = 48
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -200,7 +191,6 @@ func benchmarkMallocgcNoscan48(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan48(b *testing.B) {
|
||||
const size = 48
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -221,7 +211,6 @@ func benchmarkMallocgcScan48(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan64(b *testing.B) {
|
||||
const size = 64
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -242,7 +231,6 @@ func benchmarkMallocgcNoscan64(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan64(b *testing.B) {
|
||||
const size = 64
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -263,7 +251,6 @@ func benchmarkMallocgcScan64(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan80(b *testing.B) {
|
||||
const size = 80
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -284,7 +271,6 @@ func benchmarkMallocgcNoscan80(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan80(b *testing.B) {
|
||||
const size = 80
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -305,7 +291,6 @@ func benchmarkMallocgcScan80(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan96(b *testing.B) {
|
||||
const size = 96
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -326,7 +311,6 @@ func benchmarkMallocgcNoscan96(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan96(b *testing.B) {
|
||||
const size = 96
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -347,7 +331,6 @@ func benchmarkMallocgcScan96(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan112(b *testing.B) {
|
||||
const size = 112
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -368,7 +351,6 @@ func benchmarkMallocgcNoscan112(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan112(b *testing.B) {
|
||||
const size = 112
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -389,7 +371,6 @@ func benchmarkMallocgcScan112(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan128(b *testing.B) {
|
||||
const size = 128
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -410,7 +391,6 @@ func benchmarkMallocgcNoscan128(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan128(b *testing.B) {
|
||||
const size = 128
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -431,7 +411,6 @@ func benchmarkMallocgcScan128(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan144(b *testing.B) {
|
||||
const size = 144
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -452,7 +431,6 @@ func benchmarkMallocgcNoscan144(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan144(b *testing.B) {
|
||||
const size = 144
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -473,7 +451,6 @@ func benchmarkMallocgcScan144(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan160(b *testing.B) {
|
||||
const size = 160
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -494,7 +471,6 @@ func benchmarkMallocgcNoscan160(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan160(b *testing.B) {
|
||||
const size = 160
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -515,7 +491,6 @@ func benchmarkMallocgcScan160(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan176(b *testing.B) {
|
||||
const size = 176
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -536,7 +511,6 @@ func benchmarkMallocgcNoscan176(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan176(b *testing.B) {
|
||||
const size = 176
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -557,7 +531,6 @@ func benchmarkMallocgcScan176(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan192(b *testing.B) {
|
||||
const size = 192
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -578,7 +551,6 @@ func benchmarkMallocgcNoscan192(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan192(b *testing.B) {
|
||||
const size = 192
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -599,7 +571,6 @@ func benchmarkMallocgcScan192(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan208(b *testing.B) {
|
||||
const size = 208
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -620,7 +591,6 @@ func benchmarkMallocgcNoscan208(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan208(b *testing.B) {
|
||||
const size = 208
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -641,7 +611,6 @@ func benchmarkMallocgcScan208(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan224(b *testing.B) {
|
||||
const size = 224
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -662,7 +631,6 @@ func benchmarkMallocgcNoscan224(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan224(b *testing.B) {
|
||||
const size = 224
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -683,7 +651,6 @@ func benchmarkMallocgcScan224(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan240(b *testing.B) {
|
||||
const size = 240
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -704,7 +671,6 @@ func benchmarkMallocgcNoscan240(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan240(b *testing.B) {
|
||||
const size = 240
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -725,7 +691,6 @@ func benchmarkMallocgcScan240(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan256(b *testing.B) {
|
||||
const size = 256
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -746,7 +711,6 @@ func benchmarkMallocgcNoscan256(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan256(b *testing.B) {
|
||||
const size = 256
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -767,7 +731,6 @@ func benchmarkMallocgcScan256(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan288(b *testing.B) {
|
||||
const size = 288
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -788,7 +751,6 @@ func benchmarkMallocgcNoscan288(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan288(b *testing.B) {
|
||||
const size = 288
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -809,7 +771,6 @@ func benchmarkMallocgcScan288(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan320(b *testing.B) {
|
||||
const size = 320
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -830,7 +791,6 @@ func benchmarkMallocgcNoscan320(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan320(b *testing.B) {
|
||||
const size = 320
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -851,7 +811,6 @@ func benchmarkMallocgcScan320(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan352(b *testing.B) {
|
||||
const size = 352
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -872,7 +831,6 @@ func benchmarkMallocgcNoscan352(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan352(b *testing.B) {
|
||||
const size = 352
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -893,7 +851,6 @@ func benchmarkMallocgcScan352(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan384(b *testing.B) {
|
||||
const size = 384
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -914,7 +871,6 @@ func benchmarkMallocgcNoscan384(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan384(b *testing.B) {
|
||||
const size = 384
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -935,7 +891,6 @@ func benchmarkMallocgcScan384(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan416(b *testing.B) {
|
||||
const size = 416
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -956,7 +911,6 @@ func benchmarkMallocgcNoscan416(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan416(b *testing.B) {
|
||||
const size = 416
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -977,7 +931,6 @@ func benchmarkMallocgcScan416(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan448(b *testing.B) {
|
||||
const size = 448
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -998,7 +951,6 @@ func benchmarkMallocgcNoscan448(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan448(b *testing.B) {
|
||||
const size = 448
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -1019,7 +971,6 @@ func benchmarkMallocgcScan448(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan480(b *testing.B) {
|
||||
const size = 480
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -1040,7 +991,6 @@ func benchmarkMallocgcNoscan480(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan480(b *testing.B) {
|
||||
const size = 480
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -1061,7 +1011,6 @@ func benchmarkMallocgcScan480(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcNoscan512(b *testing.B) {
|
||||
const size = 512
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -1082,7 +1031,6 @@ func benchmarkMallocgcNoscan512(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcScan512(b *testing.B) {
|
||||
const size = 512
|
||||
|
||||
b.Run("kind=new", func(b *testing.B) {
|
||||
for b.Loop() {
|
||||
|
||||
|
|
@ -1103,7 +1051,6 @@ func benchmarkMallocgcScan512(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny1(b *testing.B) {
|
||||
const size = 1
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1122,7 +1069,6 @@ func benchmarkMallocgcTiny1(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny2(b *testing.B) {
|
||||
const size = 2
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1141,7 +1087,6 @@ func benchmarkMallocgcTiny2(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny3(b *testing.B) {
|
||||
const size = 3
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1160,7 +1105,6 @@ func benchmarkMallocgcTiny3(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny4(b *testing.B) {
|
||||
const size = 4
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1179,7 +1123,6 @@ func benchmarkMallocgcTiny4(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny5(b *testing.B) {
|
||||
const size = 5
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1198,7 +1141,6 @@ func benchmarkMallocgcTiny5(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny6(b *testing.B) {
|
||||
const size = 6
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1217,7 +1159,6 @@ func benchmarkMallocgcTiny6(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny7(b *testing.B) {
|
||||
const size = 7
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1236,7 +1177,6 @@ func benchmarkMallocgcTiny7(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny8(b *testing.B) {
|
||||
const size = 8
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1255,7 +1195,6 @@ func benchmarkMallocgcTiny8(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny9(b *testing.B) {
|
||||
const size = 9
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1274,7 +1213,6 @@ func benchmarkMallocgcTiny9(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny10(b *testing.B) {
|
||||
const size = 10
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1293,7 +1231,6 @@ func benchmarkMallocgcTiny10(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny11(b *testing.B) {
|
||||
const size = 11
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1312,7 +1249,6 @@ func benchmarkMallocgcTiny11(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny12(b *testing.B) {
|
||||
const size = 12
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1331,7 +1267,6 @@ func benchmarkMallocgcTiny12(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny13(b *testing.B) {
|
||||
const size = 13
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1350,7 +1285,6 @@ func benchmarkMallocgcTiny13(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny14(b *testing.B) {
|
||||
const size = 14
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
@ -1369,7 +1303,6 @@ func benchmarkMallocgcTiny14(b *testing.B) {
|
|||
|
||||
func benchmarkMallocgcTiny15(b *testing.B) {
|
||||
const size = 15
|
||||
|
||||
type s struct {
|
||||
v [size]byte
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ func mallocgcSmallScanNoHeaderSC1(size uintptr, typ *_type, needzero bool) unsaf
|
|||
}
|
||||
|
||||
const sizeclass = 1
|
||||
|
||||
const elemsize = 8
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -55,9 +54,7 @@ func mallocgcSmallScanNoHeaderSC1(size uintptr, typ *_type, needzero bool) unsaf
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
8 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*8 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -199,7 +196,6 @@ func mallocgcSmallScanNoHeaderSC2(size uintptr, typ *_type, needzero bool) unsaf
|
|||
}
|
||||
|
||||
const sizeclass = 2
|
||||
|
||||
const elemsize = 16
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -223,9 +219,7 @@ func mallocgcSmallScanNoHeaderSC2(size uintptr, typ *_type, needzero bool) unsaf
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
16 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*16 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -367,7 +361,6 @@ func mallocgcSmallScanNoHeaderSC3(size uintptr, typ *_type, needzero bool) unsaf
|
|||
}
|
||||
|
||||
const sizeclass = 3
|
||||
|
||||
const elemsize = 24
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -391,9 +384,7 @@ func mallocgcSmallScanNoHeaderSC3(size uintptr, typ *_type, needzero bool) unsaf
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
24 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*24 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -535,7 +526,6 @@ func mallocgcSmallScanNoHeaderSC4(size uintptr, typ *_type, needzero bool) unsaf
|
|||
}
|
||||
|
||||
const sizeclass = 4
|
||||
|
||||
const elemsize = 32
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -559,9 +549,7 @@ func mallocgcSmallScanNoHeaderSC4(size uintptr, typ *_type, needzero bool) unsaf
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
32 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*32 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -703,7 +691,6 @@ func mallocgcSmallScanNoHeaderSC5(size uintptr, typ *_type, needzero bool) unsaf
|
|||
}
|
||||
|
||||
const sizeclass = 5
|
||||
|
||||
const elemsize = 48
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -727,9 +714,7 @@ func mallocgcSmallScanNoHeaderSC5(size uintptr, typ *_type, needzero bool) unsaf
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
48 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*48 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -871,7 +856,6 @@ func mallocgcSmallScanNoHeaderSC6(size uintptr, typ *_type, needzero bool) unsaf
|
|||
}
|
||||
|
||||
const sizeclass = 6
|
||||
|
||||
const elemsize = 64
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -895,9 +879,7 @@ func mallocgcSmallScanNoHeaderSC6(size uintptr, typ *_type, needzero bool) unsaf
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
64 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*64 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1039,7 +1021,6 @@ func mallocgcSmallScanNoHeaderSC7(size uintptr, typ *_type, needzero bool) unsaf
|
|||
}
|
||||
|
||||
const sizeclass = 7
|
||||
|
||||
const elemsize = 80
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -1063,9 +1044,7 @@ func mallocgcSmallScanNoHeaderSC7(size uintptr, typ *_type, needzero bool) unsaf
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
80 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*80 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1207,7 +1186,6 @@ func mallocgcSmallScanNoHeaderSC8(size uintptr, typ *_type, needzero bool) unsaf
|
|||
}
|
||||
|
||||
const sizeclass = 8
|
||||
|
||||
const elemsize = 96
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -1231,9 +1209,7 @@ func mallocgcSmallScanNoHeaderSC8(size uintptr, typ *_type, needzero bool) unsaf
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
96 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*96 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1375,7 +1351,6 @@ func mallocgcSmallScanNoHeaderSC9(size uintptr, typ *_type, needzero bool) unsaf
|
|||
}
|
||||
|
||||
const sizeclass = 9
|
||||
|
||||
const elemsize = 112
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -1399,9 +1374,7 @@ func mallocgcSmallScanNoHeaderSC9(size uintptr, typ *_type, needzero bool) unsaf
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
112 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*112 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1543,7 +1516,6 @@ func mallocgcSmallScanNoHeaderSC10(size uintptr, typ *_type, needzero bool) unsa
|
|||
}
|
||||
|
||||
const sizeclass = 10
|
||||
|
||||
const elemsize = 128
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -1567,9 +1539,7 @@ func mallocgcSmallScanNoHeaderSC10(size uintptr, typ *_type, needzero bool) unsa
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
128 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*128 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1776,9 +1746,7 @@ func mallocgcTinySC2(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
|
|||
span := c.alloc[tinySpanClass]
|
||||
|
||||
const nbytes = 8192
|
||||
const nelems = uint16((nbytes - unsafe.Sizeof(spanInlineMarkBits{})) /
|
||||
16,
|
||||
)
|
||||
const nelems = uint16((nbytes - unsafe.Sizeof(spanInlineMarkBits{})) / 16)
|
||||
var nextFreeFastResult gclinkptr
|
||||
if span.allocCache != 0 {
|
||||
theBit := sys.TrailingZeros64(span.allocCache)
|
||||
|
|
@ -1789,9 +1757,7 @@ func mallocgcTinySC2(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
16 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*16 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1873,7 +1839,6 @@ func mallocgcSmallNoScanSC2(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
}
|
||||
|
||||
const sizeclass = 2
|
||||
|
||||
const elemsize = 16
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -1929,9 +1894,7 @@ func mallocgcSmallNoScanSC2(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
16 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*16 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2009,7 +1972,6 @@ func mallocgcSmallNoScanSC3(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
}
|
||||
|
||||
const sizeclass = 3
|
||||
|
||||
const elemsize = 24
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -2065,9 +2027,7 @@ func mallocgcSmallNoScanSC3(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
24 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*24 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2145,7 +2105,6 @@ func mallocgcSmallNoScanSC4(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
}
|
||||
|
||||
const sizeclass = 4
|
||||
|
||||
const elemsize = 32
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -2201,9 +2160,7 @@ func mallocgcSmallNoScanSC4(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
32 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*32 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2281,7 +2238,6 @@ func mallocgcSmallNoScanSC5(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
}
|
||||
|
||||
const sizeclass = 5
|
||||
|
||||
const elemsize = 48
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -2337,9 +2293,7 @@ func mallocgcSmallNoScanSC5(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
48 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*48 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2417,7 +2371,6 @@ func mallocgcSmallNoScanSC6(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
}
|
||||
|
||||
const sizeclass = 6
|
||||
|
||||
const elemsize = 64
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -2473,9 +2426,7 @@ func mallocgcSmallNoScanSC6(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
64 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*64 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2553,7 +2504,6 @@ func mallocgcSmallNoScanSC7(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
}
|
||||
|
||||
const sizeclass = 7
|
||||
|
||||
const elemsize = 80
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -2609,9 +2559,7 @@ func mallocgcSmallNoScanSC7(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
80 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*80 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2689,7 +2637,6 @@ func mallocgcSmallNoScanSC8(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
}
|
||||
|
||||
const sizeclass = 8
|
||||
|
||||
const elemsize = 96
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -2745,9 +2692,7 @@ func mallocgcSmallNoScanSC8(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
96 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*96 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2825,7 +2770,6 @@ func mallocgcSmallNoScanSC9(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
}
|
||||
|
||||
const sizeclass = 9
|
||||
|
||||
const elemsize = 112
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -2881,9 +2825,7 @@ func mallocgcSmallNoScanSC9(size uintptr, typ *_type, needzero bool) unsafe.Poin
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
112 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*112 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2961,7 +2903,6 @@ func mallocgcSmallNoScanSC10(size uintptr, typ *_type, needzero bool) unsafe.Poi
|
|||
}
|
||||
|
||||
const sizeclass = 10
|
||||
|
||||
const elemsize = 128
|
||||
|
||||
mp := acquirem()
|
||||
|
|
@ -3017,9 +2958,7 @@ func mallocgcSmallNoScanSC10(size uintptr, typ *_type, needzero bool) unsafe.Poi
|
|||
span.allocCache >>= uint(theBit + 1)
|
||||
span.freeindex = freeidx
|
||||
span.allocCount++
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*
|
||||
128 +
|
||||
span.base())
|
||||
nextFreeFastResult = gclinkptr(uintptr(result)*128 + span.base())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue