< prev index next >

src/hotspot/share/opto/gcm.cpp

Print this page

 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

1577 
1578 #ifdef ASSERT
1579     // Assert that memory writers (e.g. stores) have a "home" block (the block
1580     // given by their control input), and that this block corresponds to their
1581     // earliest possible placement. This guarantees that
1582     // hoist_to_cheaper_block() will always have at least one valid choice.
1583     if (self->is_memory_writer()) {
1584       assert(find_block_for_node(self->in(0)) == early,
1585              "The home of a memory writer must also be its earliest placement");
1586     }
1587 #endif
1588 
1589     MachNode* mach = self->is_Mach() ? self->as_Mach() : nullptr;
1590     if (mach) {
1591       switch (mach->ideal_Opcode()) {
1592       case Op_CreateEx:
1593         // Don't move exception creation
1594         early->add_inst(self);
1595         continue;
1596         break;



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:

 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

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