diff --git a/CompilerOptimizations.md b/CompilerOptimizations.md index 47fb6504..a01ce0f5 100644 --- a/CompilerOptimizations.md +++ b/CompilerOptimizations.md @@ -80,7 +80,14 @@ Gc compiler does global escape analysis across function and package boundaries. ### Function Inlining -Only short and simple functions are inlined. To be inlined a function must contain less than ~40 expressions and does not contain complex things like loops, labels, closures, `panic`'s, `recover`'s, `select`'s, `switch`'es, etc. +Only short and simple functions are inlined. To be inlined a function must conform to the rules: + +- function should be simple enough, the number of AST nodes must less than the budget (80); +- function doesn't contain complex things like loops, closures, defer, recover, select, etc; +- function isn't prefixed by go:noinline; +- function isn't prefixed by go:uintptrescapes, since the escape information will be lost during inlining; +- function has body; +- etc. * **gc:** 1.0+ * **gccgo:** -O1 and above.