src/share/vm/c1/c1_GraphBuilder.cpp

Print this page
rev 3083 : 7126041: jdk7u4 b05 and b06 crash with RubyMine 3.2.4, works well with b04
Summary: Goto that replaces a If mistaken to be a back branch and triggers erroneous OSR compilation.
Reviewed-by:

*** 1179,1188 **** --- 1179,1193 ---- BlockBegin* tsux = block_at(stream()->get_dest()); BlockBegin* fsux = block_at(stream()->next_bci()); bool is_bb = tsux->bci() < stream()->cur_bci() || fsux->bci() < stream()->cur_bci(); Instruction *i = append(new If(x, cond, false, y, tsux, fsux, is_bb ? state_before : NULL, is_bb)); + assert(i->as_Goto() == NULL || + (i->as_Goto()->sux_at(0) == tsux && i->as_Goto()->is_safepoint() == tsux->bci() < stream()->cur_bci()) || + (i->as_Goto()->sux_at(0) == fsux && i->as_Goto()->is_safepoint() == fsux->bci() < stream()->cur_bci()), + "safepoint state of Goto returned by canonicalizer incorrect"); + if (is_profiling()) { If* if_node = i->as_If(); if (if_node != NULL) { // Note that we'd collect profile data in this method if we wanted it. compilation()->set_would_profile(true);
*** 1301,1311 **** if (sw.dest_offset_at(i) < 0) has_bb = true; } // add default successor sux->at_put(i, block_at(bci() + sw.default_offset())); ValueStack* state_before = has_bb ? copy_state_before() : NULL; ! append(new TableSwitch(ipop(), sux, sw.low_key(), state_before, has_bb)); } } void GraphBuilder::lookup_switch() { --- 1306,1325 ---- if (sw.dest_offset_at(i) < 0) has_bb = true; } // add default successor sux->at_put(i, block_at(bci() + sw.default_offset())); ValueStack* state_before = has_bb ? copy_state_before() : NULL; ! Instruction* res = append(new TableSwitch(ipop(), sux, sw.low_key(), state_before, has_bb)); ! #ifdef ASSERT ! if (res->as_Goto()) { ! for (i = 0; i < l; i++) { ! if (sux->at(i) == res->as_Goto()->sux_at(0)) { ! assert(res->as_Goto()->is_safepoint() == sw.dest_offset_at(i) < 0, "safepoint state of Goto returned by canonicalizer incorrect"); ! } ! } ! } ! #endif } } void GraphBuilder::lookup_switch() {
*** 1336,1346 **** keys->at_put(i, pair.match()); } // add default successor sux->at_put(i, block_at(bci() + sw.default_offset())); ValueStack* state_before = has_bb ? copy_state_before() : NULL; ! append(new LookupSwitch(ipop(), sux, keys, state_before, has_bb)); } } void GraphBuilder::call_register_finalizer() { // If the receiver requires finalization then emit code to perform --- 1350,1369 ---- keys->at_put(i, pair.match()); } // add default successor sux->at_put(i, block_at(bci() + sw.default_offset())); ValueStack* state_before = has_bb ? copy_state_before() : NULL; ! Instruction* res = append(new LookupSwitch(ipop(), sux, keys, state_before, has_bb)); ! #ifdef ASSERT ! if (res->as_Goto()) { ! for (i = 0; i < l; i++) { ! if (sux->at(i) == res->as_Goto()->sux_at(0)) { ! assert(res->as_Goto()->is_safepoint() == sw.pair_at(i).offset() < 0, "safepoint state of Goto returned by canonicalizer incorrect"); ! } ! } ! } ! #endif } } void GraphBuilder::call_register_finalizer() { // If the receiver requires finalization then emit code to perform