Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8362564

hotspot/jtreg/compiler/c2/TestLWLockingCodeGen.java fails on static JDK on x86_64 with AVX instruction extensions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • None
    • hotspot
    • None

      We recently noticed hotspot/jtreg/compiler/c2/TestLWLockingCodeGen.java "randomly" failed during our JDK 25 and JDK mainline based testing. The test hit the following assertion and timeout (due to -XX:+ShowMessageBoxOnError) when it failed.

      ```
      Internal Error at stubRoutines.cpp:234, pid=398520, tid=398529
      assert(code_size == 0 || buffer.insts_remaining() > 200) failed: increase _initial_code_size
      ```

      [~rasbold] and myself both spent some time reproducing and debugging the issue. We found the test failed on static-jdk fastdebug x86-64 build on machines with AVX instruction extensions supported. That's why the test did not fail always but appeared to be randomly failing only.

      According to the log output from -XX:+PrintStubCode, running static JDK on x86_64 machines with AVX extensions, StubRoutines::updateBytesCRC32 and StubRoutines::updateBytesCRC32C had more generated instructions, compared to the runs that pass on machines without AVX extensions. Here is the total size for the initial stubs running with slowdebug static JDK on machines with AVX extensions.

      ```
      [0.070s][info ][stubs] StubRoutines (initialstubs) [0x00007f43ce000ee0, 0x00007f43ce005e40] used: 20231, free: 89; code_size: 20000
      ```

      I also compared the generated stubs between regular JDK and static JDK (please see detailed diff below). Mostly of the stubs appeared to have slightly smaller number of instructions with regular JDK, which was why the issue has only been noticed on static-jdk so far.

      ```
      static JDK
      -------
      StubRoutines::forward_exception [0x00007f2b2e000ee0, 0x00007f2b2e001031] (337 bytes)

      StubRoutines::call_stub [0x00007f2b2e001031, 0x00007f2b2e00142a] (1017 bytes)

      StubRoutines::catch_exception [0x00007f2b2e00142a, 0x00007f2b2e00161d] (499 bytes)

      StubRoutines::updateBytesCRC32 [0x00007f2b2e0017e0, 0x00007f2b2e001c8e] (1198 bytes)

      StubRoutines::updateBytesCRC32C [0x00007f2b2e001ca0, 0x00007f2b2e0023b4] (1812 bytes)

      StubRoutines::dsin [0x00007f2b2e0023cc, 0x00007f2b2e002b11] (1861 bytes)

      StubRoutines::dtan [0x00007f2b2e003212, 0x00007f2b2e003b1a] (2312 bytes)

      StubRoutines::dtanh [0x00007f2b2e003b1a, 0x00007f2b2e003e75] (859 bytes)

      StubRoutines::dcbrt [0x00007f2b2e003e75, 0x00007f2b2e0040ea] (629 bytes)

      StubRoutines::dexp [0x00007f2b2e0040ea, 0x00007f2b2e004477] (909 bytes)

      StubRoutines::dpow [0x00007f2b2e004477, 0x00007f2b2e005652] (4571 bytes)

      StubRoutines::dlog [0x00007f2b2e005652, 0x00007f2b2e0058e6] (660 bytes)

      StubRoutines::dlog10 [0x00007f2b2e0058e6, 0x00007f2b2e005bce] (744 bytes)

      StubRoutines::fmod [0x00007f2b2e005be0, 0x00007f2b2e005de7] (519 bytes)

      [0.009s][info][stubs] StubRoutines (initialstubs) [0x00007f2b2e000ee0, 0x00007f2b2e006228] used: 20231, free: 1089;

      regular JDK
      -----------
      StubRoutines::forward_exception [0x00007f018e000ee0, 0x00007f018e001015] (309 bytes)

      StubRoutines::call_stub [0x00007f018e001015, 0x00007f018e0013c8] (947 bytes)

      StubRoutines::catch_exception [0x00007f018e0013c8, 0x00007f018e001598] (464 bytes)

      StubRoutines::updateBytesCRC32 [0x00007f018e001760, 0x00007f018e001bf9] (1177 bytes)

      StubRoutines::updateBytesCRC32C [0x00007f018e001c00, 0x00007f018e002304] (1796 bytes)

      StubRoutines::dsin [0x00007f018e00231c, 0x00007f018e0029ab] (1679 bytes)

      StubRoutines::dcos [0x00007f018e0029ab, 0x00007f018e00301c] (1649 bytes)

      StubRoutines::dtan [0x00007f018e00301c, 0x00007f018e003864] (2120 bytes)

      StubRoutines::dtanh [0x00007f018e003864, 0x00007f018e003b48] (740 bytes)

      StubRoutines::dcbrt [0x00007f018e003b48, 0x00007f018e003d5b] (531 bytes)

      StubRoutines::dexp [0x00007f018e003d5b, 0x00007f018e004078] (797 bytes)

      StubRoutines::dpow [0x00007f018e004078, 0x00007f018e005161] (4329 bytes)

      StubRoutines::dlog [0x00007f018e005161, 0x00007f018e0053d2] (625 bytes)

      StubRoutines::dlog10 [0x00007f018e0053d2, 0x00007f018e00567b] (681 bytes)

      StubRoutines::fmod [0x00007f018e005680, 0x00007f018e005867] (487 bytes)

      [0.005s][info][stubs] StubRoutines (initialstubs) [0x00007f018e000ee0, 0x00007f018e006228] used: 18823, free: 2497; code_size: 21000
      ```

            jiangli Jiangli Zhou
            jiangli Jiangli Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: