RFR: 8369505: jhsdb jstack --mixed cannot handle continuation stub on Linux

Yasumasa Suenaga ysuenaga at openjdk.org
Mon Oct 13 03:08:58 UTC 2025


On Mon, 13 Oct 2025 02:09:50 GMT, Fei Yang <fyang at openjdk.org> wrote:

>> @pchilano I reproduce the problem with `Thread.yield()`. Thanks! So I added test in the latest commit. I believe it works on both AMD64 and AArch64.
>
> @YaSuenag : 
> Hi, I tried on linux-riscv64 and I see the assertion failure is triggering on this platform as well.
> Seems that your changes are applicable to riscv64 with minor tweak. Maybe you can add this? Thanks.
> 
> 
> diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java
> index e02e056f028..44c8f4c679c 100644
> --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java
> +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/riscv64/RISCV64Frame.java
> @@ -262,7 +262,13 @@ public Frame sender(RegisterMap regMap, CodeBlob cb) {
>      }
> 
>      if (cb != null) {
> -      return cb.isUpcallStub() ? senderForUpcallStub(map, (UpcallStub)cb) : senderForCompiledFrame(map, cb);
> +      if (cb.isUpcallStub()) {
> +        return senderForUpcallStub(map, (UpcallStub)cb);
> +      } else if (cb.isContinuationStub()) {
> +        return senderForContinuationStub(map, cb);
> +      } else {
> +        return senderForCompiledFrame(map, cb);
> +      }
>      }
> 
>      // Must be native-compiled frame, i.e. the marshaling code for native
> @@ -348,6 +354,16 @@ private void updateMapWithSavedLink(RegisterMap map, Address savedFPAddr) {
>      map.setLocation(fp, savedFPAddr);
>    }
> 
> +  private Frame senderForContinuationStub(RISCV64RegisterMap map, CodeBlob cb) {
> +    var contEntry = map.getThread().getContEntry();
> +
> +    Address senderSP = contEntry.getEntrySP();
> +    Address senderPC = contEntry.getEntryPC();
> +    Address senderFP = contEntry.getEntryFP();
> +
> +    return new RISCV64Frame(senderSP, senderFP, senderPC);
> +  }
> +
>    private Frame senderForCompiledFrame(RISCV64RegisterMap map, CodeBlob cb) {
>      if (DEBUG) {
>        System.out.println("senderForCompiledFrame");
> diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVirtualThread.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVirtualThread.java
> index 2565fdf9056..9b4fa067dc0 100644
> --- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVirtualThread.java
> +++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackMixedWithVirtualThread.java
> @@ -37,7 +37,7 @@
>   * @test
>   * @bug 8369505
>   * @requires (os.family == "linux") & (vm.hasSA)
> - * @requires (os.arch == "amd64" | os.arch == "aarch64")
> + * @requires (os.arch == "amd64" | os.arch == "aarch64" | os.arch == "riscv64")
>   * @library /test/lib
>   * @run driver TestJhsdbJstac...

@RealFYang Thanks a lot! I applied your change to this PR!

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

PR Comment: https://git.openjdk.org/jdk/pull/27728#issuecomment-3395709070


More information about the serviceability-dev mailing list