RFR: 8257211: C2: Enable call devirtualization during post-parse phase [v4]

Tobias Hartmann thartmann at openjdk.java.net
Fri Dec 4 10:26:15 UTC 2020


On Thu, 3 Dec 2020 00:10:15 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

>> As of now, call devirtualization is performed only during parsing. After parsing is over, virtual calls stay unchanged even if there's enough information available to successfully devirtualize them.
>> 
>> Proposed patch enhances incremental inlining with virtual call support. The implementation is similar to how late inlining through MethodHandle linkers works: `CallGenerator` is linked from related `CallJavaNode` and once the call becomes eligible for devirtualization, it is put on the late inline list for future processing. It enables inlining through the call, but also even when inlining doesn't happen, devirtualization is beneficial anyway: it strength-reduces a virtual call to a static call (optimised virtual). 
>> 
>> Also, the patch introduces a dedicated pass over inline list very late in the pipeline specifically to strength reduce virtual calls to static ones w/o even attempting inlining. And it covers late inlining of MethodHandle linkers along the way.
>> 
>> Initial version of the patch has been integrated into `panama-dev` (`vectorIntrinsics` branch) in July, 2020 [1] and since then it went through multiple rounds of testing and a number of bugs were fixed.
>> 
>> (Original motivation for the work was Vector API which suffered severe performance regression after major API and implementation refactoring (`vector-unstable` branch), but it turned out it benefits ordinary Java code as well.) 
>> 
>> Testing:
>> - [x] hs-tier1-6 w/ and w/o `-XX:+AlwaysIncrementalInline` and `-XX:+StressMethodHandleLinkerInlining`
>> 
>> Thanks!
>> 
>> [1] https://hg.openjdk.java.net/panama/dev/rev/5b601a43ac88
>
> Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use "modified_list->size() > 0" check

Very nice! :)

src/hotspot/share/opto/callGenerator.cpp line 396:

> 394: 
> 395:     // Convert the CallStaticJava into an inline
> 396:   virtual void do_late_inline();

Wrong indentation of comment.

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

Marked as reviewed by thartmann (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/1550


More information about the hotspot-compiler-dev mailing list