RFR: 8289925: Shared code shouldn't reference the platform specific method frame::interpreter_frame_last_sp() [v2]

Richard Reingruber rrich at openjdk.org
Wed Jul 27 08:25:19 UTC 2022


On Mon, 18 Jul 2022 06:41:57 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

>> The method `frame::interpreter_frame_last_sp()` is a platform method in the sense that it is not declared in a shared header file. It is declared and defined on some platforms though (x86 and aarch64 I think).
>> 
>> `frame::interpreter_frame_last_sp()` existed on these platforms before vm continuations (aka loom). Shared code that is part of the vm continuations implementation references it. This breaks the platform abstraction.
>> 
>> This fix simply removes the special case for interpreted frames in the shared method `Continuation::continuation_bottom_sender()`. I cannot see a reason for the distinction between interpreted and compiled frames. The shared code reference to `frame::interpreter_frame_last_sp()` is thereby eliminated.
>> 
>> Testing: hotspot_loom and jdk_loom on x86_64 and aarch64.
>
> Richard Reingruber 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 two additional commits since the last revision:
> 
>  - Merge branch 'master'
>  - Remove platform dependent method interpreter_frame_last_sp() from shared code

Hi Dean,

thanks for looking at the PR.

> Are you sure unextended_sp() returns the same thing as
> interpreter_frame_last_sp() on all platforms? I didn't think that was true for
> aarch64.

I'm no sure. The question is difficult to answer because it is a platform detail.

It is even hard to make assumptions about the unextended_sp that are true for
all platforms[1].

This was a major issue in the loom port to ppc. Shared code expects to find call
parameters at the caller's unextended_sp which is not the case on ppc.

IMHO uses of unextended_sp in shared code should be replaced with abstractions
as SharedRuntime::out_preserve_stack_slots().

> Maybe what we need is a new shared API that will return what the
> continuation code expects, or promote interpreter_frame_last_sp() to be
> shared. It seems that all platforms implement it. @theRealAph @pron

I'd think any address within the frame is good for calling
Continuation::get_continuation_entry_for_sp().

Thanks, Richard.

[1] On ppc unextended_sp < sp is possible.
    See https://github.com/reinrich/loom/blob/4b79c83284f18dd7193ecfe12e97e07674d34405/src/hotspot/cpu/ppc/continuationFreezeThaw_ppc.inline.hpp#L570-L639

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

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


More information about the hotspot-compiler-dev mailing list