internal/abi: refactor (basic) type struct into one definition

This touches a lot of files, which is bad, but it is also good,
since there's N copies of this information commoned into 1.

The new files in internal/abi are copied from the end of the stack;
ultimately this will all end up being used.

Change-Id: Ia252c0055aaa72ca569411ef9f9e96e3d610889e
Reviewed-on: https://go-review.googlesource.com/c/go/+/462995
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
David Chase 2023-01-20 16:41:57 -05:00
parent dace96b9a1
commit bdc6ae579a
46 changed files with 1479 additions and 711 deletions

View file

@ -233,10 +233,10 @@ func BenchSetType(n int, x any) {
t := e._type
var size uintptr
var p unsafe.Pointer
switch t.kind & kindMask {
switch t.Kind_ & kindMask {
case kindPtr:
t = (*ptrtype)(unsafe.Pointer(t)).elem
size = t.size
size = t.Size_
p = e.data
case kindSlice:
slice := *(*struct {
@ -244,7 +244,7 @@ func BenchSetType(n int, x any) {
len, cap uintptr
})(e.data)
t = (*slicetype)(unsafe.Pointer(t)).elem
size = t.size * slice.len
size = t.Size_ * slice.len
p = slice.ptr
}
allocSize := roundupsize(size)
@ -1754,7 +1754,7 @@ func NewUserArena() *UserArena {
func (a *UserArena) New(out *any) {
i := efaceOf(out)
typ := i._type
if typ.kind&kindMask != kindPtr {
if typ.Kind_&kindMask != kindPtr {
panic("new result of non-ptr type")
}
typ = (*ptrtype)(unsafe.Pointer(typ)).elem