]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: rename mallocTiny* to mallocgcTinySize*
authorMichael Matloob <matloob@golang.org>
Mon, 12 Jan 2026 19:37:39 +0000 (14:37 -0500)
committerMichael Matloob <matloob@golang.org>
Tue, 13 Jan 2026 17:52:54 +0000 (09:52 -0800)
This makes it easier to identify which functions are used for memory
allocation by looking for functions that start with mallocgc. The Size
suffix is added so that the isSpecializedMalloc function in
cmd/compile/internal/ssa can distinguish between the generated functions
and the mallocgcTiny function called by mallocgc, similar to the SC
suffixes for the mallocgcSmallNoScanSC* and mallocgcSmallScanNoHeaderSC*
functons.

Change-Id: I6ad7f15617bf6f18ae5d1bfa2a0b94e86a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/735780
Reviewed-by: Michael Matloob <matloob@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/cmd/compile/internal/ssa/rewrite.go
src/cmd/compile/internal/ssagen/ssa.go
src/runtime/_mkmalloc/mkmalloc.go
src/runtime/malloc_generated.go
src/runtime/malloc_tables_generated.go
test/codegen/strings.go
test/live.go
test/live_regabi.go

index af2568ae8926200448f4d04cce697dc26c2162f9..032915f701e1177d94878714a9d175c124739fa1 100644 (file)
@@ -480,7 +480,7 @@ func isSpecializedMalloc(aux Aux) bool {
        name := fn.String()
        return strings.HasPrefix(name, "runtime.mallocgcSmallNoScanSC") ||
                strings.HasPrefix(name, "runtime.mallocgcSmallScanNoHeaderSC") ||
-               strings.HasPrefix(name, "runtime.mallocTiny")
+               strings.HasPrefix(name, "runtime.mallocgcTinySize")
 }
 
 // canLoadUnaligned reports if the architecture supports unaligned load operations.
index dd5baa0ed59a7e8204aab77750e1820c03aa2fc3..17feb90df7de1bb25cb94af1c6a0ca77d5cd02f3 100644 (file)
@@ -140,7 +140,7 @@ func InitConfig() {
                ir.Syms.MallocGCSmallScanNoHeader[i] = typecheck.LookupRuntimeFunc(fmt.Sprintf("mallocgcSmallScanNoHeaderSC%d", i))
        }
        for i := 1; i < len(ir.Syms.MallocGCTiny); i++ {
-               ir.Syms.MallocGCTiny[i] = typecheck.LookupRuntimeFunc(fmt.Sprintf("mallocTiny%d", i))
+               ir.Syms.MallocGCTiny[i] = typecheck.LookupRuntimeFunc(fmt.Sprintf("mallocgcTinySize%d", i))
        }
        ir.Syms.MallocGC = typecheck.LookupRuntimeFunc("mallocgc")
        ir.Syms.Memmove = typecheck.LookupRuntimeFunc("memmove")
index 434eaad76770fba0d5914b8f2fcab35c253c0ac6..450608a7a46879cd206a405d61cdabe7d27b493b 100644 (file)
@@ -130,7 +130,7 @@ func tinyFuncName(size uintptr) string {
        if size == 0 || size > smallScanNoHeaderMax {
                return "mallocPanic"
        }
-       return fmt.Sprintf("mallocTiny%d", size)
+       return fmt.Sprintf("mallocgcTinySize%d", size)
 }
 
 func smallNoScanSCFuncName(sc, scMax uint8) string {
index 2be6a5b6f502976991a936a5b955da249c2ffe32..8d7112646fe70b1db82c912473c45294c838bca1 100644 (file)
@@ -4300,7 +4300,7 @@ func mallocgcSmallScanNoHeaderSC26(size uintptr, typ *_type, needzero bool) unsa
        return x
 }
 
