> JFR Cooperative Sampling relies on a trick to reconstruct a sampled frame at 
> the method exit poll instruction, because at that location, the frame has 
> already been popped. The trick takes the frame_size() from the nmethod and 
> subtracts that value from the SafepointBlob sender frames' sp, thus 
> recreating the form of the just popped frame.
> 
> With Valhalla's new scalarized and non-scalarized frames and calling 
> conventions, this trick no longer works because the actual frame size is not 
> kept in the nmethod; instead, it is part of the frame itself, on the stack 
> (it's the first word below rbp). The problem for JFR Cooperative Sampling is 
> that, at frame reconstruction time, the SafepointBlob stub will have 
> overwritten the sp_inc slot of the popped frame, making frame reconstruction 
> problematic and next to impossible.
> 
> [JDK-8368099](https://bugs.openjdk.org/browse/JDK-8368099) provided a 
> workaround for this problem by skipping all sampled frames with the property 
> "needs_stack_repair" and moving directly to the sender frame instead. This 
> results in biased sampling for nearly all samples taken inside frames whose 
> next poll instruction is the method exit return.
> 
> This solution handles both scalarized and non-scalarized frame layouts.
> 
> Testing: jdk_valhalla, hotspot_valhalla, hotspot_valhalla_runtime, jdk_jfr, 
> stress testing
> 
> Thanks
> Markus

Markus Grönlund has refreshed the contents of this pull request, and previous 
commits have been removed. Incremental views are not available. The pull 
request now contains 15 commits:

 - Merge branch '8378771' of github.com:mgronlun/valhalla into 8378771
 - normalized_bci
 - cleanup
 - DebugNonSafepoints
 - TestNeedStackRepair
 - rename
 - continuation check
 - 8378771
 - normalized_bci
 - cleanup
 - ... and 5 more: https://git.openjdk.org/valhalla/compare/adb1cb8d...cc2ec353

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/2176/files
  - new: https://git.openjdk.org/valhalla/pull/2176/files/81bed67e..cc2ec353

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=valhalla&pr=2176&range=08
 - incr: https://webrevs.openjdk.org/?repo=valhalla&pr=2176&range=07-08

  Stats: 18 lines in 3 files changed: 8 ins; 1 del; 9 mod
  Patch: https://git.openjdk.org/valhalla/pull/2176.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2176/head:pull/2176

PR: https://git.openjdk.org/valhalla/pull/2176

Reply via email to