src/share/vm/opto/macro.hpp

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:


  81   void expand_allocate_array(AllocateArrayNode *alloc);
  82   void expand_allocate_common(AllocateNode* alloc,
  83                               Node* length,
  84                               const TypeFunc* slow_call_type,
  85                               address slow_call_address);
  86   Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc);
  87   Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, Node_Stack *value_phis, int level);
  88 
  89   bool eliminate_allocate_node(AllocateNode *alloc);
  90   bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
  91   bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
  92   void process_users_of_allocation(AllocateNode *alloc);
  93 
  94   void eliminate_card_mark(Node *cm);
  95   void mark_eliminated_box(Node* box, Node* obj);
  96   void mark_eliminated_locking_nodes(AbstractLockNode *alock);
  97   bool eliminate_locking_node(AbstractLockNode *alock);
  98   void expand_lock_node(LockNode *lock);
  99   void expand_unlock_node(UnlockNode *unlock);
 100 












































































 101   int replace_input(Node *use, Node *oldref, Node *newref);
 102   void copy_call_debug_info(CallNode *oldcall, CallNode * newcall);
 103   Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
 104   void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
 105   CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
 106                        const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1);
 107   void extract_call_projections(CallNode *call);
 108 
 109   Node* initialize_object(AllocateNode* alloc,
 110                           Node* control, Node* rawmem, Node* object,
 111                           Node* klass_node, Node* length,
 112                           Node* size_in_bytes);
 113 
 114   Node* prefetch_allocation(Node* i_o,
 115                             Node*& needgc_false, Node*& contended_phi_rawmem,
 116                             Node* old_eden_top, Node* new_eden_top,
 117                             Node* length);
 118 
 119 public:
 120   PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn) {


  81   void expand_allocate_array(AllocateArrayNode *alloc);
  82   void expand_allocate_common(AllocateNode* alloc,
  83                               Node* length,
  84                               const TypeFunc* slow_call_type,
  85                               address slow_call_address);
  86   Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc);
  87   Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, Node_Stack *value_phis, int level);
  88 
  89   bool eliminate_allocate_node(AllocateNode *alloc);
  90   bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
  91   bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
  92   void process_users_of_allocation(AllocateNode *alloc);
  93 
  94   void eliminate_card_mark(Node *cm);
  95   void mark_eliminated_box(Node* box, Node* obj);
  96   void mark_eliminated_locking_nodes(AbstractLockNode *alock);
  97   bool eliminate_locking_node(AbstractLockNode *alock);
  98   void expand_lock_node(LockNode *lock);
  99   void expand_unlock_node(UnlockNode *unlock);
 100 
 101   void finish_arraycopy_call(Node* call, Node** ctrl, MergeMemNode** mem, const TypePtr* adr_type);
 102   void insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent = NULL);
 103   Node* generate_guard(Node** ctrl, Node* test, RegionNode* region, float true_prob);
 104   Node* generate_slow_guard(Node** ctrl, Node* test, RegionNode* region);
 105   void generate_negative_guard(Node** ctrl, Node* index, RegionNode* region);
 106   void generate_limit_guard(Node** ctrl, Node* offset, Node* subseq_length, Node* array_length, RegionNode* region);
 107   Node* generate_nonpositive_guard(Node** ctrl, Node* index, bool never_negative);
 108   address basictype2arraycopy(BasicType t,
 109                               Node* src_offset,
 110                               Node* dest_offset,
 111                               bool disjoint_bases,
 112                               const char* &name,
 113                               bool dest_uninitialized);
 114   Node* gen_subtype_check(Node** ctrl, MergeMemNode* mem, Node* subklass, Node* superklass);
 115   Node* array_element_address(Node* ary, Node* idx, BasicType elembt);
 116   Node* ConvI2L(Node* offset);
 117   Node* make_leaf_call(Node* ctrl, Node* mem,
 118                        const TypeFunc* call_type, address call_addr,
 119                        const char* call_name,
 120                        const TypePtr* adr_type,
 121                        Node* parm0 = NULL, Node* parm1 = NULL,
 122                        Node* parm2 = NULL, Node* parm3 = NULL,
 123                        Node* parm4 = NULL, Node* parm5 = NULL,
 124                        Node* parm6 = NULL, Node* parm7 = NULL);
 125 
 126   void expand_arraycopy_node(ArrayCopyNode *ac);
 127   Node* generate_arraycopy(ArrayCopyNode *ac,
 128                            AllocateArrayNode* alloc,
 129                            Node** ctrl, MergeMemNode* mem, Node** io,
 130                            const TypePtr* adr_type,
 131                            BasicType basic_elem_type,
 132                            Node* src,  Node* src_offset,
 133                            Node* dest, Node* dest_offset,
 134                            Node* copy_length,
 135                            bool disjoint_bases = false,
 136                            bool length_never_negative = false,
 137                            RegionNode* slow_region = NULL);
 138   void generate_clear_array(Node* ctrl, MergeMemNode* merge_mem,
 139                             const TypePtr* adr_type,
 140                             Node* dest,
 141                             BasicType basic_elem_type,
 142                             Node* slice_idx,
 143                             Node* slice_len,
 144                             Node* dest_size);
 145   bool generate_block_arraycopy(Node** ctrl, MergeMemNode** mem, Node* io,
 146                                 const TypePtr* adr_type,
 147                                 BasicType basic_elem_type,
 148                                 AllocateNode* alloc,
 149                                 Node* src,  Node* src_offset,
 150                                 Node* dest, Node* dest_offset,
 151                                 Node* dest_size, bool dest_uninitialized);
 152   MergeMemNode* generate_slow_arraycopy(ArrayCopyNode *ac,
 153                                         Node** ctrl, Node* mem, Node** io,
 154                                         const TypePtr* adr_type,
 155                                         Node* src,  Node* src_offset,
 156                                         Node* dest, Node* dest_offset,
 157                                         Node* copy_length, bool dest_uninitialized);
 158   Node* generate_checkcast_arraycopy(Node** ctrl, MergeMemNode** mem,
 159                                      const TypePtr* adr_type,
 160                                      Node* dest_elem_klass,
 161                                      Node* src,  Node* src_offset,
 162                                      Node* dest, Node* dest_offset,
 163                                      Node* copy_length, bool dest_uninitialized);
 164   Node* generate_generic_arraycopy(Node** ctrl, MergeMemNode** mem,
 165                                    const TypePtr* adr_type,
 166                                    Node* src,  Node* src_offset,
 167                                    Node* dest, Node* dest_offset,
 168                                    Node* copy_length, bool dest_uninitialized);
 169   void generate_unchecked_arraycopy(Node** ctrl, MergeMemNode** mem,
 170                                     const TypePtr* adr_type,
 171                                     BasicType basic_elem_type,
 172                                     bool disjoint_bases,
 173                                     Node* src,  Node* src_offset,
 174                                     Node* dest, Node* dest_offset,
 175                                     Node* copy_length, bool dest_uninitialized);
 176 
 177   int replace_input(Node *use, Node *oldref, Node *newref);
 178   void copy_call_debug_info(CallNode *oldcall, CallNode * newcall);
 179   Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
 180   void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
 181   CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
 182                        const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1);
 183   void extract_call_projections(CallNode *call);
 184 
 185   Node* initialize_object(AllocateNode* alloc,
 186                           Node* control, Node* rawmem, Node* object,
 187                           Node* klass_node, Node* length,
 188                           Node* size_in_bytes);
 189 
 190   Node* prefetch_allocation(Node* i_o,
 191                             Node*& needgc_false, Node*& contended_phi_rawmem,
 192                             Node* old_eden_top, Node* new_eden_top,
 193                             Node* length);
 194 
 195 public:
 196   PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn) {