diff options
| author | David Chase <drchase@google.com> | 2023-04-25 19:14:05 -0400 |
|---|---|---|
| committer | David Chase <drchase@google.com> | 2023-05-11 13:45:40 +0000 |
| commit | 2e93fe0a9f55aaa2a762e7fb454d76b2ee3a4e4f (patch) | |
| tree | 6ad00fee3adb58714aa001ece696eeebeb2b5087 /src/runtime/mfinal.go | |
| parent | a2838ec5f20b56e94a18c873ab4b68397355e214 (diff) | |
| download | go-2e93fe0a9f55aaa2a762e7fb454d76b2ee3a4e4f.tar.xz | |
runtime: move per-type types to internal/abi
Change-Id: I1f031f0f83a94bebe41d3978a91a903dc5bcda66
Reviewed-on: https://go-review.googlesource.com/c/go/+/489276
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/mfinal.go')
| -rw-r--r-- | src/runtime/mfinal.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/runtime/mfinal.go b/src/runtime/mfinal.go index d302d7fd97..3f9cd4ec74 100644 --- a/src/runtime/mfinal.go +++ b/src/runtime/mfinal.go @@ -241,9 +241,9 @@ func runfinq() { case kindInterface: ityp := (*interfacetype)(unsafe.Pointer(f.fint)) // set up with empty interface - (*eface)(r)._type = &f.ot.typ + (*eface)(r)._type = &f.ot.Type (*eface)(r).data = f.arg - if len(ityp.mhdr) != 0 { + if len(ityp.Methods) != 0 { // convert to interface with methods // this conversion is guaranteed to succeed - we checked in SetFinalizer (*iface)(r).tab = assertE2I(ityp, (*eface)(r)._type) @@ -375,7 +375,7 @@ func SetFinalizer(obj any, finalizer any) { throw("runtime.SetFinalizer: first argument is " + toRType(etyp).string() + ", not pointer") } ot := (*ptrtype)(unsafe.Pointer(etyp)) - if ot.elem == nil { + if ot.Elem == nil { throw("nil elem type!") } @@ -415,7 +415,7 @@ func SetFinalizer(obj any, finalizer any) { if uintptr(e.data) != base { // As an implementation detail we allow to set finalizers for an inner byte // of an object if it could come from tiny alloc (see mallocgc for details). - if ot.elem == nil || ot.elem.PtrBytes != 0 || ot.elem.Size_ >= maxTinySize { + if ot.Elem == nil || ot.Elem.PtrBytes != 0 || ot.Elem.Size_ >= maxTinySize { throw("runtime.SetFinalizer: pointer not at beginning of allocated block") } } @@ -434,26 +434,26 @@ func SetFinalizer(obj any, finalizer any) { throw("runtime.SetFinalizer: second argument is " + toRType(ftyp).string() + ", not a function") } ft := (*functype)(unsafe.Pointer(ftyp)) - if ft.dotdotdot() { + if ft.IsVariadic() { throw("runtime.SetFinalizer: cannot pass " + toRType(etyp).string() + " to finalizer " + toRType(ftyp).string() + " because dotdotdot") } - if ft.inCount != 1 { + if ft.InCount != 1 { throw("runtime.SetFinalizer: cannot pass " + toRType(etyp).string() + " to finalizer " + toRType(ftyp).string()) } - fint := ft.in()[0] + fint := ft.InSlice()[0] switch { case fint == etyp: // ok - same type goto okarg case fint.Kind_&kindMask == kindPtr: - if (fint.Uncommon() == nil || etyp.Uncommon() == nil) && (*ptrtype)(unsafe.Pointer(fint)).elem == ot.elem { + if (fint.Uncommon() == nil || etyp.Uncommon() == nil) && (*ptrtype)(unsafe.Pointer(fint)).Elem == ot.Elem { // ok - not same type, but both pointers, // one or the other is unnamed, and same element type, so assignable. goto okarg } case fint.Kind_&kindMask == kindInterface: ityp := (*interfacetype)(unsafe.Pointer(fint)) - if len(ityp.mhdr) == 0 { + if len(ityp.Methods) == 0 { // ok - satisfies empty interface goto okarg } @@ -465,7 +465,7 @@ func SetFinalizer(obj any, finalizer any) { okarg: // compute size needed for return parameters nret := uintptr(0) - for _, t := range ft.out() { + for _, t := range ft.OutSlice() { nret = alignUp(nret, uintptr(t.Align_)) + uintptr(t.Size_) } nret = alignUp(nret, goarch.PtrSize) |
