RFR: 8319850: PrintInlining should print which methods are late inlines

Roland Westrelin roland at openjdk.org
Wed Nov 13 08:46:19 UTC 2024


On Wed, 13 Nov 2024 06:19:09 GMT, Dean Long <dlong at openjdk.org> wrote:

> I've been trying to understand all these print_inlining_*() functions for a few days now, and I still don't understand the rules about when each can be called, when we should overwrite and when we should append, when the stringStream should be empty or not empty, and how _print_inlining_list works. Then there is the parallel InlineTree that we build, and it has a success/fail message attached too.

It is indeed a mess.
The way this work, I think, is that the message for the inlining that's currently happening is accumulated in `_print_inlining_stream`.
`_print_inlining_list` is the list of inlining messages. A single entry of `_print_inlining_list` may contain the aggregated messages for multiple call sites. So once we are done, we simply iterate over the list and output each entry. 
If there's no late inlining involved, then `_print_inlining_list` only has a single entry.
When a call site is a candidate for late inlining (i.e. there is a chance that some messages need to be inserted at the current point at a later time), then a new element is added to `_print_inlining_list`. 
If late inlining does happen at that call site, the logic iterates over `_print_inlining_list` and finds the entry with the matching `CallGenerator`. When the call site is inlined, it's possible that this will cause some inlining to happen right away (and so messages to be appended to the current `_print_inlining_list` entry) and some more late inlining to happen later on (and so a new entry to be added to `_print_inlining_list` right after the current one, possibly in the middle of the list). 

If I remember correctly I tried using `InlineTree` instead but that didn't work well. I don't remember the details though.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21899#issuecomment-2472855578


More information about the hotspot-compiler-dev mailing list