< prev index next >

src/hotspot/share/opto/macro.hpp

Print this page

 65                    Node* value, BasicType bt);
 66 
 67   Node* make_leaf_call(Node* ctrl, Node* mem,
 68                        const TypeFunc* call_type, address call_addr,
 69                        const char* call_name,
 70                        const TypePtr* adr_type,
 71                        Node* parm0 = NULL, Node* parm1 = NULL,
 72                        Node* parm2 = NULL, Node* parm3 = NULL,
 73                        Node* parm4 = NULL, Node* parm5 = NULL,
 74                        Node* parm6 = NULL, Node* parm7 = NULL);
 75 
 76   address basictype2arraycopy(BasicType t,
 77                               Node* src_offset,
 78                               Node* dest_offset,
 79                               bool disjoint_bases,
 80                               const char* &name,
 81                               bool dest_uninitialized);
 82 
 83 private:
 84   // projections extracted from a call node
 85   CallProjections _callprojs;
 86 
 87   // Additional data collected during macro expansion
 88   bool _has_locks;
 89 
 90   void expand_allocate(AllocateNode *alloc);
 91   void expand_allocate_array(AllocateArrayNode *alloc);
 92   void expand_allocate_common(AllocateNode* alloc,
 93                               Node* length,
 94                               const TypeFunc* slow_call_type,
 95                               address slow_call_address);
 96   void yank_initalize_node(InitializeNode* node);
 97   void yank_alloc_node(AllocateNode* alloc);
 98   Node *value_from_mem(Node *mem, Node *ctl, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc);
 99   Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc, Node_Stack *value_phis, int level);

100 
101   bool eliminate_boxing_node(CallStaticJavaNode *boxing);
102   bool eliminate_allocate_node(AllocateNode *alloc);
103   bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
104   bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
105   void process_users_of_allocation(CallNode *alloc);
106 
107   void eliminate_gc_barrier(Node *p2x);
108   void mark_eliminated_box(Node* box, Node* obj);
109   void mark_eliminated_locking_nodes(AbstractLockNode *alock);
110   bool eliminate_locking_node(AbstractLockNode *alock);
111   void expand_lock_node(LockNode *lock);

112   void expand_unlock_node(UnlockNode *unlock);

113 
114   // More helper methods modeled after GraphKit for array copy
115   void insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent = NULL);
116   Node* array_element_address(Node* ary, Node* idx, BasicType elembt);
117   Node* ConvI2L(Node* offset);
118 
119   // helper methods modeled after LibraryCallKit for array copy
120   Node* generate_guard(Node** ctrl, Node* test, RegionNode* region, float true_prob);
121   Node* generate_slow_guard(Node** ctrl, Node* test, RegionNode* region);

122 
123   void generate_partial_inlining_block(Node** ctrl, MergeMemNode** mem, const TypePtr* adr_type,
124                                        RegionNode** exit_block, Node** result_memory, Node* length,
125                                        Node* src_start, Node* dst_start, BasicType type);
126 
127   void generate_negative_guard(Node** ctrl, Node* index, RegionNode* region);
128   void generate_limit_guard(Node** ctrl, Node* offset, Node* subseq_length, Node* array_length, RegionNode* region);
129 
130   // More helper methods for array copy
131   Node* generate_nonpositive_guard(Node** ctrl, Node* index, bool never_negative);




