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
1573
1574 #ifdef ASSERT
1575 // Assert that memory writers (e.g. stores) have a "home" block (the block
1576 // given by their control input), and that this block corresponds to their
1577 // earliest possible placement. This guarantees that
1578 // hoist_to_cheaper_block() will always have at least one valid choice.
1579 if (self->is_memory_writer()) {
1580 assert(find_block_for_node(self->in(0)) == early,
1581 "The home of a memory writer must also be its earliest placement");
1582 }
1583 #endif
1584
1585 MachNode* mach = self->is_Mach() ? self->as_Mach() : nullptr;
1586 if (mach) {
1587 switch (mach->ideal_Opcode()) {
1588 case Op_CreateEx:
1589 // Don't move exception creation
1590 early->add_inst(self);
1591 continue;
1592 break;
1593 case Op_CheckCastPP: {
1594 // Don't move CheckCastPP nodes away from their input, if the input
1595 // is a rawptr (5071820).
1596 Node *def = self->in(1);
1597 if (def != nullptr && def->bottom_type()->base() == Type::RawPtr) {
1598 early->add_inst(self);
1599 #ifdef ASSERT
1600 _raw_oops.push(def);
1601 #endif
1602 continue;
1603 }
1604 break;
1605 }
1606 default:
1607 break;
1608 }
1609 if (C->has_irreducible_loop() && self->is_memory_writer()) {
1610 // If the CFG is irreducible, place memory writers in their home block.
1611 // This prevents hoist_to_cheaper_block() from accidentally placing such
1612 // 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
1573
1574 #ifdef ASSERT
1575 // Assert that memory writers (e.g. stores) have a "home" block (the block
1576 // given by their control input), and that this block corresponds to their
1577 // earliest possible placement. This guarantees that
1578 // hoist_to_cheaper_block() will always have at least one valid choice.
1579 if (self->is_memory_writer()) {
1580 assert(find_block_for_node(self->in(0)) == early,
1581 "The home of a memory writer must also be its earliest placement");
1582 }
1583 #endif
1584
1585 MachNode* mach = self->is_Mach() ? self->as_Mach() : nullptr;
1586 if (mach) {
1587 switch (mach->ideal_Opcode()) {
1588 case Op_CreateEx:
1589 // Don't move exception creation
1590 early->add_inst(self);
1591 continue;
1592 break;
1593 case Op_CastI2N:
1594 early->add_inst(self);
1595 continue;
1596 case Op_CheckCastPP: {
1597 // Don't move CheckCastPP nodes away from their input, if the input
1598 // is a rawptr (5071820).
1599 Node *def = self->in(1);
1600 if (def != nullptr && def->bottom_type()->base() == Type::RawPtr) {
1601 early->add_inst(self);
1602 #ifdef ASSERT
1603 _raw_oops.push(def);
1604 #endif
1605 continue;
1606 }
1607 break;
1608 }
1609 default:
1610 break;
1611 }
1612 if (C->has_irreducible_loop() && self->is_memory_writer()) {
1613 // If the CFG is irreducible, place memory writers in their home block.
1614 // This prevents hoist_to_cheaper_block() from accidentally placing such
1615 // nodes into deeper loops, as in the following example:
|