RFR: 8314452: Explicitly indicate inlining success/failure in PrintInlining

Jorn Vernee jvernee at openjdk.org
Mon Sep 4 09:06:16 UTC 2023


On Wed, 16 Aug 2023 17:42:42 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> This patch proposes to add a `+` or `-` to messages produced by `PrintInlining`, to indicate whether inlining succeeded or failed. This makes it easier to find inlining failures in an inlining trace, without having to rely on the message to figure out whether inlining succeeded or failed. Looking at inlining failures is often useful for diagnosing the results of benchmarks, but it can be hard to find inlining failures in lengthy traces.
> 
> A sample of what this looks like:
> 
> 
>                             +@ 0   java.lang.foreign.Arena::ofConfined (10 bytes)   inline (hot)
>                               +@ 0   java.lang.Thread::currentThread (0 bytes)   (intrinsic)
>                               +@ 3   jdk.internal.foreign.MemorySessionImpl::createConfined (9 bytes)   inline (hot)
>                                 +@ 5   jdk.internal.foreign.ConfinedSession::<init> (18 bytes)   inline (hot)
>                                   +@ 6   jdk.internal.foreign.ConfinedSession$ConfinedResourceList::<init> (5 bytes)   inline (hot)
>                                     +@ 1   jdk.internal.foreign.MemorySessionImpl$ResourceList::<init> (5 bytes)   inline (hot)
>                                       +@ 1   java.lang.Object::<init> (1 bytes)   inline (hot)
>                                   +@ 9   jdk.internal.foreign.MemorySessionImpl::<init> (20 bytes)   inline (hot)
>                                     +@ 1   java.lang.Object::<init> (1 bytes)   inline (hot)
>                               +@ 6   jdk.internal.foreign.MemorySessionImpl::asArena (9 bytes)   inline (hot)
>                                 +@ 5   jdk.internal.foreign.MemorySessionImpl$1::<init> (10 bytes)   inline (hot)
>                                   +@ 6   java.lang.Object::<init> (1 bytes)   inline (hot)
>                             -@ 8   java.lang.foreign.SegmentAllocator::allocate (24 bytes)   already compiled into a big method
> 
> 
> Using `grep`/`sls` to find inlining failures:
> 
> 
>> Get-Content inlining_trace.txt | sls '-@'
>                             -@ 8   java.lang.foreign.SegmentAllocator::allocate (24 bytes)   already compiled into a big method
>                             -@ 34   java.lang.foreign.SegmentAllocator::allocate (24 bytes)   already compiled into a big method
>                                         -@ 19   java.lang.invoke.MethodHandle::linkToNative(JJJL)D (0 bytes)   native call
>                                     -@ 95   java.lang.foreign.Arena::close (0 bytes)   virtual call
>                           ...

Switched the message. Example:


                            @ 4   TestJIT$Scope::<init> (16 bytes)   inline (hot)
                              @ 1   java.lang.Object::<init> (1 bytes)   inline (hot)
                              @ 9   java.util.ArrayList::<init> (12 bytes)   inline (hot)
                                @ 1   java.util.AbstractList::<init> (10 bytes)   inline (hot)
                                  @ 1   java.util.AbstractCollection::<init> (5 bytes)   inline (hot)
                                    @ 1   java.lang.Object::<init> (1 bytes)   inline (hot)
                            @ 13   TestJIT$Scope::addCloseAction (12 bytes)   inline (hot)
                              @ 5   java.util.ArrayList::add (25 bytes)   failed to inline: already compiled into a big method
                               -> TypeProfile (5120/5120 counts) = java/util/ArrayList
                            @ 17   TestJIT$Scope::close (39 bytes)   inline (hot)
                              @ 4   java.util.ArrayList::iterator (9 bytes)   inline (hot)
                               -> TypeProfile (5120/5120 counts) = java/util/ArrayList
                                @ 5   java.util.ArrayList$Itr::<init> (26 bytes)   inline (hot)
                                  @ 6   java.lang.Object::<init> (1 bytes)   inline (hot)
                              @ 11   java.util.ArrayList$Itr::hasNext (20 bytes)   inline (hot)
                              @ 20   java.util.ArrayList$Itr::next (66 bytes)   inline (hot)
                                @ 1   java.util.ArrayList$Itr::checkForComodification (23 bytes)   inline (hot)
                              @ 30   TestJIT$$Lambda/0x000001c3ab000a10::run (4 bytes)   inline (hot)
                                @ 0   TestJIT::lambda$new$0 (1 bytes)   inline (hot)
                              @ 11   java.util.ArrayList$Itr::hasNext (20 bytes)   inline (hot)


grep:


> sls -path .\inlining.txt -pattern 'failed to inline'

inlining.txt:13:                              @ 5   java.util.ArrayList::add (25 bytes)   failed to inline: already compiled into a big method

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

PR Comment: https://git.openjdk.org/jdk/pull/15315#issuecomment-1704883592


More information about the hotspot-compiler-dev mailing list