]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: share compiler allocations of similar shapes
authorKeith Randall <khr@golang.org>
Mon, 9 Jan 2023 22:29:49 +0000 (14:29 -0800)
committerKeith Randall <khr@golang.org>
Wed, 15 Feb 2023 23:00:54 +0000 (23:00 +0000)
commit0e42632301f17ae384e2cc1edb273860ed8f9fac
tree3c202e39d50e87025836bab2c0170318f27a6a8d
parent87366feb125008aadc85ace6ccbfd2213b640c9c
cmd/compile: share compiler allocations of similar shapes

Use the same allocator for, e.g., []int32 and []int8. Anything with
similar base shapes and be coerced into a single allocator, which helps
reuse memory more often.

There is not much unsafe in the compiler currently. This adds quite a bit,
joining cmd/compiler/internal/base/mapfile_mmap.go and some unsafe.Sizeof calls.

Change-Id: I95d6d6e47c42b9f0a45f3556f4d7605735e65d99
Reviewed-on: https://go-review.googlesource.com/c/go/+/461084
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
src/cmd/compile/internal/ssa/_gen/allocators.go
src/cmd/compile/internal/ssa/allocators.go
src/cmd/compile/internal/ssa/cache.go