RFR: 8286301: Port JEP 425 to RISC-V [v3]

Fei Yang fyang at openjdk.org
Thu Nov 3 03:26:28 UTC 2022


On Wed, 2 Nov 2022 22:22:35 GMT, Dean Long <dlong at openjdk.org> wrote:

>> Fei Yang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - Merge branch 'master' into 8286301
>>  - Fix
>>  - 8286301: JEP 425 to RISC-V
>
> src/hotspot/share/runtime/continuationFreezeThaw.cpp line 1053:
> 
>> 1051: 
>> 1052:   intptr_t* const stack_frame_bottom = ContinuationHelper::InterpretedFrame::frame_bottom(f);
>> 1053:   assert(stack_frame_bottom - stack_frame_top >= fsize, ""); // == on x86
> 
> Are there any ports where (stack_frame_bottom - stack_frame_top) != fsize?  It would be nice if we could use (stack_frame_bottom - stack_frame_top) for fsize and remove the platform-specific computation using frame::metadata_words above.

I think aarch64 and riscv are different from x86_64 here due to possible padding in the frame[1][2].
So if we modify this assertion like:

diff --git a/src/hotspot/share/runtime/continuationFreezeThaw.cpp b/src/hotspot/share/runtime/continuationFreezeThaw.cpp
index 2ef48618ccb..c8e88b67f94 100644
--- a/src/hotspot/share/runtime/continuationFreezeThaw.cpp
+++ b/src/hotspot/share/runtime/continuationFreezeThaw.cpp
@@ -1050,7 +1050,7 @@ NOINLINE freeze_result FreezeBase::recurse_freeze_interpreted_frame(frame& f, fr
   const int fsize = f.fp() + frame::metadata_words + locals - stack_frame_top;

   intptr_t* const stack_frame_bottom = ContinuationHelper::InterpretedFrame::frame_bottom(f);
-  assert(stack_frame_bottom - stack_frame_top >= fsize, ""); // == on x86
+  assert(stack_frame_bottom - stack_frame_top == fsize, ""); // == on x86

   DEBUG_ONLY(verify_frame_top(f, stack_frame_top));


Then we will trigger assertion failure on linux-aarch64 running a simple virtual thread demo:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/realfyang/openjdk-jdk/src/hotspot/share/runtime/continuationFreezeThaw.cpp
:1053), pid=2680946, tid=2680964
#  Error: assert(stack_frame_bottom - stack_frame_top == fsize) failed
#
# JRE version: OpenJDK Runtime Environment (20.0) (slowdebug build 20-internal-adhoc.realfyang.open
jdk-jdk)
# Java VM: OpenJDK 64-Bit Server VM (slowdebug 20-internal-adhoc.realfyang.openjdk-jdk, mixed mode,
 sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x865c98]  FreezeBase::recurse_freeze_interpreted_frame(frame&, frame&, int, bool)+
0xb8
#


[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/frame_aarch64.hpp#L62
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/frame_riscv.hpp#L62

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

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


More information about the hotspot-dev mailing list