RFR: 8293491: Avoid unexpected deoptimization in loop exit due to incorrect branch profiling [v2]
Claes Redestad
redestad at openjdk.org
Mon Sep 19 13:03:49 UTC 2022
On Mon, 12 Sep 2022 03:47:11 GMT, Jie Fu <jiefu at openjdk.org> wrote:
>> Do these deoptimizations really affect performance of your program or did you just spot them when looking at the logs?
>>
>> Such surprising deopts are actually expected with optimistic, profile guided optimizations and happen in many other scenarios as well. They are usually harmless. Also, the profile information is not necessarily incorrect but might just be outdated because we stop profiling once we reach C2. Marking all loop exits as taken seems hacky and might have unexpected side effects.
>>
>> Also, wouldn't C2 still insert a `Deoptimization::Reason_unreached` or `Deoptimization::Reason_unstable_if` trap for subsequent instructions after the loop exit for which profiling also suggests that they were never executed?
>
> Hi @TobiHartmann and @cl4es , patch had been updated.
> Any comments?
> Thanks.
@DamonFool I'll defer to the real C2 experts on this one. My gut feeling is that adding complexity and hard-to-prove-correct shortcuts to the JIT code in order to avoid some unnecessary deoptimizations does not have a great cost/benefit ratio. Unless this can be quantified in some convincing way (such as demonstrate significantly improved time-to-performance on some specific application) then I'd recommend against this.
-------------
PR: https://git.openjdk.org/jdk/pull/10200
More information about the hotspot-compiler-dev
mailing list