RFR: 8257211: C2: Enable call devirtualization during post-parse phase [v5]
Vladimir Ivanov
vlivanov at openjdk.java.net
Mon Dec 7 15:39:23 UTC 2020
> 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 with a new target base due to a merge or a rebase. The pull request now contains eight commits:
- Fix -XX:+PrintInlining for MH and virtual late inline call generators
- Fix -XX:+PrintInlining output
- Fix linkToNative
- Merge branch 'master' into 8257211.devirt.post_parse
- Use "modified_list->size() > 0" check
- Minor cleanup in comments
- Remove invalid assert.
- 8257211: C2: Enable call devirtualization during post-parse phase
-------------
Changes: https://git.openjdk.java.net/jdk/pull/1550/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1550&range=04
Stats: 774 lines in 15 files changed: 510 ins; 147 del; 117 mod
Patch: https://git.openjdk.java.net/jdk/pull/1550.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/1550/head:pull/1550
PR: https://git.openjdk.java.net/jdk/pull/1550
More information about the hotspot-compiler-dev
mailing list