aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/malloc_test.go
diff options
context:
space:
mode:
authorthepudds <thepudds1460@gmail.com>2025-11-09 09:24:22 -0500
committert hepudds <thepudds1460@gmail.com>2025-11-14 14:23:16 -0800
commit50128a21541e3fd712ad717a223aaa109cb86d43 (patch)
tree984e45288bdebd7dd2533a8ab62c4154cec244cf /src/runtime/malloc_test.go
parentc3708350a417a3149bf9191878c3ad945063d439 (diff)
downloadgo-50128a21541e3fd712ad717a223aaa109cb86d43.tar.xz
runtime: support runtime.freegc in size-specialized mallocs for noscan objects
This CL is part of a set of CLs that attempt to reduce how much work the GC must do. See the design in https://go.dev/design/74299-runtime-freegc This CL updates the smallNoScanStub stub in malloc_stubs.go to reuse heap objects that have been freed by runtime.freegc calls, and generates the corresponding size-specialized code in malloc_generated.go. This CL only adds support in the specialized mallocs for noscan heap objects (objects without pointers). A later CL handles objects with pointers. While we are here, we leave a couple of breadcrumbs in mkmalloc.go on how to do the generation. Updates #74299 Change-Id: I2657622601a27211554ee862fce057e101767a70 Reviewed-on: https://go-review.googlesource.com/c/go/+/715761 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/malloc_test.go')
-rw-r--r--src/runtime/malloc_test.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/runtime/malloc_test.go b/src/runtime/malloc_test.go
index 10c20e6c23..97cf0eed54 100644
--- a/src/runtime/malloc_test.go
+++ b/src/runtime/malloc_test.go
@@ -349,8 +349,10 @@ func testFreegc[T comparable](noscan bool) func(*testing.T) {
t.Run("allocs-with-free", func(t *testing.T) {
// Same allocations, but now using explicit free so that
// no allocs get reported. (Again, not the desired long-term behavior).
- if SizeSpecializedMallocEnabled {
- t.Skip("temporarily skipping alloc tests for GOEXPERIMENT=sizespecializedmalloc")
+ if SizeSpecializedMallocEnabled && !noscan {
+ // TODO(thepudds): skip at this point in the stack for size-specialized malloc
+ // with !noscan. Additional integration with sizespecializedmalloc is in a later CL.
+ t.Skip("temporarily skipping alloc tests for GOEXPERIMENT=sizespecializedmalloc for pointer types")
}
if !RuntimeFreegcEnabled {
t.Skip("skipping alloc tests with runtime.freegc disabled")
@@ -370,8 +372,10 @@ func testFreegc[T comparable](noscan bool) func(*testing.T) {
// Multiple allocations outstanding before explicitly freeing,
// but still within the limit of our smallest free list size
// so that no allocs are reported. (Again, not long-term behavior).
- if SizeSpecializedMallocEnabled {
- t.Skip("temporarily skipping alloc tests for GOEXPERIMENT=sizespecializedmalloc")
+ if SizeSpecializedMallocEnabled && !noscan {
+ // TODO(thepudds): skip at this point in the stack for size-specialized malloc
+ // with !noscan. Additional integration with sizespecializedmalloc is in a later CL.
+ t.Skip("temporarily skipping alloc tests for GOEXPERIMENT=sizespecializedmalloc for pointer types")
}
if !RuntimeFreegcEnabled {
t.Skip("skipping alloc tests with runtime.freegc disabled")
@@ -514,10 +518,10 @@ func testFreegc[T comparable](noscan bool) func(*testing.T) {
// See https://go.dev/cl/717520 for some additional discussion,
// including how we can deliberately cause the test to fail currently
// if we purposefully introduce some assist credit bugs.
- if SizeSpecializedMallocEnabled {
+ if SizeSpecializedMallocEnabled && !noscan {
// TODO(thepudds): skip this test at this point in the stack; later CL has
// integration with sizespecializedmalloc.
- t.Skip("temporarily skip assist credit test for GOEXPERIMENT=sizespecializedmalloc")
+ t.Skip("temporarily skip assist credit tests for GOEXPERIMENT=sizespecializedmalloc for pointer types")
}
if !RuntimeFreegcEnabled {
t.Skip("skipping assist credit test with runtime.freegc disabled")