1
0
mirror of https://github.com/golang/go synced 2024-11-15 04:20:22 -07:00
go/test/fixedbugs/issue57778.go
Matthew Dempsky f773bef9ab cmd/compile: fix static init inlining for hidden node fields
Unified IR added several new IR fields for holding *runtime._type
expressions. To avoid throwing off any frontend semantics
(particularly inlining cost heuristics), they were marked as
`mknode:"-"` so that code wouldn't visit them.

Unfortunately, this has a bad interaction with the static init
inlining optimization, because the latter relies on ir.EditChildren to
substitute all parameters. This potentially includes dictionary
parameters, which can appear within the new RType fields.

This CL adds a new ir.EditChildrenWithHidden function that also edits
these fields, and switches staticinit to use it. Longer term, we
should unhide the RType fields so that ir.EditChildren visits them
normally, but that's scarier so late in the release cycle.

Fixes #57778.

Change-Id: I98c1e8cf366156dc0c81a0cb79029cc5e59c476f
Reviewed-on: https://go-review.googlesource.com/c/go/+/461686
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2023-01-17 22:13:42 +00:00

20 lines
412 B
Go

// compile
// Copyright 2023 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 p
type FreeListG[T any] struct {
freelist []*node[T]
}
type node[T any] struct{}
func NewFreeListG[T any](size int) *FreeListG[T] {
return &FreeListG[T]{freelist: make([]*node[T], 0, size)}
}
var bf = NewFreeListG[*int](1024)