< prev index next >

src/hotspot/share/opto/macro.hpp

BarrierSetC2

20  * questions.                                                                                                                        
21  *                                                                                                                                   
22  */                                                                                                                                  
23 
24 #ifndef SHARE_VM_OPTO_MACRO_HPP                                                                                                      
25 #define SHARE_VM_OPTO_MACRO_HPP                                                                                                      
26 
27 #include "opto/phase.hpp"                                                                                                            
28 
29 class  AllocateNode;                                                                                                                 
30 class  AllocateArrayNode;                                                                                                            
31 class  CallNode;                                                                                                                     
32 class  Node;                                                                                                                         
33 class  PhaseIterGVN;                                                                                                                 
34 
35 class PhaseMacroExpand : public Phase {                                                                                              
36 private:                                                                                                                             
37   PhaseIterGVN &_igvn;                                                                                                               
38 
39   // Helper methods roughly modeled after GraphKit:                                                                                  
40   Node* top()                   const { return C->top(); }                                                                           
41   Node* intcon(jint con)        const { return _igvn.intcon(con); }                                                                  
42   Node* longcon(jlong con)      const { return _igvn.longcon(con); }                                                                 
43   Node* makecon(const Type *t)  const { return _igvn.makecon(t); }                                                                   
44   Node* basic_plus_adr(Node* base, int offset) {                                                                                     
45     return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset));                                                              
46   }                                                                                                                                  
47   Node* basic_plus_adr(Node* base, Node* ptr, int offset) {                                                                          
48     return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset));                                                          
49   }                                                                                                                                  
50   Node* basic_plus_adr(Node* base, Node* offset) {                                                                                   
51     return basic_plus_adr(base, base, offset);                                                                                       
52   }                                                                                                                                  
53   Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) {                                                                        
54     Node* adr = new AddPNode(base, ptr, offset);                                                                                     
55     return transform_later(adr);                                                                                                     
56   }                                                                                                                                  
57   Node* transform_later(Node* n) {                                                                                                   
58     // equivalent to _gvn.transform in GraphKit, Ideal, etc.                                                                         
59     _igvn.register_new_node_with_optimizer(n);                                                                                       
60     return n;                                                                                                                        
61   }                                                                                                                                  
62   void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr);                                                                  

20  * questions.
21  *
22  */
23 
24 #ifndef SHARE_VM_OPTO_MACRO_HPP
25 #define SHARE_VM_OPTO_MACRO_HPP
26 
27 #include "opto/phase.hpp"
28 
29 class  AllocateNode;
30 class  AllocateArrayNode;
31 class  CallNode;
32 class  Node;
33 class  PhaseIterGVN;
34 
35 class PhaseMacroExpand : public Phase {
36 private:
37   PhaseIterGVN &_igvn;
38 
39   // Helper methods roughly modeled after GraphKit:




40   Node* basic_plus_adr(Node* base, int offset) {
41     return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset));
42   }
43   Node* basic_plus_adr(Node* base, Node* ptr, int offset) {
44     return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset));
45   }
46   Node* basic_plus_adr(Node* base, Node* offset) {
47     return basic_plus_adr(base, base, offset);
48   }
49   Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) {
50     Node* adr = new AddPNode(base, ptr, offset);
51     return transform_later(adr);
52   }
53   Node* transform_later(Node* n) {
54     // equivalent to _gvn.transform in GraphKit, Ideal, etc.
55     _igvn.register_new_node_with_optimizer(n);
56     return n;
57   }
58   void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr);

76   ProjNode *_resproj;                                                                                                                
77 
78   // Additional data collected during macro expansion                                                                                
79   bool _has_locks;                                                                                                                   
80 
81   void expand_allocate(AllocateNode *alloc);                                                                                         
82   void expand_allocate_array(AllocateArrayNode *alloc);                                                                              
83   void expand_allocate_common(AllocateNode* alloc,                                                                                   
84                               Node* length,                                                                                          
85                               const TypeFunc* slow_call_type,                                                                        
86                               address slow_call_address);                                                                            
87   Node *value_from_mem(Node *mem, Node *ctl, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc);         
88   Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc, Node_Stack *valu
89 
90   bool eliminate_boxing_node(CallStaticJavaNode *boxing);                                                                            
91   bool eliminate_allocate_node(AllocateNode *alloc);                                                                                 
92   bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);                                   
93   bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);                                    
94   void process_users_of_allocation(CallNode *alloc);                                                                                 
95 
96   void eliminate_card_mark(Node *cm);                                                                                                
97   void mark_eliminated_box(Node* box, Node* obj);                                                                                    
98   void mark_eliminated_locking_nodes(AbstractLockNode *alock);                                                                       
99   bool eliminate_locking_node(AbstractLockNode *alock);                                                                              
100   void expand_lock_node(LockNode *lock);                                                                                             
101   void expand_unlock_node(UnlockNode *unlock);                                                                                       
102 
103   // More helper methods modeled after GraphKit for array copy                                                                       
104   void insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent = NULL);                                                  
105   Node* array_element_address(Node* ary, Node* idx, BasicType elembt);                                                               
106   Node* ConvI2L(Node* offset);                                                                                                       
107   Node* make_leaf_call(Node* ctrl, Node* mem,                                                                                        
108                        const TypeFunc* call_type, address call_addr,                                                                 
109                        const char* call_name,                                                                                        
110                        const TypePtr* adr_type,                                                                                      
111                        Node* parm0 = NULL, Node* parm1 = NULL,                                                                       
112                        Node* parm2 = NULL, Node* parm3 = NULL,                                                                       
113                        Node* parm4 = NULL, Node* parm5 = NULL,                                                                       
114                        Node* parm6 = NULL, Node* parm7 = NULL);                                                                      
115 

