Undo changes in allocation of PhaseIdealLoop internal structures

This commit is contained in:
Vladimir Ivanov 2026-03-26 14:53:30 -07:00
parent 371f4597f6
commit fd55ba22fd
2 changed files with 8 additions and 8 deletions

View File

@ -4344,7 +4344,7 @@ void IdealLoopTree::allpaths_check_safepts(VectorSet &visited, Node_List &stack)
// Terminate this path
} else if (n->Opcode() == Op_SafePoint) {
if (_phase->get_loop(n) != this) {
if (_required_safept == nullptr) _required_safept = new Node_List(_phase->arena());
if (_required_safept == nullptr) _required_safept = new Node_List();
// save the first we run into on that path: closest to the tail if the head has a single backedge
_required_safept->push(n);
}
@ -4490,7 +4490,7 @@ void IdealLoopTree::check_safepts(VectorSet &visited, Node_List &stack) {
// inner loop attempts to delete it's safepoints.
if (_child != nullptr && !has_call && !has_local_ncsfpt) {
if (nonlocal_ncsfpt != nullptr) {
if (_required_safept == nullptr) _required_safept = new Node_List(_phase->arena());
if (_required_safept == nullptr) _required_safept = new Node_List();
_required_safept->push(nonlocal_ncsfpt);
} else {
// Failed to find a suitable safept on the dom-path. Now use
@ -4838,11 +4838,10 @@ uint IdealLoopTree::est_loop_flow_merge_sz() const {
void IdealLoopTree::register_reachability_fence(ReachabilityFenceNode* rf) {
if (_reachability_fences == nullptr) {
_reachability_fences = new Node_List(_phase->arena());
}
if (!_reachability_fences->contains(rf)) {
_reachability_fences->push(rf);
_reachability_fences = new Node_List();
}
assert(!_reachability_fences->contains(rf), "already registered");
_reachability_fences->push(rf);
}
#ifndef PRODUCT
@ -5909,6 +5908,7 @@ bool IdealLoopTree::verify_tree(IdealLoopTree* loop_verify) const {
//------------------------------set_idom---------------------------------------
void PhaseIdealLoop::set_idom(Node* d, Node* n, uint dom_depth) {
_nesting.check(); // Check if a potential reallocation in the resource arena is safe
uint idx = d->_idx;
if (idx >= _idom_size) {
uint newsize = next_power_of_2(idx);
@ -6301,7 +6301,7 @@ int PhaseIdealLoop::build_loop_tree_impl(Node* n, int pre_order) {
innermost->_has_call = 1; // = true
} else if (n->Opcode() == Op_SafePoint) {
// Record all safepoints in this loop.
if (innermost->_safepts == nullptr) innermost->_safepts = new Node_List(&_arena);
if (innermost->_safepts == nullptr) innermost->_safepts = new Node_List();
innermost->_safepts->push(n);
} else if (n->is_ReachabilityFence()) {
innermost->register_reachability_fence(n->as_ReachabilityFence());

View File

@ -214,7 +214,7 @@ bool PhaseIdealLoop::optimize_reachability_fences() {
assert(OptimizeReachabilityFences, "required");
ResourceMark rm;
// ResourceMark rm; // NB! not safe because insert_rf may trigger _idom reallocation
Unique_Node_List redundant_rfs;
GrowableArray<Pair<Node*,Node*>> worklist;
for (int i = 0; i < C->reachability_fences_count(); i++) {