X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fruntime%2Fexport_test.go;h=f889c44b644a5cc684ae5278256a3151cc0368f5;hb=38ac7c41aa54306c0bdc04a092838103a7d09997;hp=b60c1f0a69d1d44dc5bfa6c7f4e81865234556b1;hpb=25867485a748bbefc938e66330912cd88c2f4acb;p=gostls13.git diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index b60c1f0a69..f889c44b64 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -9,6 +9,7 @@ package runtime import ( "internal/abi" "internal/goarch" + "internal/goexperiment" "internal/goos" "runtime/internal/atomic" "runtime/internal/sys" @@ -326,6 +327,14 @@ func BenchSetTypeSlice[T any](n int, resetTimer func(), len int) { // no valid racectx, but if we're instantiated in the runtime_test package, // we might accidentally cause runtime code to be incorrectly instrumented. func benchSetType(n int, resetTimer func(), len int, x unsafe.Pointer, t *_type) { + // This benchmark doesn't work with the allocheaders experiment. It sets up + // an elaborate scenario to be able to benchmark the function safely, but doing + // this work for the allocheaders' version of the function would be complex. + // Just fail instead and rely on the test code making sure we never get here. + if goexperiment.AllocHeaders { + panic("called benchSetType with allocheaders experiment enabled") + } + // Compute the input sizes. size := t.Size() * uintptr(len) @@ -340,7 +349,7 @@ func benchSetType(n int, resetTimer func(), len int, x unsafe.Pointer, t *_type) // Round up the size to the size class to make the benchmark a little more // realistic. However, validate it, to make sure this is safe. - allocSize := roundupsize(size) + allocSize := roundupsize(size, t.PtrBytes == 0) if s.npages*pageSize < allocSize { panic("backing span not large enough for benchmark") }