< prev index next >

src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp

Print this page
rev 52560 : 8213615: GC/C2 abstraction for escape analysis


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "opto/compile.hpp"
  26 #include "opto/castnode.hpp"

  27 #include "opto/graphKit.hpp"
  28 #include "opto/idealKit.hpp"
  29 #include "opto/loopnode.hpp"
  30 #include "opto/macro.hpp"
  31 #include "opto/node.hpp"
  32 #include "opto/type.hpp"
  33 #include "utilities/macros.hpp"
  34 #include "gc/z/c2/zBarrierSetC2.hpp"
  35 #include "gc/z/zThreadLocalData.hpp"
  36 #include "gc/z/zBarrierSetRuntime.hpp"
  37 
  38 ZBarrierSetC2State::ZBarrierSetC2State(Arena* comp_arena)
  39   : _load_barrier_nodes(new (comp_arena) GrowableArray<LoadBarrierNode*>(comp_arena, 8,  0, NULL)) {}
  40 
  41 int ZBarrierSetC2State::load_barrier_count() const {
  42   return _load_barrier_nodes->length();
  43 }
  44 
  45 void ZBarrierSetC2State::add_load_barrier_node(LoadBarrierNode * n) {
  46   assert(!_load_barrier_nodes->contains(n), " duplicate entry in expand list");


1554     }
1555 
1556     if (ZVerifyLoadBarriers) {
1557       if ((n->is_Load() || n->is_LoadStore()) && n->bottom_type()->make_oopptr() != NULL) {
1558         visited.Clear();
1559         bool found = look_for_barrier(n, post_parse, visited);
1560         if (!found) {
1561           n->dump(1);
1562           n->dump(-3);
1563           stringStream ss;
1564           C->method()->print_short_name(&ss);
1565           tty->print_cr("-%s-", ss.as_string());
1566           assert(found, "");
1567         }
1568       }
1569     }
1570   }
1571 }
1572 
1573 #endif











































   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "opto/compile.hpp"
  26 #include "opto/castnode.hpp"
  27 #include "opto/escape.hpp"
  28 #include "opto/graphKit.hpp"
  29 #include "opto/idealKit.hpp"
  30 #include "opto/loopnode.hpp"
  31 #include "opto/macro.hpp"
  32 #include "opto/node.hpp"
  33 #include "opto/type.hpp"
  34 #include "utilities/macros.hpp"
  35 #include "gc/z/c2/zBarrierSetC2.hpp"
  36 #include "gc/z/zThreadLocalData.hpp"
  37 #include "gc/z/zBarrierSetRuntime.hpp"
  38 
  39 ZBarrierSetC2State::ZBarrierSetC2State(Arena* comp_arena)
  40   : _load_barrier_nodes(new (comp_arena) GrowableArray<LoadBarrierNode*>(comp_arena, 8,  0, NULL)) {}
  41 
  42 int ZBarrierSetC2State::load_barrier_count() const {
  43   return _load_barrier_nodes->length();
  44 }
  45 
  46 void ZBarrierSetC2State::add_load_barrier_node(LoadBarrierNode * n) {
  47   assert(!_load_barrier_nodes->contains(n), " duplicate entry in expand list");


1555     }
1556 
1557     if (ZVerifyLoadBarriers) {
1558       if ((n->is_Load() || n->is_LoadStore()) && n->bottom_type()->make_oopptr() != NULL) {
1559         visited.Clear();
1560         bool found = look_for_barrier(n, post_parse, visited);
1561         if (!found) {
1562           n->dump(1);
1563           n->dump(-3);
1564           stringStream ss;
1565           C->method()->print_short_name(&ss);
1566           tty->print_cr("-%s-", ss.as_string());
1567           assert(found, "");
1568         }
1569       }
1570     }
1571   }
1572 }
1573 
1574 #endif
1575 
1576 bool ZBarrierSetC2::escape_add_to_con_graph(ConnectionGraph* conn_graph, PhaseGVN* gvn, Unique_Node_List* delayed_worklist, Node* n, uint opcode) const {
1577   switch (opcode) {
1578     case Op_LoadBarrierSlowReg:
1579     case Op_LoadBarrierWeakSlowReg:
1580       conn_graph->add_objload_to_connection_graph(n, delayed_worklist);
1581       return true;
1582     case Op_Proj:
1583       if (n->as_Proj()->_con == LoadBarrierNode::Oop && n->in(0)->is_LoadBarrier()) {
1584         conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(0)->in(LoadBarrierNode::Oop),
1585                                            delayed_worklist);
1586         return true;
1587       }
1588     default:
1589       break;
1590   }
1591   return false;
1592 }
1593 
1594 bool ZBarrierSetC2::escape_add_final_edges(ConnectionGraph* conn_graph, PhaseGVN* gvn, Node* n, uint opcode) const {
1595   switch (opcode) {
1596     case Op_LoadBarrierSlowReg:
1597     case Op_LoadBarrierWeakSlowReg: {
1598       const Type *t = gvn->type(n);
1599       if (t->make_ptr() != NULL) {
1600         Node *adr = n->in(MemNode::Address);
1601         conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, adr, NULL);
1602         return true;
1603       }
1604     }
1605     case Op_Proj: {
1606       if (n->as_Proj()->_con == LoadBarrierNode::Oop && n->in(0)->is_LoadBarrier()) {
1607         conn_graph->add_local_var_and_edge(n, PointsToNode::NoEscape, n->in(0)->in(LoadBarrierNode::Oop), NULL);
1608         return true;
1609       }
1610     }
1611     default:
1612       break;
1613   }
1614   return false;
1615 }
< prev index next >