216 Node* m = node->in(i);
217 if (m == nullptr) continue;
218 assert(is_CFG(m), "must be a CFG node");
219 node->rm_prec(i);
220 if (n == nullptr) {
221 n = m;
222 } else {
223 assert(is_dominator(n, m) || is_dominator(m, n), "one must dominate the other");
224 n = is_dominator(n, m) ? m : n;
225 }
226 }
227 if (n != nullptr) {
228 assert(node->in(0), "control should have been set");
229 assert(is_dominator(n, node->in(0)) || is_dominator(node->in(0), n), "one must dominate the other");
230 if (!is_dominator(n, node->in(0))) {
231 node->set_req(0, n);
232 }
233 }
234
235 // process all inputs that are non null
236 for (int i = node->req()-1; i >= 0; --i) {
237 if (node->in(i) != nullptr) {
238 spstack.push(node->in(i));
239 }
240 }
241 }
242 }
243 }
244
245 // Assert that new input b2 is dominated by all previous inputs.
246 // Check this by by seeing that it is dominated by b1, the deepest
247 // input observed until b2.
248 static void assert_dom(Block* b1, Block* b2, Node* n, const PhaseCFG* cfg) {
249 if (b1 == nullptr) return;
250 assert(b1->_dom_depth < b2->_dom_depth, "sanity");
251 Block* tmp = b2;
252 while (tmp != b1 && tmp != nullptr) {
253 tmp = tmp->_idom;
254 }
255 if (tmp != b1) {
256 #ifdef ASSERT
1430
1431 #ifdef ASSERT
1432 // Assert that memory writers (e.g. stores) have a "home" block (the block
1433 // given by their control input), and that this block corresponds to their
1434 // earliest possible placement. This guarantees that
1435 // hoist_to_cheaper_block() will always have at least one valid choice.
1436 if (self->is_memory_writer()) {
1437 assert(find_block_for_node(self->in(0)) == early,
1438 "The home of a memory writer must also be its earliest placement");
1439 }
1440 #endif
1441
1442 MachNode* mach = self->is_Mach() ? self->as_Mach() : nullptr;
1443 if (mach) {
1444 switch (mach->ideal_Opcode()) {
1445 case Op_CreateEx:
1446 // Don't move exception creation
1447 early->add_inst(self);
1448 continue;
1449 break;
1450 case Op_CheckCastPP: {
1451 // Don't move CheckCastPP nodes away from their input, if the input
1452 // is a rawptr (5071820).
1453 Node *def = self->in(1);
1454 if (def != nullptr && def->bottom_type()->base() == Type::RawPtr) {
1455 early->add_inst(self);
1456 #ifdef ASSERT
1457 _raw_oops.push(def);
1458 #endif
1459 continue;
1460 }
1461 break;
1462 }
1463 default:
1464 break;
1465 }
1466 if (C->has_irreducible_loop() && self->is_memory_writer()) {
1467 // If the CFG is irreducible, place memory writers in their home block.
1468 // This prevents hoist_to_cheaper_block() from accidentally placing such
1469 // nodes into deeper loops, as in the following example:
|
216 Node* m = node->in(i);
217 if (m == nullptr) continue;
218 assert(is_CFG(m), "must be a CFG node");
219 node->rm_prec(i);
220 if (n == nullptr) {
221 n = m;
222 } else {
223 assert(is_dominator(n, m) || is_dominator(m, n), "one must dominate the other");
224 n = is_dominator(n, m) ? m : n;
225 }
226 }
227 if (n != nullptr) {
228 assert(node->in(0), "control should have been set");
229 assert(is_dominator(n, node->in(0)) || is_dominator(node->in(0), n), "one must dominate the other");
230 if (!is_dominator(n, node->in(0))) {
231 node->set_req(0, n);
232 }
233 }
234
235 // process all inputs that are non null
236 for (int i = node->len()-1; i >= 0; --i) {
237 if (node->in(i) != nullptr) {
238 spstack.push(node->in(i));
239 }
240 }
241 }
242 }
243 }
244
245 // Assert that new input b2 is dominated by all previous inputs.
246 // Check this by by seeing that it is dominated by b1, the deepest
247 // input observed until b2.
248 static void assert_dom(Block* b1, Block* b2, Node* n, const PhaseCFG* cfg) {
249 if (b1 == nullptr) return;
250 assert(b1->_dom_depth < b2->_dom_depth, "sanity");
251 Block* tmp = b2;
252 while (tmp != b1 && tmp != nullptr) {
253 tmp = tmp->_idom;
254 }
255 if (tmp != b1) {
256 #ifdef ASSERT
1430
1431 #ifdef ASSERT
1432 // Assert that memory writers (e.g. stores) have a "home" block (the block
1433 // given by their control input), and that this block corresponds to their
1434 // earliest possible placement. This guarantees that
1435 // hoist_to_cheaper_block() will always have at least one valid choice.
1436 if (self->is_memory_writer()) {
1437 assert(find_block_for_node(self->in(0)) == early,
1438 "The home of a memory writer must also be its earliest placement");
1439 }
1440 #endif
1441
1442 MachNode* mach = self->is_Mach() ? self->as_Mach() : nullptr;
1443 if (mach) {
1444 switch (mach->ideal_Opcode()) {
1445 case Op_CreateEx:
1446 // Don't move exception creation
1447 early->add_inst(self);
1448 continue;
1449 break;
1450 case Op_CastI2N:
1451 early->add_inst(self);
1452 continue;
1453 case Op_CheckCastPP: {
1454 // Don't move CheckCastPP nodes away from their input, if the input
1455 // is a rawptr (5071820).
1456 Node *def = self->in(1);
1457 if (def != nullptr && def->bottom_type()->base() == Type::RawPtr) {
1458 early->add_inst(self);
1459 #ifdef ASSERT
1460 _raw_oops.push(def);
1461 #endif
1462 continue;
1463 }
1464 break;
1465 }
1466 default:
1467 break;
1468 }
1469 if (C->has_irreducible_loop() && self->is_memory_writer()) {
1470 // If the CFG is irreducible, place memory writers in their home block.
1471 // This prevents hoist_to_cheaper_block() from accidentally placing such
1472 // nodes into deeper loops, as in the following example:
|