-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore adjustment heuristics if size in weighCallSite is negative
The estimated code size of methods can be negative; this is to indicate that the method is a good candidate for inlinling. However, the logic in weighCallSite, which contains several heuristics that adjust the size of a candidate method, used a variable of type uint32_t. The first issue is that the code that compares the size of a method to the inlining budget results in promoting the inlining budge value from a signed 32-bit integer to an unsigned 32-bit integer, because the variable that represents the size of the candidate method is an unsigned 32-bit integer. This means that any negative size, which is supposed to represent a good candidate method, will actually cause the inliner to make the determination that it is a very bad candidate method. The second issue is that even if if the comparison was fixed to cast the size variable to be a signed 32-bit integer, the heuristics prior to that point that adjust the size can result in an overflow that now leaves the size variable with a very large signed positive number, which again, causes the inliner to make the determination that the candidate method is very bad for inlining. This commit fixes both issues by 1. Changing the size variable to be of type int32_t 2. Only allowing the heuristics to adjust the size if it is positive. Signed-off-by: Irwin D'Souza <[email protected]>
- Loading branch information
Showing
1 changed file
with
51 additions
and
43 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