arena: add experimental arena package

This change adds the arenas package and a function to reflect for
allocating from an arena via reflection, but all the new API is placed
behind a GOEXPERIMENT.

For #51317.

Change-Id: I026d46294e26ab386d74625108c19a0024fbcedc
Reviewed-on: https://go-review.googlesource.com/c/go/+/423361
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Michael Anthony Knyszek 2022-08-12 23:25:56 +00:00 committed by Michael Knyszek
parent 7866538d25
commit e0d01b8467
11 changed files with 451 additions and 1 deletions

View file

@ -1671,6 +1671,10 @@ func GlobalWaitingArenaChunks() int {
return n
}
func UserArenaClone[T any](s T) T {
return arena_heapify(s).(T)
}
var AlignUp = alignUp
// BlockUntilEmptyFinalizerQueue blocks until either the finalizer