Skip to content

Commit 336b64a

Browse files
author
Nils Eliasson
committed
8230091: Add verification of clean_catch_blocks
Reviewed-by: rbackman, kvn
1 parent 855f16e commit 336b64a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ static void call_catch_cleanup_one(PhaseIdealLoop* phase, LoadNode* load, Node*
12171217
}
12181218

12191219
// Sort out the loads that are between a call ant its catch blocks
1220-
static void process_catch_cleanup_candidate(PhaseIdealLoop* phase, LoadNode* load) {
1220+
static void process_catch_cleanup_candidate(PhaseIdealLoop* phase, LoadNode* load, bool verify) {
12211221
bool trace = phase->C->directive()->ZTraceLoadBarriersOption;
12221222

12231223
Node* ctrl = get_ctrl_normalized(phase, load);
@@ -1228,6 +1228,7 @@ static void process_catch_cleanup_candidate(PhaseIdealLoop* phase, LoadNode* loa
12281228
Node* catch_node = ctrl->isa_Proj()->raw_out(0);
12291229
if (catch_node->is_Catch()) {
12301230
if (catch_node->outcnt() > 1) {
1231+
assert(!verify, "All loads should already have been moved");
12311232
call_catch_cleanup_one(phase, load, ctrl);
12321233
} else {
12331234
if (trace) tty->print_cr("Call catch cleanup with only one catch: load %i ", load->_idx);
@@ -1245,6 +1246,7 @@ bool ZBarrierSetC2::optimize_loops(PhaseIdealLoop* phase, LoopOptsMode mode, Vec
12451246
if (mode == LoopOptsZBarrierInsertion) {
12461247
// First make sure all loads between call and catch are moved to the catch block
12471248
clean_catch_blocks(phase);
1249+
DEBUG_ONLY(clean_catch_blocks(phase, true /* verify */);)
12481250

12491251
// Then expand barriers on all loads
12501252
insert_load_barriers(phase);
@@ -1398,7 +1400,7 @@ void ZBarrierSetC2::insert_barriers_on_unsafe(PhaseIdealLoop* phase) const {
13981400
// Sometimes the loads use will be at a place dominated by all catch blocks, then we need
13991401
// a load in each catch block, and a Phi at the dominated use.
14001402

1401-
void ZBarrierSetC2::clean_catch_blocks(PhaseIdealLoop* phase) const {
1403+
void ZBarrierSetC2::clean_catch_blocks(PhaseIdealLoop* phase, bool verify) const {
14021404

14031405
Compile *C = phase->C;
14041406
uint new_ids = C->unique();
@@ -1425,7 +1427,7 @@ void ZBarrierSetC2::clean_catch_blocks(PhaseIdealLoop* phase) const {
14251427
LoadNode* load = n->isa_Load();
14261428
// only care about loads that will have a barrier
14271429
if (load_require_barrier(load)) {
1428-
process_catch_cleanup_candidate(phase, load);
1430+
process_catch_cleanup_candidate(phase, load, verify);
14291431
}
14301432
}
14311433
}

src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class ZBarrierSetC2 : public BarrierSetC2 {
207207
private:
208208
// Load barrier insertion and expansion internal
209209
void insert_barriers_on_unsafe(PhaseIdealLoop* phase) const;
210-
void clean_catch_blocks(PhaseIdealLoop* phase) const;
210+
void clean_catch_blocks(PhaseIdealLoop* phase, bool verify = false) const;
211211
void insert_load_barriers(PhaseIdealLoop* phase) const;
212212
LoadNode* insert_one_loadbarrier(PhaseIdealLoop* phase, LoadNode* load, Node* ctrl) const;
213213
void insert_one_loadbarrier_inner(PhaseIdealLoop* phase, LoadNode* load, Node* ctrl, VectorSet visited) const;

0 commit comments

Comments
 (0)