RFR: 8282722: Regard mapping array in enum switches as stable for constant folding

Jatin Bhateja jbhateja at openjdk.java.net
Mon Mar 7 09:24:59 UTC 2022


On Mon, 7 Mar 2022 09:16:45 GMT, Joshua Zhu <jzhu at openjdk.org> wrote:

>> Is there a jmh micro-ben to show the perf improvement?
>> Or a jtreg test to show the inlining effect after this patch?
>> 
>> Copyright year in `fieldInfo.hpp` needs to be updated.
>> 
>> Thanks.
>
>> Is there a jmh micro-ben to show the perf improvement? Or a jtreg test to show the inlining effect after this patch?
>> 
>> Copyright year in `fieldInfo.hpp` needs to be updated.
>> 
>> Thanks.
> 
> Thanks for your comments.
> This change is an optimization workable for all enum switches.
> Please check the example at http://cr.openjdk.java.net/~jzhu/8282722/
> You can check the generated codes or IR graph of function "test2" for differences with/without this change.

Hi @JoshuaZhuwj , Can we also augment mentioned method [1] with a ForceInline attribute.  Since SPECIES itself is static final it's constantness will propagate down to its fields and enable expression folding. But your fix looks generic one.

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

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


More information about the hotspot-dev mailing list