RFR: 8257498: Remove useless skeleton predicates [v2]

Roland Westrelin roland at openjdk.java.net
Tue Jan 19 08:26:52 UTC 2021


On Mon, 18 Jan 2021 09:41:10 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> This enhancement removes useless skeleton predicates in the same way as we already remove normal useless predicates in `PhaseIdealLoop::eliminate_useless_predicates()`.
>> 
>> Thanks,
>> Christian
>
> Christian Hagedorn has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add handling of Deoptimization::Reason_profile_predicate

Changes requested by roland (Reviewer).

src/hotspot/share/opto/loopPredicate.cpp line 280:

> 278: // Put all skeleton predicate projections on a list, starting at 'predicate' and going up in the tree. If 'get_opaque'
> 279: // is set, then the Opaque4 nodes of the skeleton predicates are put on the list instead of the projections.
> 280: void PhaseIdealLoop::get_skeleton_predicates(Node* predicate, Unique_Node_List& list, bool get_opaque) {

I would remove the get_opaque parameter, populate the list with projections (the get_opaque false case) and have the caller retrieve the opaque node (predicate->in(0)->in(1)) if that's what it needs.

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

> 3599:     assert(n->Opcode() == Op_Opaque4, "must be");
> 3600:     if (!useful_predicates.member(n)) { // not in the useful list
> 3601:       C->remove_skeleton_predicate_opaque4_node(idx);

Usually when nodes are kept in a global list, when a node dies, the node is removed from the list. It's the case of Compile::_predicate_opaqs for instance. So when the logic here iterates over _predicate_opaqs and removes some of them from the graph, the node is automatically removed from the _predicate_opaqs list. I don't see similar logic for skeleton Opaque4 nodes. I think it's a problem because you could end up with a node in the list that was removed from the graph (because that part of the graph is dead) and freed from memory (which could cause a crash).

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

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


More information about the hotspot-compiler-dev mailing list