-
Notifications
You must be signed in to change notification settings - Fork 666
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This adds an option to the inliner to do "partial inlining" of hot callsites, where the callee has a hot "prefix", and cold "suffix". For example (which is similar to the test case), in the following code snippet... ``` // hot code bar(o); ... void bar(Object o) { // hot code if (o == nullptr) return; // cold code ``` the invocation to "bar" can get partially inlined to the following rewritten code, effectively only inlining the "hot" pure callee code, with a fallback invocation to the actual callee method if the cold code path is ever taken: ``` // hot code if (o == nullptr) goto L1; // fallback cold code bar(o); L1: ... void bar(Object o) { // hot code if (o == nullptr) return; // cold code ... void bar(Object o) { // unchanged ``` A few more details: - We consider a block as hot if it was hit in any interaction - In a callee, we assume that code leading to a `throw` instruction is effectively cold. (To make up for that we don't have frequency information for basic blocks.) - We want the partially inlined code to be of a certain maximum size - We only consider for partially inlining "pure" instructions that don't mutate state, so that we can simply invoke the original callee in the fallback-branch if necessary The new behavior is disabled by default, so this is a behavior-preserving change. Reviewed By: agampe Differential Revision: D68050082 fbshipit-source-id: 658185cc6726d664404a5354892bfeefd8013f23
- Loading branch information
1 parent
0816a76
commit 2eda563
Showing
21 changed files
with
768 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,5 @@ class IntraDexInlinePass : public Pass { | |
|
||
private: | ||
bool m_consider_hot_cold; | ||
bool m_partial_hot_hot; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.