219 Node* m = node->in(i);
220 if (m == nullptr) continue;
221 assert(is_CFG(m), "must be a CFG node");
222 node->rm_prec(i);
223 if (n == nullptr) {
224 n = m;
225 } else {
226 assert(is_dominator(n, m) || is_dominator(m, n), "one must dominate the other");
227 n = is_dominator(n, m) ? m : n;
228 }
229 }
230 if (n != nullptr) {
231 assert(node->in(0), "control should have been set");
232 assert(is_dominator(n, node->in(0)) || is_dominator(node->in(0), n), "one must dominate the other");
233 if (!is_dominator(n, node->in(0))) {
234 node->set_req(0, n);
235 }
236 }
237
238 // process all inputs that are non null
239 for (int i = node->req()-1; i >= 0; --i) {
240 if (node->in(i) != nullptr) {
241 spstack.push(node->in(i));
242 }
243 }
244 }
245 }
246 }
247
248 // Assert that new input b2 is dominated by all previous inputs.
249 // Check this by by seeing that it is dominated by b1, the deepest
250 // input observed until b2.
251 static void assert_dom(Block* b1, Block* b2, Node* n, const PhaseCFG* cfg) {
252 if (b1 == nullptr) return;
253 assert(b1->_dom_depth < b2->_dom_depth, "sanity");
254 Block* tmp = b2;
255 while (tmp != b1 && tmp != nullptr) {
256 tmp = tmp->_idom;
257 }
258 if (tmp != b1) {
259 #ifdef ASSERT
1579
1580 #ifdef ASSERT
1581 // Assert that memory writers (e.g. stores) have a "home" block (the block
1582 // given by their control input), and that this block corresponds to their
1583 // earliest possible placement. This guarantees that
1584 // hoist_to_cheaper_block() will always have at least one valid choice.
1585 if (self->is_memory_writer()) {
1586 assert(find_block_for_node(self->in(0)) == early,
1587 "The home of a memory writer must also be its earliest placement");
1588 }
1589 #endif
1590
1591 MachNode* mach = self->is_Mach() ? self->as_Mach() : nullptr;
1592 if (mach) {
1593 switch (mach->ideal_Opcode()) {
1594 case Op_CreateEx:
1595 // Don't move exception creation
1596 early->add_inst(self);
1597 continue;
1598 break;
1599 case Op_CheckCastPP: {
1600 // Don't move CheckCastPP nodes away from their input, if the input
1601 // is a rawptr (5071820).
1602 Node *def = self->in(1);
1603 if (def != nullptr && def->bottom_type()->base() == Type::RawPtr) {
1604 early->add_inst(self);
1605 #ifdef ASSERT
1606 _raw_oops.push(def);
1607 #endif
1608 continue;
1609 }
1610 break;
1611 }
1612 default:
1613 break;
1614 }
1615 if (C->has_irreducible_loop() && self->is_memory_writer()) {
1616 // If the CFG is irreducible, place memory writers in their home block.
1617 // This prevents hoist_to_cheaper_block() from accidentally placing such
1618 // nodes into deeper loops, as in the following example:
|
219 Node* m = node->in(i);
220 if (m == nullptr) continue;
221 assert(is_CFG(m), "must be a CFG node");
222 node->rm_prec(i);
223 if (n == nullptr) {
224 n = m;
225 } else {
226 assert(is_dominator(n, m) || is_dominator(m, n), "one must dominate the other");
227 n = is_dominator(n, m) ? m : n;
228 }
229 }
230 if (n != nullptr) {
231 assert(node->in(0), "control should have been set");
232 assert(is_dominator(n, node->in(0)) || is_dominator(node->in(0), n), "one must dominate the other");
233 if (!is_dominator(n, node->in(0))) {
234 node->set_req(0, n);
235 }
236 }
237
238 // process all inputs that are non null
239 for (int i = node->len()-1; i >= 0; --i) {
240 if (node->in(i) != nullptr) {
241 spstack.push(node->in(i));
242 }
243 }
244 }
245 }
246 }
247
248 // Assert that new input b2 is dominated by all previous inputs.
249 // Check this by by seeing that it is dominated by b1, the deepest
250 // input observed until b2.
251 static void assert_dom(Block* b1, Block* b2, Node* n, const PhaseCFG* cfg) {
252 if (b1 == nullptr) return;
253 assert(b1->_dom_depth < b2->_dom_depth, "sanity");
254 Block* tmp = b2;
255 while (tmp != b1 && tmp != nullptr) {
256 tmp = tmp->_idom;
257 }
258 if (tmp != b1) {
259 #ifdef ASSERT
1579
1580 #ifdef ASSERT
1581 // Assert that memory writers (e.g. stores) have a "home" block (the block
1582 // given by their control input), and that this block corresponds to their
1583 // earliest possible placement. This guarantees that
1584 // hoist_to_cheaper_block() will always have at least one valid choice.
1585 if (self->is_memory_writer()) {
1586 assert(find_block_for_node(self->in(0)) == early,
1587 "The home of a memory writer must also be its earliest placement");
1588 }
1589 #endif
1590
1591 MachNode* mach = self->is_Mach() ? self->as_Mach() : nullptr;
1592 if (mach) {
1593 switch (mach->ideal_Opcode()) {
1594 case Op_CreateEx:
1595 // Don't move exception creation
1596 early->add_inst(self);
1597 continue;
1598 break;
1599 case Op_CastI2N:
1600 early->add_inst(self);
1601 continue;
1602 case Op_CheckCastPP: {
1603 // Don't move CheckCastPP nodes away from their input, if the input
1604 // is a rawptr (5071820).
1605 Node *def = self->in(1);
1606 if (def != nullptr && def->bottom_type()->base() == Type::RawPtr) {
1607 early->add_inst(self);
1608 #ifdef ASSERT
1609 _raw_oops.push(def);
1610 #endif
1611 continue;
1612 }
1613 break;
1614 }
1615 default:
1616 break;
1617 }
1618 if (C->has_irreducible_loop() && self->is_memory_writer()) {
1619 // If the CFG is irreducible, place memory writers in their home block.
1620 // This prevents hoist_to_cheaper_block() from accidentally placing such
1621 // nodes into deeper loops, as in the following example:
|