RFR: 8263017: Read barriers are missing in nmethod printing code [v2]

Vladimir Ivanov vlivanov at openjdk.java.net
Fri Mar 12 11:25:26 UTC 2021


> OOP accesses from nmethod printing code miss read barriers. 
> It causes sporadic crashes when the code stumbles upon a stale OOP.
> 
> When `nmethod::print_nmethod` is invoked, the corresponding nmethod is already installed in the code cache and there was a safepoint check in between (see `ThreadToNativeFromVM` usage in `CompileBroker::invoke_compiler_on_method`).
>  
> The fix adds missing read barriers in `oop_Relocation::oop_value()` and introduces `oop_Relocation::raw_oop_value()` for cases when read barriers aren't needed.
> 
> Along the way, there are some cleanups applied (e.g, `nmethod::print_[oops|metadata]` is superseded by `nmethod::print_recorded_[oops|metadata]`).
> 
> Testing:
> - [x] failing test w/ `-XX:+UseZGC` `-XX:ZCollectionInterval=0.01` `-XX:ZFragmentationLimit=0`
> - [x] hs-tier1 - hs-tier4
> 
> Thanks!

Vladimir Ivanov has updated the pull request incrementally with one additional commit since the last revision:

  Use CompiledMethod::run_nmethod_entry_barrier()

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2919/files
  - new: https://git.openjdk.java.net/jdk/pull/2919/files/3b99cd4f..4ee8bd08

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2919&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2919&range=00-01

  Stats: 119 lines in 8 files changed: 73 ins; 28 del; 18 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2919.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2919/head:pull/2919

PR: https://git.openjdk.java.net/jdk/pull/2919



More information about the hotspot-gc-dev mailing list