RFR: 8286301: Port JEP 425 to RISC-V [v3]
Dean Long
dlong at openjdk.org
Thu Nov 3 21:30:30 UTC 2022
On Thu, 3 Nov 2022 03:18:57 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> 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
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.
-------------
PR: https://git.openjdk.org/jdk/pull/10917
More information about the hotspot-dev
mailing list