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