]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: use unsafe.Slice in itabInit
authorIan Lance Taylor <iant@golang.org>
Wed, 3 Dec 2025 23:15:30 +0000 (15:15 -0800)
committerGopher Robot <gobot@golang.org>
Sat, 7 Feb 2026 23:11:25 +0000 (15:11 -0800)
As opposed to old style (*[1 << 16]T(p)[:n:n].

Change-Id: I6836f87741a2e2f6cef34f87cc839d15e309cc67
Reviewed-on: https://go-review.googlesource.com/c/go/+/726401
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/runtime/iface.go

index 0665c4b9840ced9331df92147d6ee7e17e9cc257..c1f5f5b6e52918ec47b617b1f1bec19dad4eb2fe 100644 (file)
@@ -212,9 +212,9 @@ func itabInit(m *itab, firstTime bool) string {
        // the loop is O(ni+nt) not O(ni*nt).
        ni := len(inter.Methods)
        nt := int(x.Mcount)
-       xmhdr := (*[1 << 16]abi.Method)(add(unsafe.Pointer(x), uintptr(x.Moff)))[:nt:nt]
+       xmhdr := unsafe.Slice((*abi.Method)(add(unsafe.Pointer(x), uintptr(x.Moff))), nt)
        j := 0
-       methods := (*[1 << 16]unsafe.Pointer)(unsafe.Pointer(&m.Fun[0]))[:ni:ni]
+       methods := unsafe.Slice((*unsafe.Pointer)(unsafe.Pointer(&m.Fun[0])), ni)
        var fun0 unsafe.Pointer
 imethods:
        for k := 0; k < ni; k++ {