Mercurial > hg > truffle
comparison src/share/vm/c1/c1_GraphBuilder.cpp @ 4943:80107dc493db
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: never, iveresov
author | roland |
---|---|
date | Wed, 15 Feb 2012 09:43:16 +0100 |
parents | f067b4e0e04b |
children | 701a83c86f28 4fabc16dc5bf |
comparison
equal
deleted
inserted
replaced
4942:8f4eb44b3b76 | 4943:80107dc493db |
---|---|
1179 BlockBegin* tsux = block_at(stream()->get_dest()); | 1179 BlockBegin* tsux = block_at(stream()->get_dest()); |
1180 BlockBegin* fsux = block_at(stream()->next_bci()); | 1180 BlockBegin* fsux = block_at(stream()->next_bci()); |
1181 bool is_bb = tsux->bci() < stream()->cur_bci() || fsux->bci() < stream()->cur_bci(); | 1181 bool is_bb = tsux->bci() < stream()->cur_bci() || fsux->bci() < stream()->cur_bci(); |
1182 Instruction *i = append(new If(x, cond, false, y, tsux, fsux, is_bb ? state_before : NULL, is_bb)); | 1182 Instruction *i = append(new If(x, cond, false, y, tsux, fsux, is_bb ? state_before : NULL, is_bb)); |
1183 | 1183 |
1184 assert(i->as_Goto() == NULL || | |
1185 (i->as_Goto()->sux_at(0) == tsux && i->as_Goto()->is_safepoint() == tsux->bci() < stream()->cur_bci()) || | |
1186 (i->as_Goto()->sux_at(0) == fsux && i->as_Goto()->is_safepoint() == fsux->bci() < stream()->cur_bci()), | |
1187 "safepoint state of Goto returned by canonicalizer incorrect"); | |
1188 | |
1184 if (is_profiling()) { | 1189 if (is_profiling()) { |
1185 If* if_node = i->as_If(); | 1190 If* if_node = i->as_If(); |
1186 if (if_node != NULL) { | 1191 if (if_node != NULL) { |
1187 // Note that we'd collect profile data in this method if we wanted it. | 1192 // Note that we'd collect profile data in this method if we wanted it. |
1188 compilation()->set_would_profile(true); | 1193 compilation()->set_would_profile(true); |
1301 if (sw.dest_offset_at(i) < 0) has_bb = true; | 1306 if (sw.dest_offset_at(i) < 0) has_bb = true; |
1302 } | 1307 } |
1303 // add default successor | 1308 // add default successor |
1304 sux->at_put(i, block_at(bci() + sw.default_offset())); | 1309 sux->at_put(i, block_at(bci() + sw.default_offset())); |
1305 ValueStack* state_before = has_bb ? copy_state_before() : NULL; | 1310 ValueStack* state_before = has_bb ? copy_state_before() : NULL; |
1306 append(new TableSwitch(ipop(), sux, sw.low_key(), state_before, has_bb)); | 1311 Instruction* res = append(new TableSwitch(ipop(), sux, sw.low_key(), state_before, has_bb)); |
1312 #ifdef ASSERT | |
1313 if (res->as_Goto()) { | |
1314 for (i = 0; i < l; i++) { | |
1315 if (sux->at(i) == res->as_Goto()->sux_at(0)) { | |
1316 assert(res->as_Goto()->is_safepoint() == sw.dest_offset_at(i) < 0, "safepoint state of Goto returned by canonicalizer incorrect"); | |
1317 } | |
1318 } | |
1319 } | |
1320 #endif | |
1307 } | 1321 } |
1308 } | 1322 } |
1309 | 1323 |
1310 | 1324 |
1311 void GraphBuilder::lookup_switch() { | 1325 void GraphBuilder::lookup_switch() { |
1336 keys->at_put(i, pair.match()); | 1350 keys->at_put(i, pair.match()); |
1337 } | 1351 } |
1338 // add default successor | 1352 // add default successor |
1339 sux->at_put(i, block_at(bci() + sw.default_offset())); | 1353 sux->at_put(i, block_at(bci() + sw.default_offset())); |
1340 ValueStack* state_before = has_bb ? copy_state_before() : NULL; | 1354 ValueStack* state_before = has_bb ? copy_state_before() : NULL; |
1341 append(new LookupSwitch(ipop(), sux, keys, state_before, has_bb)); | 1355 Instruction* res = append(new LookupSwitch(ipop(), sux, keys, state_before, has_bb)); |
1356 #ifdef ASSERT | |
1357 if (res->as_Goto()) { | |
1358 for (i = 0; i < l; i++) { | |
1359 if (sux->at(i) == res->as_Goto()->sux_at(0)) { | |
1360 assert(res->as_Goto()->is_safepoint() == sw.pair_at(i).offset() < 0, "safepoint state of Goto returned by canonicalizer incorrect"); | |
1361 } | |
1362 } | |
1363 } | |
1364 #endif | |
1342 } | 1365 } |
1343 } | 1366 } |
1344 | 1367 |
1345 void GraphBuilder::call_register_finalizer() { | 1368 void GraphBuilder::call_register_finalizer() { |
1346 // If the receiver requires finalization then emit code to perform | 1369 // If the receiver requires finalization then emit code to perform |