On Fri, 8 Sep 2023 12:34:39 GMT, Andrew Haley <a...@openjdk.org> wrote:

>> This PR fixes a specific problem caused by using r29/rfp to unwind Java 
>> code. For some time we have treated r29 as a callee-saved scratch register, 
>> and it is freely used by C2-generated code. Therefore, any code in SA that 
>> uses getFP() in a compiled frame is very likely to come to grief.
>> 
>> I believe this is the root cause of 8313800, but it's very hard to prove 
>> that because because it's something of an intermittent fault.
>
> Andrew Haley has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Duplicated comment

Neither can I reproduce this issue on linux-riscv64 platform with jdk/jdk tip. 
But it has the same settings for the x8/fp register and context, I guess it 
also bears the same problem. 

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 90d070112db..b21a163e970 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
@@ -322,24 +322,17 @@ private Frame senderForEntryFrame(RISCV64RegisterMap map) 
{
   
//------------------------------------------------------------------------------
   // frame::adjust_unextended_sp
   private void adjustUnextendedSP() {
-    // If we are returning to a compiled MethodHandle call site, the
-    // saved_fp will in fact be a saved value of the unextended SP.  The
-    // simplest way to tell whether we are returning to such a call site
-    // is as follows:
+    // Sites calling method handle intrinsics and lambda forms are
+    // treated as any other call site. Therefore, no special action is
+    // needed when we are returning to any of these call sites.

     CodeBlob cb = cb();
     NMethod senderNm = (cb == null) ? null : cb.asNMethodOrNull();
     if (senderNm != null) {
-      // If the sender PC is a deoptimization point, get the original
-      // PC.  For MethodHandle call site the unextended_sp is stored in
-      // saved_fp.
-      if (senderNm.isDeoptMhEntry(getPC())) {
-        raw_unextendedSP = getFP();
-      }
-      else if (senderNm.isDeoptEntry(getPC())) {
-      }
-      else if (senderNm.isMethodHandleReturn(getPC())) {
-        raw_unextendedSP = getFP();
+      // If the sender PC is a deoptimization point, get the original PC.
+      if (senderNm.isDeoptEntry(getPC()) ||
+          senderNm.isDeoptMhEntry(getPC())) {
+        // DEBUG_ONLY(verifyDeoptriginalPc(senderNm, raw_unextendedSp));
       }
     }
   }

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

PR Comment: https://git.openjdk.org/jdk/pull/15624#issuecomment-1715030409

Reply via email to