132   void finish_arraycopy_call(Node* call, Node** ctrl, MergeMemNode** mem, const TypePtr* adr_type);
133   Node* generate_arraycopy(ArrayCopyNode *ac,
134                            AllocateArrayNode* alloc,
135                            Node** ctrl, MergeMemNode* mem, Node** io,
136                            const TypePtr* adr_type,
137                            BasicType basic_elem_type,
138                            Node* src,  Node* src_offset,
139                            Node* dest, Node* dest_offset,
140                            Node* copy_length,

141                            bool disjoint_bases = false,
142                            bool length_never_negative = false,
143                            RegionNode* slow_region = NULL);
144   void generate_clear_array(Node* ctrl, MergeMemNode* merge_mem,
145                             const TypePtr* adr_type,
146                             Node* dest,


147                             BasicType basic_elem_type,
148                             Node* slice_idx,
149                             Node* slice_len,
150                             Node* dest_size);
151   bool generate_block_arraycopy(Node** ctrl, MergeMemNode** mem, Node* io,
152                                 const TypePtr* adr_type,
153                                 BasicType basic_elem_type,
154                                 AllocateNode* alloc,
155                                 Node* src,  Node* src_offset,
156                                 Node* dest, Node* dest_offset,
157                                 Node* dest_size, bool dest_uninitialized);
158   MergeMemNode* generate_slow_arraycopy(ArrayCopyNode *ac,
159                                         Node** ctrl, Node* mem, Node** io,
160                                         const TypePtr* adr_type,
161                                         Node* src,  Node* src_offset,
162                                         Node* dest, Node* dest_offset,
163                                         Node* copy_length, bool dest_uninitialized);
164   Node* generate_checkcast_arraycopy(Node** ctrl, MergeMemNode** mem,
165                                      const TypePtr* adr_type,
166                                      Node* dest_elem_klass,
167                                      Node* src,  Node* src_offset,
168                                      Node* dest, Node* dest_offset,
169                                      Node* copy_length, bool dest_uninitialized);
170   Node* generate_generic_arraycopy(Node** ctrl, MergeMemNode** mem,
171                                    const TypePtr* adr_type,
172                                    Node* src,  Node* src_offset,
173                                    Node* dest, Node* dest_offset,
174                                    Node* copy_length, bool dest_uninitialized);
175   bool generate_unchecked_arraycopy(Node** ctrl, MergeMemNode** mem,
176                                     const TypePtr* adr_type,
177                                     BasicType basic_elem_type,
178                                     bool disjoint_bases,
179                                     Node* src,  Node* src_offset,
180                                     Node* dest, Node* dest_offset,
181                                     Node* copy_length, bool dest_uninitialized);
182 


183   void expand_arraycopy_node(ArrayCopyNode *ac);
184 
185   void expand_subtypecheck_node(SubTypeCheckNode *check);
186 


187   int replace_input(Node *use, Node *oldref, Node *newref);
188   void migrate_outs(Node *old, Node *target);
189   void copy_call_debug_info(CallNode *oldcall, CallNode * newcall);
190   Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
191   void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
192   CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
193                            const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1,
194                            Node* parm2);
195 
196   Node* initialize_object(AllocateNode* alloc,
197                           Node* control, Node* rawmem, Node* object,
198                           Node* klass_node, Node* length,
199                           Node* size_in_bytes);
200 
201   Node* make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset, Node* ctl, Node* mem, BasicType ft, const Type *ftype, AllocateNode *alloc);
202 


203 public:
204   PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) {
205     _igvn.set_delay_transform(true);
206   }
207   void eliminate_macro_nodes();
208   bool expand_macro_nodes();
209 
210   PhaseIterGVN &igvn() const { return _igvn; }
211 
212   // Members accessed from BarrierSetC2
213   void replace_node(Node* source, Node* target) { _igvn.replace_node(source, target); }
214   Node* intcon(jint con)        const { return _igvn.intcon(con); }
215   Node* longcon(jlong con)      const { return _igvn.longcon(con); }
216   Node* makecon(const Type *t)  const { return _igvn.makecon(t); }
217   Node* top()                   const { return C->top(); }
218 
219   Node* prefetch_allocation(Node* i_o,
220                             Node*& needgc_false, Node*& contended_phi_rawmem,
221                             Node* old_eden_top, Node* new_eden_top,
222                             intx lines);

 65                    Node* value, BasicType bt);
 66 
 67   Node* make_leaf_call(Node* ctrl, Node* mem,
 68                        const TypeFunc* call_type, address call_addr,
 69                        const char* call_name,
 70                        const TypePtr* adr_type,
 71                        Node* parm0 = NULL, Node* parm1 = NULL,
 72                        Node* parm2 = NULL, Node* parm3 = NULL,
 73                        Node* parm4 = NULL, Node* parm5 = NULL,
 74                        Node* parm6 = NULL, Node* parm7 = NULL);
 75 
 76   address basictype2arraycopy(BasicType t,
 77                               Node* src_offset,
 78                               Node* dest_offset,
 79                               bool disjoint_bases,
 80                               const char* &name,
 81                               bool dest_uninitialized);
 82 
 83 private:
 84   // projections extracted from a call node
 85   CallProjections* _callprojs;
 86 
 87   // Additional data collected during macro expansion
 88   bool _has_locks;
 89 
 90   void expand_allocate(AllocateNode *alloc);
 91   void expand_allocate_array(AllocateArrayNode *alloc);
 92   void expand_allocate_common(AllocateNode* alloc,
 93                               Node* length,
 94                               const TypeFunc* slow_call_type,
 95                               address slow_call_address);
 96   void yank_initalize_node(InitializeNode* node);
 97   void yank_alloc_node(AllocateNode* alloc);
 98   Node *value_from_mem(Node *mem, Node *ctl, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc);
 99   Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc, Node_Stack *value_phis, int level);
