interleaved

Imports

Imports #

"cmd/compile/internal/base"
"cmd/compile/internal/devirtualize"
"cmd/compile/internal/inline"
"cmd/compile/internal/inline/inlheur"
"cmd/compile/internal/ir"
"cmd/compile/internal/pgoir"
"cmd/compile/internal/typecheck"
"fmt"

Structs

callSite struct #

type callSite struct {
fn *ir.Func
whichParen int
}

inlClosureState struct #

type inlClosureState struct {
fn *ir.Func
profile *pgoir.Profile
callSites map[*ir.ParenExpr]bool
resolved []*ir.Func
useCounts map[*ir.Func]int
parens []*ir.ParenExpr
bigCaller bool
}

Functions

DevirtualizeAndInlineFunc function #

DevirtualizeAndInlineFunc interleaves devirtualization and inlining on a single function.

func DevirtualizeAndInlineFunc(fn *ir.Func, profile *pgoir.Profile)

DevirtualizeAndInlinePackage function #

DevirtualizeAndInlinePackage interleaves devirtualization and inlining on all functions within pkg.

func DevirtualizeAndInlinePackage(pkg *ir.Package, profile *pgoir.Profile)

edit method #

func (s *inlClosureState) edit(i int) ir.Node

fixpoint method #

fixpoint repeatedly edits a function until it stabilizes, returning whether anything changed in any of the fixpoint iterations. It applies s.edit(n) to each node n within the parentheses in s.parens. If s.edit(n) returns nil, no change is made. Otherwise, the result replaces n in fn's body, and fixpoint iterates at least once more. After an iteration where all edit calls return nil, fixpoint returns.

func (s *inlClosureState) fixpoint() bool

isTestingBLoop function #

isTestingBLoop returns true if it matches the node as a testing.(*B).Loop. See issue #61515.

func isTestingBLoop(t ir.Node) bool

mark method #

Mark inserts parentheses, and is called repeatedly. These inserted parentheses mark the call sites where inlining will be attempted.

func (s *inlClosureState) mark(n ir.Node) ir.Node

match function #

func match(n ir.Node) bool

parenthesize method #

parenthesize applies s.mark to all the nodes within s.fn to mark calls and simplify rewriting them in place.

func (s *inlClosureState) parenthesize()

resolve method #

resolve attempts to resolve a call to a potentially inlineable callee and updates use counts on the callees. Returns the call site count for that callee.

func (s *inlClosureState) resolve(i int) (*ir.Func, int)

unparenthesize method #

func (s *inlClosureState) unparenthesize()

Generated with Arrow