From fd55ba22fd0772ecbde98fef120f7a71562c4bb4 Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Thu, 26 Mar 2026 14:53:30 -0700 Subject: [PATCH] Undo changes in allocation of PhaseIdealLoop internal structures --- src/hotspot/share/opto/loopnode.cpp | 14 +++++++------- src/hotspot/share/opto/reachability.cpp | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index 6b521d0e63e..0ddaed31518 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -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()); diff --git a/src/hotspot/share/opto/reachability.cpp b/src/hotspot/share/opto/reachability.cpp index 175a4be5bed..cee3f337d23 100644 --- a/src/hotspot/share/opto/reachability.cpp +++ b/src/hotspot/share/opto/reachability.cpp @@ -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> worklist; for (int i = 0; i < C->reachability_fences_count(); i++) {