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

Fei Yang fyang at openjdk.org
Fri Nov 4 05:23:27 UTC 2022


On Thu, 3 Nov 2022 21:26:52 GMT, Dean Long <dlong at openjdk.org> wrote:

>> 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
>
> OK, skipping the assert for now.  Regarding `NOT_RISCV64(+ frame::metadata_words)` @reinrich just posted the PR for the PPC64 port (see JDK-8286302), which introduces metadata_words_at_top/metadata_words_at_bottom.  I'm not sure what values RISC-V would use for these new constants, but merging with the PPC64 changes might allow a platform-independent setting of fsize here.

Hi, I went through the PPC64 changes to shared code and I think for RISC-V we should define metadata_words_at_top and metadata_words_at_bottom to 0 and 2 (which equals metadata_words as defined by this PR) respectively. The PPC64 changes will help eliminate the RISC-V-specific change made in stackChunkOopDesc::is_usable_in_chunk in file src/hotspot/share/oops/stackChunkOop.inline.hpp. But we might still need a RISC-V platform-dependent change here due to the particularity of the RISC-V frame structure. Thanks.

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

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


More information about the hotspot-dev mailing list