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

[21u] AArch64: Ambiguous frame layout leads to incorrect traces in JFR

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 8, 11, 17, 21
    • hotspot

      It was previously pointed https://bugs.openjdk.org/browse/JDK-8323755?focusedId=14640270&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14640270 that "When doing a runtime call from compiled code, JVM puts two words onto the stack: ... This breaks the invariant the stack walker relies on: the size of the compiled frame is constant".

      As a result JFR recordings from a simple program from JDK-8323755 do contain wrong samples, e.g. see duplicated timeLoop() entry

      jdk.ExecutionSample {
        startTime = 21:33:04.331 (2025-02-19)
        sampledThread = "timeLoop" (javaThreadId = 39)
        state = "STATE_RUNNABLE"
        stackTrace = [
          Test.time() line: 29
          Test.wrapper() line: 25
          Test.timeLoop() line: 15
          Test.timeLoop() line: 20
        ]
      }

      Other diagnostic tools are affected too.

      Current code in 21u that is responsible for that is https://github.com/openjdk/jdk21u-dev/blob/990859cc32776e2d794de539190c9ccced1dfcd9/src/hotspot/cpu/aarch64/aarch64.ad#L3779
      It's the same for other update releases.

      In mainline jdk the issue has been fixed in JDK 24 as a part of JEP 491: Synchronize Virtual Threads without Pinning (JDK-8338383).

      The fix is in the aarch64.ad changes:
      https://github.com/openjdk/jdk/commit/78b80150e009745b8f28d36c3836f18ad0ca921f#diff-018aa61d1a7aafcf70a535fcd40a318a4bd6511fd40ac39ce4be90cc52216749R1651

            dchuyko Dmitry Chuyko
            dchuyko Dmitry Chuyko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: