RFR: 8331253: 16 bits is not enough for nmethod::_skipped_instructions_size field
Vladimir Kozlov
kvn at openjdk.org
Wed May 1 21:57:54 UTC 2024
On Wed, 1 May 2024 03:31:41 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
> In [JDK-8329433](https://bugs.openjdk.org/browse/JDK-8329433) I changed `nmethod::_skipped_instructions_size` field type to `uint16_t` assuming that it only count NOP instructions and GC barriers. I did not take into account that Generational ZGC also incudes barrier stubs into this size (original ZGC missed that). It is correct to include them because these stubs are generated in instructions section and not in stubs section:
>
>
> Statistics for 1330 bytecoded nmethods for C2:
> ...
> ZGC:
> main code = 3237080 (75.567032%)
> stubs code = 810577 (25.040375%)
> skipped insts = 44432 (1.372595%)
>
> GenZGC:
> main code = 4034704 (78.238518%)
> stubs code = 1356703 (33.625839%)
> skipped insts = 1074611 (26.634197%)
>
>
> Note, GenZGC has bigger code because it has store barriers. It generates a separate stub for each barrier, no sharing.
>
> After looking on how `_skipped_instructions_size` is used (only in one place when calculated inlinining size of compiled code) I decided replace it with `int _inline_insts_size;`. It is calculated the same way as before.
>
> And instead of including instructions stubs into `_skipped_instructions_size` I recorded size of instructions in code section before stubs are generated. This allow to get more accurate size of main instructions and no need for `InlineSkippedInstructionsCounter` in GC barriers stubs.
>
> I also fixed code in C2 which estimates size of code and stubs sections.
>
> Tested tier1-4,tier8,stress,xcomp
Thank you, Dean.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19029#issuecomment-2089196917
More information about the hotspot-compiler-dev
mailing list