RFR: 8257498: Remove useless skeleton predicates [v2]

Christian Hagedorn chagedorn at openjdk.java.net
Wed Jan 20 12:16:56 UTC 2021


On Tue, 19 Jan 2021 08:19:00 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> Christian Hagedorn has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add handling of Deoptimization::Reason_profile_predicate
>
> 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.

Okay, I updated it and removed the `get_opaque` flag.

> 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).

That's true. I have not considered that. I updated it to remove it in the same way as we are removing other nodes as for example expensive nodes.

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

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


More information about the hotspot-compiler-dev mailing list