/
githubmirror
/
go
Обзор
Документация
Войти
/
githubmirror
/
go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/codegen/moveload.go
38 строк
783 B
dorbmon
cmd/compile: forward small Load through Move to avoid redundant copies
11 мар 2026, 06:06
11 мар 2026, 06:06
38ac657
Код
Авторство
О чём код?
// asmcheck // Copyright 2026 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package codegen // From issue #77720: cmd/compile: field access on struct-returning method copies entire struct type moveLoadBig struct { typ int8 index int64 str string pkgID string } type moveLoadHandle[T any] struct { value *T } func (h moveLoadHandle[T]) Value() T { return *h.value } type moveLoadS struct { h moveLoadHandle[moveLoadBig] } func moveLoadFieldViaValue(s moveLoadS) int8 { // amd64:-`MOVUPS` // amd64:`MOVBLZX` return s.h.Value().typ } func moveLoadFieldViaValueInline(ss []moveLoadS, i int) int8 { // amd64:-`MOVUPS` // amd64:`MOVBLZX` return ss[i&7].h.Value().typ }