src/share/vm/opto/callnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/opto

src/share/vm/opto/callnode.cpp

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


1791   // remove the unlocking here, we simply set the _eliminate flag which
1792   // prevents macro expansion from expanding the unlock.  Since we don't
1793   // modify the graph, the value returned from this function is the
1794   // one computed above.
1795   // Escape state is defined after Parse phase.
1796   if (can_reshape && EliminateLocks && !is_non_esc_obj()) {
1797     //
1798     // If we are unlocking an unescaped object, the lock/unlock is unnecessary.
1799     //
1800     ConnectionGraph *cgr = phase->C->congraph();
1801     if (cgr != NULL && cgr->not_global_escape(obj_node())) {
1802       assert(!is_eliminated() || is_coarsened(), "sanity");
1803       // The lock could be marked eliminated by lock coarsening
1804       // code during first IGVN before EA. Replace coarsened flag
1805       // to eliminate all associated locks/unlocks.
1806       this->set_non_esc_obj();
1807     }
1808   }
1809   return result;
1810 }
















































1791   // remove the unlocking here, we simply set the _eliminate flag which
1792   // prevents macro expansion from expanding the unlock.  Since we don't
1793   // modify the graph, the value returned from this function is the
1794   // one computed above.
1795   // Escape state is defined after Parse phase.
1796   if (can_reshape && EliminateLocks && !is_non_esc_obj()) {
1797     //
1798     // If we are unlocking an unescaped object, the lock/unlock is unnecessary.
1799     //
1800     ConnectionGraph *cgr = phase->C->congraph();
1801     if (cgr != NULL && cgr->not_global_escape(obj_node())) {
1802       assert(!is_eliminated() || is_coarsened(), "sanity");
1803       // The lock could be marked eliminated by lock coarsening
1804       // code during first IGVN before EA. Replace coarsened flag
1805       // to eliminate all associated locks/unlocks.
1806       this->set_non_esc_obj();
1807     }
1808   }
1809   return result;
1810 }
1811 
1812 ArrayCopyNode::ArrayCopyNode(Compile* C, bool alloc_tightly_coupled)
1813   : CallNode(arraycopy_type(), NULL, TypeRawPtr::BOTTOM), _alloc_tightly_coupled(alloc_tightly_coupled), _kind(ArrayCopy) {
1814   init_class_id(Class_ArrayCopy);
1815   init_flags(Flag_is_macro);
1816   C->add_macro_node(this);
1817 }
1818 
1819 uint ArrayCopyNode::size_of() const { return sizeof(*this); }
1820 
1821 ArrayCopyNode* ArrayCopyNode::make(GraphKit* kit, bool may_throw,
1822                                    Node* src, Node* src_offset, Node* dest, Node* dest_offset, Node* length,
1823                                    bool alloc_tightly_coupled) {
1824 
1825   ArrayCopyNode* ac = new ArrayCopyNode(kit->C, alloc_tightly_coupled);
1826   Node* prev_mem = kit->set_predefined_input_for_runtime_call(ac);
1827 
1828   ac->init_req( ArrayCopyNode::Src, src);
1829   ac->init_req( ArrayCopyNode::SrcPos, src_offset);
1830   ac->init_req( ArrayCopyNode::Dest, dest);
1831   ac->init_req( ArrayCopyNode::DestPos, dest_offset);
1832   ac->init_req( ArrayCopyNode::Length, length);
1833 
1834   if (may_throw) {
1835     ac->set_req(TypeFunc::I_O , kit->i_o());
1836     kit->add_safepoint_edges(ac, false);
1837   }
1838 
1839   return ac;
1840 }
1841 
1842 void ArrayCopyNode::connect_outputs(GraphKit* kit) {
1843   kit->set_all_memory_call(this, true);
1844   kit->set_control(kit->gvn().transform(new ProjNode(this,TypeFunc::Control)));
1845   kit->set_i_o(kit->gvn().transform(new ProjNode(this, TypeFunc::I_O)));
1846   kit->make_slow_call_ex(this, kit->env()->Throwable_klass(), true);
1847   kit->set_all_memory_call(this);
1848 }
1849 
1850 #ifndef PRODUCT
1851 const char* ArrayCopyNode::_kind_names[] = {"arraycopy", "arraycopy, validated arguments", "clone", "oop array clone", "CopyOf", "CopyOfRange"};
1852 void ArrayCopyNode::dump_spec(outputStream *st) const {
1853   CallNode::dump_spec(st);
1854   st->print(" (%s%s)", _kind_names[_kind], _alloc_tightly_coupled ? ", tightly coupled allocation" : "");
1855 }
1856 #endif
src/share/vm/opto/callnode.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File