]> Cypherpunks repositories - gostls13.git/commit
runtime, reflect: avoid allocation in structType.Field common cases
authorIan Lance Taylor <iant@golang.org>
Thu, 11 Jul 2024 21:49:43 +0000 (14:49 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 10 Sep 2024 22:38:30 +0000 (22:38 +0000)
commit493517bb5c84e8f88ba74d4d2e8c3ac58fda7839
tree3defc2560465bbf169a489f04bf09237935c54e0
parent8926ca9c5ec3ea0b51e413e87f737aeb1422ea48
runtime, reflect: avoid allocation in structType.Field common cases

Use assembler to make runtime.staticuint64s into a readonly array
so that the reflect package can safely create a slice without requiring
any allocation.

Fixes #2320
Fixes #68380

Change-Id: If2c97238eca782d0632db265c840581d4ecb9d18
Reviewed-on: https://go-review.googlesource.com/c/go/+/597855
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
src/reflect/all_test.go
src/reflect/type.go
src/runtime/iface.go
src/runtime/ints.s [new file with mode: 0644]