Integrated: 8287432: C2: assert(tn->in(0) != __null) failed: must have live top node
Christian Hagedorn
chagedorn at openjdk.java.net
Wed Jun 8 14:15:58 UTC 2022
On Tue, 7 Jun 2022 12:16:00 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
> When intrisifying `java.lang.Thread::currentThread()`, we are creating an `AddP` node that has the `top` node as base to indicate that we do not have an oop (using `NULL` instead leads to crashes as it does not seem to be expected to have a `NULL` base):
> https://github.com/openjdk/jdk/blob/6ff2d89ea11934bb13c8a419e7bad4fd40f76759/src/hotspot/share/opto/library_call.cpp#L904
>
> This node is used on a chain of data nodes into two `MemBarAcquire` nodes as precedence edge in the test case:
> 
>
> Later, in `final_graph_reshaping_impl()`, we are removing the precedence edge of both `MemBarAcquire` nodes and clean up all now dead nodes as a result of the removal:
> https://github.com/openjdk/jdk/blob/6ff2d89ea11934bb13c8a419e7bad4fd40f76759/src/hotspot/share/opto/compile.cpp#L3655-L3679
>
> We iteratively call `disconnect_inputs()` for all nodes that have no output anymore (i.e. dead nodes). This code, however, also treats the `top` node as dead since `outcnt()` of `top` is always zero:
> https://github.com/openjdk/jdk/blob/6ff2d89ea11934bb13c8a419e7bad4fd40f76759/src/hotspot/share/opto/node.hpp#L495-L500
>
> And we end up disconnecting `top` which results in the assertion failure.
>
> The code misses a check for `top()`. I suggest to add this check before processing a node for which `outcnt()` is zero. This is a pattern which can also be found in other places in the code. I've checked all other usages of `oucnt() == 0` and could not find a case where this additional `top()` check is missing. Maybe we should refactor these two checks into a single method at some point to not need to worry about `top` anymore in the future when checking if a node is dead based on the outputs.
>
> Thanks,
> Christian
This pull request has now been integrated.
Changeset: 78d37126
Author: Christian Hagedorn <chagedorn at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/78d371266ae8a629db8176ced4d48e9521702cce
Stats: 56 lines in 2 files changed: 55 ins; 0 del; 1 mod
8287432: C2: assert(tn->in(0) != __null) failed: must have live top node
Reviewed-by: kvn, thartmann
-------------
PR: https://git.openjdk.java.net/jdk/pull/9060
More information about the hotspot-compiler-dev
mailing list