100   Node* inline_type_from_mem(Node* mem, Node* ctl, ciInlineKlass* vk, const TypeAryPtr* adr_type, int offset, AllocateNode* alloc);
101 
102   bool eliminate_boxing_node(CallStaticJavaNode *boxing);
103   bool eliminate_allocate_node(AllocateNode *alloc);
104   bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
105   bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
106   void process_users_of_allocation(CallNode *alloc, bool inline_alloc = false);
107 
108   void eliminate_gc_barrier(Node *p2x);
109   void mark_eliminated_box(Node* box, Node* obj);
110   void mark_eliminated_locking_nodes(AbstractLockNode *alock);
111   bool eliminate_locking_node(AbstractLockNode *alock);
112   void expand_lock_node(LockNode *lock);
113   void inline_type_guard(Node** ctrl, LockNode* lock);
114   void expand_unlock_node(UnlockNode *unlock);
115   void expand_mh_intrinsic_return(CallStaticJavaNode* call);
116 
117   // More helper methods modeled after GraphKit for array copy
118   void insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent = NULL);
119   Node* array_element_address(Node* ary, Node* idx, BasicType elembt);
120   Node* ConvI2L(Node* offset);
121 
122   // helper methods modeled after LibraryCallKit for array copy
123   Node* generate_guard(Node** ctrl, Node* test, RegionNode* region, float true_prob);
124   Node* generate_slow_guard(Node** ctrl, Node* test, RegionNode* region);
125   Node* generate_fair_guard(Node** ctrl, Node* test, RegionNode* region);
126 
127   void generate_partial_inlining_block(Node** ctrl, MergeMemNode** mem, const TypePtr* adr_type,
128                                        RegionNode** exit_block, Node** result_memory, Node* length,
129                                        Node* src_start, Node* dst_start, BasicType type);
130 
131   void generate_negative_guard(Node** ctrl, Node* index, RegionNode* region);
132   void generate_limit_guard(Node** ctrl, Node* offset, Node* subseq_length, Node* array_length, RegionNode* region);
133 
134   // More helper methods for array copy
135   Node* generate_nonpositive_guard(Node** ctrl, Node* index, bool never_negative);
136   Node* array_lh_test(Node* array, jint mask);
137   Node* generate_flat_array_guard(Node** ctrl, Node* array, RegionNode* region);
138   Node* generate_null_free_array_guard(Node** ctrl, Node* array, RegionNode* region);
139 
140   void finish_arraycopy_call(Node* call, Node** ctrl, MergeMemNode** mem, const TypePtr* adr_type);
141   Node* generate_arraycopy(ArrayCopyNode *ac,
142                            AllocateArrayNode* alloc,
143                            Node** ctrl, MergeMemNode* mem, Node** io,
144                            const TypePtr* adr_type,
145                            BasicType basic_elem_type,
146                            Node* src,  Node* src_offset,
147                            Node* dest, Node* dest_offset,
148                            Node* copy_length,
149                            Node* dest_length,
150                            bool disjoint_bases = false,
151                            bool length_never_negative = false,
152                            RegionNode* slow_region = NULL);
153   void generate_clear_array(Node* ctrl, MergeMemNode* merge_mem,
154                             const TypePtr* adr_type,
155                             Node* dest,
156                             Node* val,
157                             Node* raw_val,
158                             BasicType basic_elem_type,
159                             Node* slice_idx,
160                             Node* slice_len,
161                             Node* dest_size);
162   bool generate_block_arraycopy(Node** ctrl, MergeMemNode** mem, Node* io,
163                                 const TypePtr* adr_type,
164                                 BasicType basic_elem_type,
165                                 AllocateNode* alloc,
166                                 Node* src,  Node* src_offset,
167                                 Node* dest, Node* dest_offset,
168                                 Node* dest_size, bool dest_uninitialized);
169   MergeMemNode* generate_slow_arraycopy(ArrayCopyNode *ac,
170                                         Node** ctrl, Node* mem, Node** io,
171                                         const TypePtr* adr_type,
172                                         Node* src,  Node* src_offset,
173                                         Node* dest, Node* dest_offset,
174                                         Node* copy_length, bool dest_uninitialized);
175   Node* generate_checkcast_arraycopy(Node** ctrl, MergeMemNode** mem,
176                                      const TypePtr* adr_type,
177                                      Node* dest_elem_klass,
178                                      Node* src,  Node* src_offset,
179                                      Node* dest, Node* dest_offset,
180                                      Node* copy_length, bool dest_uninitialized);
181   Node* generate_generic_arraycopy(Node** ctrl, MergeMemNode** mem,
182                                    const TypePtr* adr_type,
183                                    Node* src,  Node* src_offset,
184                                    Node* dest, Node* dest_offset,
185                                    Node* copy_length, bool dest_uninitialized);
186   bool generate_unchecked_arraycopy(Node** ctrl, MergeMemNode** mem,
187                                     const TypePtr* adr_type,
188                                     BasicType basic_elem_type,
189                                     bool disjoint_bases,
190                                     Node* src,  Node* src_offset,
191                                     Node* dest, Node* dest_offset,
192                                     Node* copy_length, bool dest_uninitialized);
193   const TypePtr* adjust_for_flat_array(const TypeAryPtr* top_dest, Node*& src_offset,
194                                        Node*& dest_offset, Node*& length, BasicType& dest_elem,
195                                        Node*& dest_length);
196   void expand_arraycopy_node(ArrayCopyNode *ac);
197 
198   void expand_subtypecheck_node(SubTypeCheckNode *check);
199 
200   void expand_flatarraycheck_node(FlatArrayCheckNode* check);
201 
202   int replace_input(Node *use, Node *oldref, Node *newref);


