RFR: 8291972: Fix double copy of arguments when thawing two interpreted frames
Robbin Ehn
rehn at openjdk.org
Fri Aug 12 06:25:10 UTC 2022
On Fri, 5 Aug 2022 14:41:56 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:
> When thawing two consecutive interpreted frames the current code makes room in the stack and copies the callee arguments twice, once in the caller and once in the callee. This duplication could use more stack space than the calculation made in prepare_thaw() for the maximum stack space that will be needed during thaw. If that's the case then we will hit an assert that we are writing pass the allowed limit.
> Today we don't see this issue though because the only case where we could thaw two interpreter frames is the first time after a freeze. The thawed frames are always Continuation.yield and Continuation.yield0 and the extra used space is only 3 words(yield0's three arguments) which will never exceed the calculation made in prepare_thaw().
> The issue can be made visible when changing the number of frames we thaw when hitting a return barrier from 1 to 2 and running test Continuation/Basic.java.
>
> This patch fixes this by adjusting the calculated size of the callee frame in new_stack_frame() so that we use the space for the arguments already allocated by the caller.
>
> Tested the patch by changing the number of thaw frames from 1 to 2 and running all tests in jdk/internal/vm/Continuation/ and jdk/java/lang/Thread/virtual. Also run tiers1-3 in mach5 and loom-tiers1-4.
>
> Thanks,
> Patricio
Thank you!
-------------
Marked as reviewed by rehn (Reviewer).
PR: https://git.openjdk.org/jdk/pull/9774
More information about the hotspot-dev
mailing list