1.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp Tue Feb 14 15:43:56 2012 -0800 1.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp Wed Feb 15 09:43:16 2012 +0100 1.3 @@ -1181,6 +1181,11 @@ 1.4 bool is_bb = tsux->bci() < stream()->cur_bci() || fsux->bci() < stream()->cur_bci(); 1.5 Instruction *i = append(new If(x, cond, false, y, tsux, fsux, is_bb ? state_before : NULL, is_bb)); 1.6 1.7 + assert(i->as_Goto() == NULL || 1.8 + (i->as_Goto()->sux_at(0) == tsux && i->as_Goto()->is_safepoint() == tsux->bci() < stream()->cur_bci()) || 1.9 + (i->as_Goto()->sux_at(0) == fsux && i->as_Goto()->is_safepoint() == fsux->bci() < stream()->cur_bci()), 1.10 + "safepoint state of Goto returned by canonicalizer incorrect"); 1.11 + 1.12 if (is_profiling()) { 1.13 If* if_node = i->as_If(); 1.14 if (if_node != NULL) { 1.15 @@ -1303,7 +1308,16 @@ 1.16 // add default successor 1.17 sux->at_put(i, block_at(bci() + sw.default_offset())); 1.18 ValueStack* state_before = has_bb ? copy_state_before() : NULL; 1.19 - append(new TableSwitch(ipop(), sux, sw.low_key(), state_before, has_bb)); 1.20 + Instruction* res = append(new TableSwitch(ipop(), sux, sw.low_key(), state_before, has_bb)); 1.21 +#ifdef ASSERT 1.22 + if (res->as_Goto()) { 1.23 + for (i = 0; i < l; i++) { 1.24 + if (sux->at(i) == res->as_Goto()->sux_at(0)) { 1.25 + assert(res->as_Goto()->is_safepoint() == sw.dest_offset_at(i) < 0, "safepoint state of Goto returned by canonicalizer incorrect"); 1.26 + } 1.27 + } 1.28 + } 1.29 +#endif 1.30 } 1.31 } 1.32 1.33 @@ -1338,7 +1352,16 @@ 1.34 // add default successor 1.35 sux->at_put(i, block_at(bci() + sw.default_offset())); 1.36 ValueStack* state_before = has_bb ? copy_state_before() : NULL; 1.37 - append(new LookupSwitch(ipop(), sux, keys, state_before, has_bb)); 1.38 + Instruction* res = append(new LookupSwitch(ipop(), sux, keys, state_before, has_bb)); 1.39 +#ifdef ASSERT 1.40 + if (res->as_Goto()) { 1.41 + for (i = 0; i < l; i++) { 1.42 + if (sux->at(i) == res->as_Goto()->sux_at(0)) { 1.43 + assert(res->as_Goto()->is_safepoint() == sw.pair_at(i).offset() < 0, "safepoint state of Goto returned by canonicalizer incorrect"); 1.44 + } 1.45 + } 1.46 + } 1.47 +#endif 1.48 } 1.49 } 1.50