72   ProjNode *_resproj;
73 
74   // Additional data collected during macro expansion
75   bool _has_locks;
76 
77   void expand_allocate(AllocateNode *alloc);
78   void expand_allocate_array(AllocateArrayNode *alloc);
79   void expand_allocate_common(AllocateNode* alloc,
80                               Node* length,
81                               const TypeFunc* slow_call_type,
82                               address slow_call_address);
83   Node *value_from_mem(Node *mem, Node *ctl, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc);
84   Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc, Node_Stack *valu
85 
86   bool eliminate_boxing_node(CallStaticJavaNode *boxing);
87   bool eliminate_allocate_node(AllocateNode *alloc);
88   bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
89   bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
90   void process_users_of_allocation(CallNode *alloc);
91 
92   void eliminate_gc_barrier(Node *p2x);
93   void mark_eliminated_box(Node* box, Node* obj);
94   void mark_eliminated_locking_nodes(AbstractLockNode *alock);
95   bool eliminate_locking_node(AbstractLockNode *alock);
96   void expand_lock_node(LockNode *lock);
97   void expand_unlock_node(UnlockNode *unlock);
98 
99   // More helper methods modeled after GraphKit for array copy
100   void insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent = NULL);
101   Node* array_element_address(Node* ary, Node* idx, BasicType elembt);
102   Node* ConvI2L(Node* offset);
103   Node* make_leaf_call(Node* ctrl, Node* mem,
104                        const TypeFunc* call_type, address call_addr,
105                        const char* call_name,
106                        const TypePtr* adr_type,
107                        Node* parm0 = NULL, Node* parm1 = NULL,
108                        Node* parm2 = NULL, Node* parm3 = NULL,
109                        Node* parm4 = NULL, Node* parm5 = NULL,
110                        Node* parm6 = NULL, Node* parm7 = NULL);
111 

191 
192   Node* initialize_object(AllocateNode* alloc,                                                                                       
193                           Node* control, Node* rawmem, Node* object,                                                                 
194                           Node* klass_node, Node* length,                                                                            
195                           Node* size_in_bytes);                                                                                      
196 
197   Node* prefetch_allocation(Node* i_o,                                                                                               
198                             Node*& needgc_false, Node*& contended_phi_rawmem,                                                        
199                             Node* old_eden_top, Node* new_eden_top,                                                                  
200                             Node* length);                                                                                           
201 
202   Node* make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset, Node* ctl, Node* mem, BasicType ft, const Type *ftype, AllocateNode *
203 
204 public:                                                                                                                              
205   PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) {                                       
206     _igvn.set_delay_transform(true);                                                                                                 
207   }                                                                                                                                  
208   void eliminate_macro_nodes();                                                                                                      
209   bool expand_macro_nodes();                                                                                                         
210 
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
                                                                                                                                     
211 };                                                                                                                                   
212 
213 #endif // SHARE_VM_OPTO_MACRO_HPP                                                                                                    

187 
188   Node* initialize_object(AllocateNode* alloc,
189                           Node* control, Node* rawmem, Node* object,
190                           Node* klass_node, Node* length,
191                           Node* size_in_bytes);
192 
193   Node* prefetch_allocation(Node* i_o,
194                             Node*& needgc_false, Node*& contended_phi_rawmem,
195                             Node* old_eden_top, Node* new_eden_top,
196                             Node* length);
197 
198   Node* make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset, Node* ctl, Node* mem, BasicType ft, const Type *ftype, AllocateNode *
199 
200 public:
201   PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) {
202     _igvn.set_delay_transform(true);
203   }
204   void eliminate_macro_nodes();
205   bool expand_macro_nodes();
206 
207   // Members accessed from BarrierSetC2
208   void replace_node(Node* source, Node* target) { _igvn.replace_node(source, target); }
209   Node* intcon(jint con)        const { return _igvn.intcon(con); }
210   Node* longcon(jlong con)      const { return _igvn.longcon(con); }
211   Node* makecon(const Type *t)  const { return _igvn.makecon(t); }
212   Node* top()                   const { return C->top(); }
213 };
214 
215 #endif // SHARE_VM_OPTO_MACRO_HPP
< prev index next >