-func mallocTiny1(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize1(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -4456,7 +4456,7 @@ func mallocTiny1(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny2(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize2(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -4612,7 +4612,7 @@ func mallocTiny2(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny3(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize3(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -4768,7 +4768,7 @@ func mallocTiny3(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny4(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize4(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -4924,7 +4924,7 @@ func mallocTiny4(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny5(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize5(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -5080,7 +5080,7 @@ func mallocTiny5(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny6(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize6(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -5236,7 +5236,7 @@ func mallocTiny6(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny7(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize7(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -5392,7 +5392,7 @@ func mallocTiny7(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny8(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize8(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -5548,7 +5548,7 @@ func mallocTiny8(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny9(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize9(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -5704,7 +5704,7 @@ func mallocTiny9(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny10(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize10(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -5860,7 +5860,7 @@ func mallocTiny10(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny11(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize11(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -6016,7 +6016,7 @@ func mallocTiny11(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny12(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize12(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -6172,7 +6172,7 @@ func mallocTiny12(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny13(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize13(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -6328,7 +6328,7 @@ func mallocTiny13(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny14(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize14(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
@@ -6484,7 +6484,7 @@ func mallocTiny14(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
        return x
 }
 
-func mallocTiny15(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
+func mallocgcTinySize15(size uintptr, typ *_type, needzero bool) unsafe.Pointer {
 
        gp := getg()
        if goexperiment.RuntimeSecret && gp.secret > 0 {
index 36650881fe8beae2cca6bd2708be54ce452a2126..b1ddde2aad1407a11771afc55f3258356bba306e 100644 (file)
@@ -523,21 +523,21 @@ var mallocScanTable = [513]func(size uintptr, typ *_type, needzero bool) unsafe.
 
 var mallocNoScanTable = [513]func(size uintptr, typ *_type, needzero bool) unsafe.Pointer{
        mallocPanic,
-       mallocTiny1,
-       mallocTiny2,
-       mallocTiny3,
-       mallocTiny4,
-       mallocTiny5,
-       mallocTiny6,
-       mallocTiny7,
-       mallocTiny8,
-       mallocTiny9,
-       mallocTiny10,
-       mallocTiny11,
-       mallocTiny12,
-       mallocTiny13,
-       mallocTiny14,
-       mallocTiny15,
+       mallocgcTinySize1,
+       mallocgcTinySize2,
+       mallocgcTinySize3,
+       mallocgcTinySize4,
+       mallocgcTinySize5,
+       mallocgcTinySize6,
+       mallocgcTinySize7,
+       mallocgcTinySize8,
+       mallocgcTinySize9,
+       mallocgcTinySize10,
+       mallocgcTinySize11,
+       mallocgcTinySize12,
+       mallocgcTinySize13,
+       mallocgcTinySize14,
+       mallocgcTinySize15,
        mallocgcSmallNoScanSC2,
        mallocgcSmallNoScanSC3,
        mallocgcSmallNoScanSC3,
index 0c5ee2f8f5ed3fd06770bf178ba6955564fab7b9..1c140211500b6b79b957ff2bf500faed303abc0a 100644 (file)
@@ -23,7 +23,7 @@ func CountBytes(s []byte) int {
 
 func ToByteSlice() []byte { // Issue #24698
        // amd64:`LEAQ type:\[3\]uint8`
-       // amd64:`CALL runtime\.(newobject|mallocTiny3)`
+       // amd64:`CALL runtime\.(newobject|mallocgcTinySize3)`
        // amd64:-`.*runtime.stringtoslicebyte`
        return []byte("foo")
 }
index f8ad8df1ca0750d2ca1f7b058349174dd85f80fc..6561b20925ec24b8fcf19c91c438de646d45fc24 100644 (file)
@@ -665,14 +665,14 @@ func f39a() (x []int) {
 
 func f39b() (x [10]*int) {
        x = [10]*int{}
-       x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$"
+       x[0] = new(int) // ERROR "live at call to (newobject|mallocgcTinySize[48]): x$"
        printnl()       // ERROR "live at call to printnl: x$"
        return x
 }
 
 func f39c() (x [10]*int) {
        x = [10]*int{}
-       x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$"
+       x[0] = new(int) // ERROR "live at call to (newobject|mallocgcTinySize[48]): x$"
        printnl()       // ERROR "live at call to printnl: x$"
        return
 }
index 9809353f1bf4eedfb78b973867a31fe6d0734301..75b842d7324210d2972fa71452965be8f46f6f06 100644 (file)
@@ -663,14 +663,14 @@ func f39a() (x []int) {
 
 func f39b() (x [10]*int) {
        x = [10]*int{}
-       x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$"
+       x[0] = new(int) // ERROR "live at call to (newobject|mallocgcTinySize[48]): x$"
        printnl()       // ERROR "live at call to printnl: x$"
        return x
 }
 
 func f39c() (x [10]*int) {
        x = [10]*int{}
-       x[0] = new(int) // ERROR "live at call to (newobject|mallocTiny[48]): x$"
+       x[0] = new(int) // ERROR "live at call to (newobject|mallocgcTinySize[48]): x$"
        printnl()       // ERROR "live at call to printnl: x$"
        return
 }