203   Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false);
204   void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call);
205   CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call,
206                            const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1,
207                            Node* parm2);
208 
209   Node* initialize_object(AllocateNode* alloc,
210                           Node* control, Node* rawmem, Node* object,
211                           Node* klass_node, Node* length,
212                           Node* size_in_bytes);
213 
214   Node* make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset, Node* ctl, Node* mem, BasicType ft, const Type *ftype, AllocateNode *alloc);
215 
216   bool can_try_zeroing_elimination(AllocateArrayNode* alloc, Node* src, Node* dest) const;
217 
218 public:
219   PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) {
220     _igvn.set_delay_transform(true);
221   }
222   void eliminate_macro_nodes();
223   bool expand_macro_nodes();
224 
225   PhaseIterGVN &igvn() const { return _igvn; }
226 
227   // Members accessed from BarrierSetC2
228   void replace_node(Node* source, Node* target) { _igvn.replace_node(source, target); }
229   Node* intcon(jint con)        const { return _igvn.intcon(con); }
230   Node* longcon(jlong con)      const { return _igvn.longcon(con); }
231   Node* makecon(const Type *t)  const { return _igvn.makecon(t); }
232   Node* top()                   const { return C->top(); }
233 
234   Node* prefetch_allocation(Node* i_o,
235                             Node*& needgc_false, Node*& contended_phi_rawmem,
236                             Node* old_eden_top, Node* new_eden_top,
237                             intx lines);
< prev index next >