RFR: 8252583: Make PhiNode::is_copy() debug only [v2]

Tobias Hartmann thartmann at openjdk.java.net
Mon Sep 21 12:36:17 UTC 2020


On Mon, 21 Sep 2020 12:01:20 GMT, Roberto Castañeda Lozano <github.com+8792647+robcasloz at openjdk.org> wrote:

>> Convert `PhiNode::is_copy()` into an actual, debug-only predicate. Replace calls to `is_copy()` from non-debug code
>> with explicit assertions. Remove dead loop in debug-only `MergeMemStream::match_memory()`.
>
> Roberto Castañeda Lozano has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix spacing in touched lines

Changes requested by thartmann (Reviewer).

src/hotspot/share/opto/memnode.cpp line 4892:

> 4890:   if (mem == n)  return true;
> 4891:   if (n->is_Phi())
> 4892:     assert(!n->as_Phi()->is_copy(), "n cannot be a copy");

The if condition should be added to the assert:
`assert(!n->is_Phi() || !n->as_Phi()->is_copy() ...`

src/hotspot/share/opto/loopnode.cpp line 53:

> 51: bool Node::is_cloop_ind_var() const {
> 52: #ifdef ASSERT
> 53:   if (is_Phi()) assert(!as_Phi()->is_copy(), "this phi cannot be a copy");

The if condition should be added to the assert (the `#ifdef ASSERT` can then be removed):
`assert(!is_Phi() || !as_Phi()->is_copy() ...)`

src/hotspot/share/opto/addnode.cpp line 96:

> 94: #ifdef ASSERT
> 95:   if (in1->is_Phi())
> 96:     assert(!in1->as_Phi()->is_copy(), "in1 cannot be a copy");

The if condition should be added to the assert (the `#ifdef ASSERT` can then be removed):
`assert(!in1->is_Phi() || !in1->as_Phi()->is_copy() ...`

src/hotspot/share/opto/addnode.cpp line 102:

> 100: #ifdef ASSERT
> 101:   if (in2->is_Phi())
> 102:     assert(!in2->as_Phi()->is_copy(), "in2 cannot be a copy");

The if condition should be added to the assert.

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

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


More information about the hotspot-compiler-dev mailing list