mirror of
https://github.com/golang/go
synced 2025-04-12 00:29:42 +00:00
CL 630696 changes budget for once-called closures, making them more inlinable. However, when recursive inlining involve both the closure and its parent, the inliner goes into an infinite loop: parent (a closure) -> closure -> parent -> ... The problem here dues to the closure name mangling, causing the inlined checking condition failed, since the closure name affects how the linker symbol generated. To fix this, just prevent the closure from inlining its parent into itself, avoid the infinite inlining loop. Fixes #71680 Change-Id: Ib27626d70f95e5f1c24a3eb1c8e6c3443b7d90c8 Reviewed-on: https://go-review.googlesource.com/c/go/+/649656 Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
29 lines
595 B
Go
29 lines
595 B
Go
// compile
|
|
|
|
// Copyright 2025 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 Parser struct{}
|
|
type Node struct{}
|
|
|
|
type parserState func(p *Parser) parserState
|
|
|
|
func parserStateData(root *Node) parserState {
|
|
return func(p *Parser) parserState {
|
|
return parserStateOpenMap(root)(p)
|
|
}
|
|
}
|
|
|
|
func parserStateOpenMap(root *Node) parserState {
|
|
return func(p *Parser) parserState {
|
|
switch {
|
|
case p != nil:
|
|
return parserStateData(root)(p)
|
|
}
|
|
return parserStateOpenMap(root)(p)
|
|
}
|
|
}
|