X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fcompile%2Finternal%2Finline%2Finlheur%2Fanalyze.go;h=3ef750bf615fd62b2bbc763485e9df2cef63dbdb;hb=04d64a3b36f872e97d965197337d001d5361d71c;hp=9af7e1207d9f1b8a3089529d61b194b869ad247b;hpb=74350dd603a3480e1402a6ec98608ccb11246fb1;p=gostls13.git diff --git a/src/cmd/compile/internal/inline/inlheur/analyze.go b/src/cmd/compile/internal/inline/inlheur/analyze.go index 9af7e1207d..3ef750bf61 100644 --- a/src/cmd/compile/internal/inline/inlheur/analyze.go +++ b/src/cmd/compile/internal/inline/inlheur/analyze.go @@ -83,6 +83,28 @@ func AnalyzeFunc(fn *ir.Func, canInline func(*ir.Func), inlineMaxBudget int32) * return funcProps } +// RevisitInlinability revisits the question of whether to continue to +// treat function 'fn' as an inline candidate based on the set of +// properties we've computed for it. If (for example) it has an +// initial size score of 150 and no interesting properties to speak +// of, then there isn't really any point to moving ahead with it as an +// inline candidate. +func RevisitInlinability(fn *ir.Func, budgetForFunc func(*ir.Func) int32) { + if fn.Inl == nil { + return + } + entry, ok := fpmap[fn] + if !ok { + //FIXME: issue error? + return + } + mxAdjust := int32(largestScoreAdjustment(fn, entry.props)) + budget := budgetForFunc(fn) + if fn.Inl.Cost+mxAdjust > budget { + fn.Inl = nil + } +} + // computeFuncProps examines the Go function 'fn' and computes for it // a function "properties" object, to be used to drive inlining // heuristics. See comments on the FuncProps type for more info.