< prev index next >

src/hotspot/share/opto/macro.hpp

BarrierSetC2_enhancements

BarrierSetC2

19  * or visit www.oracle.com if you need additional information or have any                                                            
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);                                                                  
63   Node* make_load( Node* ctl, Node* mem, Node* base, int offset,                                                                     
64                    const Type* value_type, BasicType bt);                                                                            
65   Node* make_store(Node* ctl, Node* mem, Node* base, int offset,                                                                     
66                    Node* value, BasicType bt);                                                                                       
67 
                                                                                                                                     
68   // projections extracted from a call node                                                                                          
69   ProjNode *_fallthroughproj;                                                                                                        
70   ProjNode *_fallthroughcatchproj;                                                                                                   
71   ProjNode *_ioproj_fallthrough;                                                                                                     
72   ProjNode *_ioproj_catchall;                                                                                                        
73   ProjNode *_catchallcatchproj;                                                                                                      
74   ProjNode *_memproj_fallthrough;                                                                                                    
75   ProjNode *_memproj_catchall;                                                                                                       
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 

19  * or visit www.oracle.com if you need additional information or have any
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 public:
40   // Helper methods roughly modeled after GraphKit:




41   Node* basic_plus_adr(Node* base, int offset) {
42     return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset));
43   }
44   Node* basic_plus_adr(Node* base, Node* ptr, int offset) {
45     return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset));
46   }
47   Node* basic_plus_adr(Node* base, Node* offset) {
48     return basic_plus_adr(base, base, offset);
49   }
50   Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) {
51     Node* adr = new AddPNode(base, ptr, offset);
52     return transform_later(adr);
53   }
54   Node* transform_later(Node* n) {
55     // equivalent to _gvn.transform in GraphKit, Ideal, etc.
56     _igvn.register_new_node_with_optimizer(n);
57     return n;
58   }
59   void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr);
60   Node* make_load( Node* ctl, Node* mem, Node* base, int offset,
61                    const Type* value_type, BasicType bt);
62   Node* make_store(Node* ctl, Node* mem, Node* base, int offset,
63                    Node* value, BasicType bt);
64 
65 private:
66   // projections extracted from a call node
67   ProjNode *_fallthroughproj;
68   ProjNode *_fallthroughcatchproj;
69   ProjNode *_ioproj_fallthrough;
70   ProjNode *_ioproj_catchall;
71   ProjNode *_catchallcatchproj;
72   ProjNode *_memproj_fallthrough;
73   ProjNode *_memproj_catchall;
74   ProjNode *_resproj;
75 
76   // Additional data collected during macro expansion
77   bool _has_locks;
78 
79   void expand_allocate(AllocateNode *alloc);
80   void expand_allocate_array(AllocateArrayNode *alloc);
81   void expand_allocate_common(AllocateNode* alloc,
82                               Node* length,
83                               const TypeFunc* slow_call_type,
84                               address slow_call_address);
85   Node *value_from_mem(Node *mem, Node *ctl, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc);
86   Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc, Node_Stack *valu
87 
88   bool eliminate_boxing_node(CallStaticJavaNode *boxing);
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(CallNode *alloc);
93 
94   void eliminate_gc_barrier(Node *p2x);
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   // More helper methods modeled after GraphKit for array copy
102   void insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent = NULL);
103   Node* array_element_address(Node* ary, Node* idx, BasicType elembt);
104   Node* ConvI2L(Node* offset);
105   Node* make_leaf_call(Node* ctrl, Node* mem,
106                        const TypeFunc* call_type, address call_addr,
107                        const char* call_name,
108                        const TypePtr* adr_type,
109                        Node* parm0 = NULL, Node* parm1 = NULL,
110                        Node* parm2 = NULL, Node* parm3 = NULL,
111                        Node* parm4 = NULL, Node* parm5 = NULL,
112                        Node* parm6 = NULL, Node* parm7 = NULL);
113 

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                                                                                                    

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