aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2025-09-29 17:26:49 -0400
committerMichael Matloob <matloob@golang.org>2025-10-09 14:59:40 -0700
commit19a30ea3f250f8d6258f3e08aa3561f1193fdd38 (patch)
tree561da06a8d112056be9b831a248d6f8bd7edf006 /test/codegen
parent80f3bb5516bb12233a15167bc8ba9d39cca5b535 (diff)
downloadgo-19a30ea3f250f8d6258f3e08aa3561f1193fdd38.tar.xz
cmd/compile: call generated size-specialized malloc functions directly
This change creates calls to size-specialized malloc functions instead of calls to newObject when we know the size of the allocation at compilation time. Most of it is a matter of calling the newObject function (which will create calls to the size-specialized functions) rather then the newObjectNonSpecialized function (which won't). In the newHeapaddr, small, non-pointer case, we'll create a non specialized newObject and transform that into the appropriate size-specialized function when we produce the mallocgc in flushPendingHeapAllocations. We have to update some of the rewrites in generic.rules to also apply to the size-specialized functions when they apply to newObject. The messiest thing is we have to adjust the offset we use to save the memory profiler stack, because the depth of the call to profilealloc is two frames fewer in the size-specialized malloc functions compared to when newObject calls mallocgc. A bunch of tests have been adjusted to account for that. Change-Id: I6a6a6964c9037fb6719e392c4a498ed700b617d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/707856 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/strings.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/codegen/strings.go b/test/codegen/strings.go
index 498c3d398f..0b3ca7016f 100644
--- a/test/codegen/strings.go
+++ b/test/codegen/strings.go
@@ -23,7 +23,7 @@ func CountBytes(s []byte) int {
func ToByteSlice() []byte { // Issue #24698
// amd64:`LEAQ\ttype:\[3\]uint8`
- // amd64:`CALL\truntime\.newobject`
+ // amd64:`CALL\truntime\.mallocTiny3`
// amd64:-`.*runtime.stringtoslicebyte`
return []byte("foo")
}