RFR: 8271202: C1: assert(false) failed: live_in set of first block must be empty
Martin Doerr
mdoerr at openjdk.java.net
Thu Oct 7 08:51:09 UTC 2021
On Wed, 28 Jul 2021 06:57:26 GMT, Yi Yang <yyang at openjdk.org> wrote:
> Hi, I'm trying to fix [JDK-8271202](https://bugs.openjdk.java.net/browse/JDK-8271202). A local variable(smallinvoc) is defined in B3 and only used in B14, so it oughts to have a short lifetime. But its lifetime has been unconditionally extended since -XX:+DeoptimizeALot(**Just removing this may be also a simpler and safer fix? Not sure if it's acceptable**), making it propagate to almost the whole remaing IR.
>
> https://github.com/openjdk/jdk/blob/ecd445562f8355704a041f9eca0e87dc85a7f44c/src/hotspot/share/ci/ciMethod.cpp#L373-L379
>
> ![image](https://user-images.githubusercontent.com/5010047/127277954-2a64d87e-2981-4d74-8001-c7efeb000a10.png)
>
>
> A virtual register(v603) that represents this variable is located in B13 live_in set, which propagated to B1 live_out set.
>
> When B1 merges state with B16 and B19, it found that this variable in new_state(B16) was empty, so B1 invalidates the corresponding local slot.
>
> https://github.com/openjdk/jdk/blob/ecd445562f8355704a041f9eca0e87dc85a7f44c/src/hotspot/share/c1/c1_Instruction.cpp#L826-L838
>
> I think we should invalidate this slot only when their types are mismatched. Otherwise, Phi will not be generated, B19 live_gen set will not contain this variable, because of which this variable is alive in B1 live_in. B1 live_in will eventually backward propagate to B20 live_in set, it avoids being killed by B19 live_gen, which causes the crash.
>
>
> Block 1
> live_in:
> 603 616 617 618 619 620 621 622
> live_out:
> 603 616 617 618 619 620 621 622
> live_gen:
> 620
> live_kill:
> 648 649 650
>
> Block 16
> live_in:
> 603 616 617 618 619 620 621 622
> live_out:
> 603 616 617 618 619 620 621 622
> live_gen:
> 616 617 618 619 620 621 622
> live_kill:
> 620 654 655 656 657
>
> Block 19
> live_in:
> 603
> live_out:
> 603 616 617 618 619 620 621 622
> live_gen:
>
> live_kill:
> 0 1 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647
>
>
> Block 20
> live_in:
> 603
> live_out:
> 603
> live_gen:
>
> live_kill:
> 577 578
Thanks for your investigation. Unfortunately, the proposed fix is not correct:
# Internal Error (jdk-dev/src/hotspot/share/c1/c1_GraphBuilder.cpp:2551), pid=10122, tid=10177
# assert(opd != __null) failed: Operand must exist!
Found by compiler/c1/ExtendLocalVarLifetime.java on PPC64le.
I think the JVM doesn't have a real problem in product build. C1 bails out instead of asserting which is fine. Can we bail out in debug build as well or adapt the assertion?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4916
More information about the hotspot-compiler-dev
mailing list