diff options
Diffstat (limited to 'src/runtime/runtime1.go')
| -rw-r--r-- | src/runtime/runtime1.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/runtime/runtime1.go b/src/runtime/runtime1.go index 10754eee1c..8da3682261 100644 --- a/src/runtime/runtime1.go +++ b/src/runtime/runtime1.go @@ -5,6 +5,7 @@ package runtime import ( + "internal/abi" "internal/bytealg" "internal/goarch" "internal/runtime/atomic" @@ -627,6 +628,9 @@ func releasem(mp *m) { // Do not remove or change the type signature. // See go.dev/issue/67401. // +// This is obsolete and only remains for external packages. +// New code should use reflect_compiledTypelinks. +// //go:linkname reflect_typelinks reflect.typelinks func reflect_typelinks() ([]unsafe.Pointer, [][]int32) { modules := activeModules() @@ -649,6 +653,23 @@ func reflect_typelinks() ([]unsafe.Pointer, [][]int32) { return sections, ret } +// reflect_compiledTypelinks returns the typelink types +// generated by the compiler for all current modules. +// The normal case is a single module, so this returns one +// slice for the main module, and a slice of slices, normally nil, +// for other modules. +// +//go:linkname reflect_compiledTypelinks reflect.compiledTypelinks +func reflect_compiledTypelinks() ([]*abi.Type, [][]*abi.Type) { + modules := activeModules() + firstTypes := moduleTypelinks(modules[0]) + var rest [][]*abi.Type + for _, md := range modules[1:] { + rest = append(rest, moduleTypelinks(md)) + } + return firstTypes, rest +} + // reflect_resolveNameOff resolves a name offset from a base pointer. // // reflect_resolveNameOff is for package reflect, |
