Please review this small fix. After JDK-6960970, a `NotifyFramePop` request 
targeting a virtual thread can lead to deoptimizing a compiled frame that is 
currently in the heap. When the frame deoptimized is the top frame in the 
`stackChunk`, the chunk’s `pc` field must be updated as well.

I refactored `JvmtiEnvBase::set_frame_pop` to separate between the heap vs 
stack frame cases, instead of the current logic which is based on mounted vs 
unmounted. Also helper `frame::deoptimize(JavaThread*, stackChunkOop)` is added 
to encapsulate the deopt logic.

I verified the test doesn’t crash anymore and also tested in mach5 tiers1-6.

Thanks,
Patricio

---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

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

Commit messages:
 - v1

Changes: https://git.openjdk.org/jdk/pull/31456/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=31456&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8385661
  Stats: 27 lines in 3 files changed: 17 ins; 6 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/31456.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/31456/head:pull/31456

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

Reply via email to