[jdk16] Integrated: 8259276: C2: Empty expression stack when reexecuting tableswitch/lookupswitch instructions after deoptimization
Vladimir Ivanov
vlivanov at openjdk.java.net
Mon Jan 25 20:51:49 UTC 2021
On Fri, 22 Jan 2021 21:59:29 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
> During parsing of `lookupswitch` and `tableswitch` instructions C2 may insert a safepoint. Corresponding JVM state has always re-execute bit set since the interpreter will unconditionally re-execute the instruction after deoptimization is over (see `AbstractInterpreter::bytecode_should_reexecute` for the full list of instructions).
>
> But `Parse::do_tableswitch()`/`Parse::do_lookupswitch()` attach wrong JVM state: it describes the state **after** the instruction since the first thing they do is they pop the operand from the expression stack. Instead, the JVM state **before** the instruction should be used to respect the re-execution in the interpreter.
>
> The bug manifests as a stack corruption after deoptimization at a broken safepoint.
>
> The fix is to keep the initial JVM state (before the instruction) intact until all the safepoints at the particular instruction are inserted.
>
> Testing:
> - [ ] hs-tier1 - hs-tier7 (in progress)
> - [ ] Kitchensink24h w/ -XX:+DeoptimizeALot (in progress)
This pull request has now been integrated.
Changeset: 81e730e5
Author: Vladimir Ivanov <vlivanov at openjdk.org>
URL: https://git.openjdk.java.net/jdk16/commit/81e730e5
Stats: 20 lines in 2 files changed: 13 ins; 3 del; 4 mod
8259276: C2: Empty expression stack when reexecuting tableswitch/lookupswitch instructions after deoptimization
Reviewed-by: dlong, kvn, thartmann
-------------
PR: https://git.openjdk.java.net/jdk16/pull/130
More information about the hotspot-compiler-dev
mailing list