RFR: 8272377: assert preconditions that are ensured when created in add_final_edges

Tobias Hartmann thartmann at openjdk.java.net
Thu Aug 19 06:19:22 UTC 2021


On Thu, 12 Aug 2021 15:07:19 GMT, Yi Yang <yyang at openjdk.org> wrote:

> I think we can assert preconditions, which are ensured by add_node_to_connection_graph when they were first added to CG, in add_final_edges when they are delay handled, then we can skip checking these preconditions in runtime(assertions instead). This PR also does some code refactor.

Nice refactoring. I verified that the conditions are indeed checked in `ConnectionGraph::add_node_to_connection_graph`.

I added some minor comments, looks good to me otherwise.

src/hotspot/share/opto/escape.cpp line 166:

> 164:     }
> 165:     // Collect some interesting nodes for futher use.
> 166:     switch(n->Opcode()) {

Missing whitespace after `switch`.

src/hotspot/share/opto/escape.cpp line 698:

> 696:       // ThreadLocal has RawPtr type.
> 697:       assert(_igvn->type(n)->make_ptr() != NULL,
> 698:              "constrain must match when firstly add to cg");

I would change the assert message to `Unexpected node type`. Same for other asserts below.

src/hotspot/share/opto/escape.cpp line 877:

> 875: #ifdef ASSERT
> 876:     n->dump(1);
> 877:     assert(false, "not unsafe");

Indentation is wrong.

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

Changes requested by thartmann (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/5101


More information about the hotspot-compiler-dev mailing list