RFR: 8258229: Crash in nmethod::reloc_string_for [v2]

Manuel Hässig duke at openjdk.org
Tue Apr 29 12:56:07 UTC 2025


> ## Issue Summary
> 
> The issue manifests in intermittent failures of test cases with `-XX:+PrintAssembly`. The reason for these intermittent failures is a deoptimization of the method before or during printing its assembly. In case that deoptimization makes the method not entrant, then the entry of that method is patched, but the relocation information is not updated. If the instruction at the method entry before patching had relocation info that prints a comment during assembly printing, printing that comment for the patched entry fails in case the operands of the original and patched instructions do not match.
> 
> ## Change Summary
> 
> To fix this issue, this PR updates the relocation info when patching the method entry. To avoid any races between printing and deoptimizing, this PR acquires the`NMethodState_lock`for printing an `nmethod`.
> 
> All changes of this PR summarized:
>  - add a regression test,
>  - update the relocation information after patching the method entry for making it not entrant,
>  - acquire the `NMethodStat_lock` in `print_nmethod()` to avoid changing the relocation information during printing.
> 
> ## Testing
> 
> I ran tiers 1 through 3 and Oracle internal testing.

Manuel Hässig has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:

 - Merge branch 'master' into jdk-8258229-nmethod
 - Add DeoptimizeALot and fix typo in test
 - Hold NMethodState_lock while printing an nmethod
   
   This prevents data races on the relocation info when code is patched.
 - Update relocation info when making method not entrant
 - Add regression test

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24831/files
  - new: https://git.openjdk.org/jdk/pull/24831/files/8cf462f2..956f45a6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24831&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24831&range=00-01

  Stats: 24438 lines in 752 files changed: 17057 ins; 4744 del; 2637 mod
  Patch: https://git.openjdk.org/jdk/pull/24831.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24831/head:pull/24831

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


More information about the hotspot-compiler-dev mailing list