src/share/vm/opto/callnode.cpp

Print this page
rev 3361 : 7173584: Implement arraycopy as a macro node
Summary: delay the conversion of arraycopy to stub calls to macro expansion
Reviewed-by:


1670   // remove the unlocking here, we simply set the _eliminate flag which
1671   // prevents macro expansion from expanding the unlock.  Since we don't
1672   // modify the graph, the value returned from this function is the
1673   // one computed above.
1674   // Escape state is defined after Parse phase.
1675   if (can_reshape && EliminateLocks && !is_non_esc_obj()) {
1676     //
1677     // If we are unlocking an unescaped object, the lock/unlock is unnecessary.
1678     //
1679     ConnectionGraph *cgr = phase->C->congraph();
1680     if (cgr != NULL && cgr->not_global_escape(obj_node())) {
1681       assert(!is_eliminated() || is_coarsened(), "sanity");
1682       // The lock could be marked eliminated by lock coarsening
1683       // code during first IGVN before EA. Replace coarsened flag
1684       // to eliminate all associated locks/unlocks.
1685       this->set_non_esc_obj();
1686     }
1687   }
1688   return result;
1689 }









































1670   // remove the unlocking here, we simply set the _eliminate flag which
1671   // prevents macro expansion from expanding the unlock.  Since we don't
1672   // modify the graph, the value returned from this function is the
1673   // one computed above.
1674   // Escape state is defined after Parse phase.
1675   if (can_reshape && EliminateLocks && !is_non_esc_obj()) {
1676     //
1677     // If we are unlocking an unescaped object, the lock/unlock is unnecessary.
1678     //
1679     ConnectionGraph *cgr = phase->C->congraph();
1680     if (cgr != NULL && cgr->not_global_escape(obj_node())) {
1681       assert(!is_eliminated() || is_coarsened(), "sanity");
1682       // The lock could be marked eliminated by lock coarsening
1683       // code during first IGVN before EA. Replace coarsened flag
1684       // to eliminate all associated locks/unlocks.
1685       this->set_non_esc_obj();
1686     }
1687   }
1688   return result;
1689 }
1690 
1691 ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled)
1692   : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM), _alloc_tightly_coupled(alloc_tightly_coupled), _kind(ArrayCopy) {
1693   init_class_id(Class_ArrayCopy);
1694   init_flags(Flag_is_macro);
1695   C->add_macro_node(this);
1696 }
1697 
1698 uint ArrayCopyNode::size_of() const { return sizeof(*this); }
1699 
1700 ArrayCopyNode* ArrayCopyNode::make(GraphKit* kit, bool may_throw,
1701                                    Node* src, Node* src_offset, Node* dest, Node* dest_offset, Node* length,
1702                                    bool alloc_tightly_coupled) {
1703 
1704   ArrayCopyNode* ac = new (kit->C, ParmLimit)ArrayCopyNode(kit->C, alloc_tightly_coupled);
1705   Node* prev_mem = kit->set_predefined_input_for_runtime_call(ac);
1706 
1707   ac->init_req( ArrayCopyNode::Src, src);
1708   ac->init_req( ArrayCopyNode::SrcPos, src_offset);
1709   ac->init_req( ArrayCopyNode::Dest, dest);
1710   ac->init_req( ArrayCopyNode::DestPos, dest_offset);
1711   ac->init_req( ArrayCopyNode::Length, length);
1712 
1713   if (may_throw) {
1714     ac->set_req( TypeFunc::I_O , kit->i_o() );
1715     kit->add_safepoint_edges(ac, false);
1716   }
1717 
1718   return ac;
1719 }
1720 
1721 void ArrayCopyNode::connect_outputs(GraphKit* kit) {
1722   kit->set_all_memory_call(this, true);
1723   kit->set_control(kit->gvn().transform( new (kit->C, 1) ProjNode(this,TypeFunc::Control) ));
1724   kit->set_i_o(kit->gvn().transform(new (kit->C, 1) ProjNode(this, TypeFunc::I_O)));
1725   kit->make_slow_call_ex(this, kit->env()->Throwable_klass(), true);
1726   kit->set_all_memory_call(this);
1727 }
1728