[lworld] RFR: 8378167: [lworld] C2: "unused buffer allocation" in do_late_inline_helper [v2]

Tobias Hartmann thartmann at openjdk.org
Fri Feb 27 10:20:44 UTC 2026


On Fri, 27 Feb 2026 10:14:01 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> When handling a scalarized return from an inlined method handle call in C2, we assert that we always make use of the buffer that we pre-allocated before the call. The assert is too strong because we could stop parsing in the callee due to an uncommon trap. I added a corresponding test that triggers this because we trap in the callee due to always throwing an exception.
>> 
>> Thanks,
>> Tobias
>
> Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:
> 
>   V2

Thanks for your review @merykitty! You are right, the test does not really belong to value construction. I moved it to the calling convention test. A normal method and `AlwaysIncrementalInline` is not enough. In this case we wouldn't need a buffer because the caller knows that the callee returns scalarized.

The special logic with the buffer pre-allocation is only needed for method handle inlines, where we "double-inline" through the `linkTo*` methods. In this case, the caller just sees a call with a non-scalarized return (`!call->tf()->returns_inline_type_as_fields()`) during parsing and adds no handling for a scalarized return. But later, with method handle incremental inlining, the actual return type of the method is a value type that might be scalarized.

I added a corresponding assert to the code.

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

PR Comment: https://git.openjdk.org/valhalla/pull/2177#issuecomment-3972010768


More information about the valhalla-dev mailing list