< prev index next >
src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp
Print this page
rev 56071 : 8230091: Add verification of clean_catch_blocks
Reviewed-by:
*** 1215,1235 ****
// Now we should be home
phase->igvn().set_delay_transform(false);
}
// Sort out the loads that are between a call ant its catch blocks
! static void process_catch_cleanup_candidate(PhaseIdealLoop* phase, LoadNode* load) {
bool trace = phase->C->directive()->ZTraceLoadBarriersOption;
Node* ctrl = get_ctrl_normalized(phase, load);
if (!ctrl->is_Proj() || (ctrl->in(0) == NULL) || !ctrl->in(0)->isa_Call()) {
return;
}
Node* catch_node = ctrl->isa_Proj()->raw_out(0);
if (catch_node->is_Catch()) {
if (catch_node->outcnt() > 1) {
call_catch_cleanup_one(phase, load, ctrl);
} else {
if (trace) tty->print_cr("Call catch cleanup with only one catch: load %i ", load->_idx);
}
}
--- 1215,1236 ----
// Now we should be home
phase->igvn().set_delay_transform(false);
}
// Sort out the loads that are between a call ant its catch blocks
! static void process_catch_cleanup_candidate(PhaseIdealLoop* phase, LoadNode* load, bool verify) {
bool trace = phase->C->directive()->ZTraceLoadBarriersOption;
Node* ctrl = get_ctrl_normalized(phase, load);
if (!ctrl->is_Proj() || (ctrl->in(0) == NULL) || !ctrl->in(0)->isa_Call()) {
return;
}
Node* catch_node = ctrl->isa_Proj()->raw_out(0);
if (catch_node->is_Catch()) {
if (catch_node->outcnt() > 1) {
+ assert(!verify, "All loads should already have been moved");
call_catch_cleanup_one(phase, load, ctrl);
} else {
if (trace) tty->print_cr("Call catch cleanup with only one catch: load %i ", load->_idx);
}
}
*** 1243,1252 ****
--- 1244,1254 ----
bool ZBarrierSetC2::optimize_loops(PhaseIdealLoop* phase, LoopOptsMode mode, VectorSet& visited, Node_Stack& nstack, Node_List& worklist) const {
if (mode == LoopOptsZBarrierInsertion) {
// First make sure all loads between call and catch are moved to the catch block
clean_catch_blocks(phase);
+ DEBUG_ONLY(clean_catch_blocks(phase, true /* verify */);)
// Then expand barriers on all loads
insert_load_barriers(phase);
// Handle all Unsafe that need barriers.
*** 1396,1406 ****
// before any store.
//
// Sometimes the loads use will be at a place dominated by all catch blocks, then we need
// a load in each catch block, and a Phi at the dominated use.
! void ZBarrierSetC2::clean_catch_blocks(PhaseIdealLoop* phase) const {
Compile *C = phase->C;
uint new_ids = C->unique();
PhaseIterGVN &igvn = phase->igvn();
VectorSet visited(Thread::current()->resource_area());
--- 1398,1408 ----
// before any store.
//
// Sometimes the loads use will be at a place dominated by all catch blocks, then we need
// a load in each catch block, and a Phi at the dominated use.
! void ZBarrierSetC2::clean_catch_blocks(PhaseIdealLoop* phase, bool verify) const {
Compile *C = phase->C;
uint new_ids = C->unique();
PhaseIterGVN &igvn = phase->igvn();
VectorSet visited(Thread::current()->resource_area());
*** 1423,1433 ****
bool is_old_node = (n->_idx < new_ids); // don't process nodes that were created during cleanup
if (n->is_Load() && is_old_node) {
LoadNode* load = n->isa_Load();
// only care about loads that will have a barrier
if (load_require_barrier(load)) {
! process_catch_cleanup_candidate(phase, load);
}
}
}
C->print_method(PHASE_CALL_CATCH_CLEANUP, 2);
--- 1425,1435 ----
bool is_old_node = (n->_idx < new_ids); // don't process nodes that were created during cleanup
if (n->is_Load() && is_old_node) {
LoadNode* load = n->isa_Load();
// only care about loads that will have a barrier
if (load_require_barrier(load)) {
! process_catch_cleanup_candidate(phase, load, verify);
}
}
}
C->print_method(PHASE_CALL_CATCH_CLEANUP, 2);
< prev index next >