RFR: 8309978: [x64] Fix useless padding

Vladimir Kozlov kvn at openjdk.org
Wed Jun 14 04:49:43 UTC 2023


Fixed typo in `IntelJccErratum::compute_padding()`.

Due to the typo (`mach` instead of `next`) useless padding could be generated because size of `mach` instruction (which is `cmp` in this case and big)  counted twice. As result combined size most likely cross 32-bytes cache line boundary and padding is generated to avoid that.


030    B2: # out( B4 B3 ) <- in( B1 ) Freq: 0.999999 
       nop # 16 bytes pad for loops and calls 
040    cmpb [R12 + R10 << 3 + #144] (compressed oop addressing), #42 
049    jle,s B4 P=0.667944 C=6785.000000

Note: only some x86 CPUs are [affected](https://github.com/openjdk/jdk/blob/ba837b4bfa2dea85653d8a8fccd0817a569b4378/src/hotspot/cpu/x86/vm_version_x86.cpp#L1957).

For new IR test to work I moved `PHASE_FINAL_CODE` IR print inside `PhaseOutput` scope because padding nodes (`NOP` mach nodes) are present only in this phase IR.

Added new IR test. Tested tier1-3, xcomp, stress.

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

Commit messages:
 - JDK-8309978: [x64] Fix useless padding

Changes: https://git.openjdk.org/jdk/pull/14461/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14461&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8309978
  Stats: 99 lines in 4 files changed: 96 ins; 2 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/14461.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14461/head:pull/14461

PR: https://git.openjdk.org/jdk/pull/14461


More information about the hotspot-compiler-dev mailing list