what are the rules for inlining a function the compiler follows?
The compiler inlines a function when it deems it would be beneficial to do so. There are heuristics about the size of the function, number of callsites, hotness of the call path, etc.