21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OPTO_MACRO_HPP
26 #define SHARE_VM_OPTO_MACRO_HPP
27
28 #include "opto/phase.hpp"
29
30 class AllocateNode;
31 class AllocateArrayNode;
32 class CallNode;
33 class Node;
34 class PhaseIterGVN;
35
36 class PhaseMacroExpand : public Phase {
37 private:
38 PhaseIterGVN &_igvn;
39
40 // Helper methods roughly modeled after GraphKit:
41 Node* top() const { return C->top(); }
42 Node* intcon(jint con) const { return _igvn.intcon(con); }
43 Node* longcon(jlong con) const { return _igvn.longcon(con); }
44 Node* makecon(const Type *t) const { return _igvn.makecon(t); }
45 Node* basic_plus_adr(Node* base, int offset) {
46 return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset));
47 }
48 Node* basic_plus_adr(Node* base, Node* ptr, int offset) {
49 return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset));
50 }
51 Node* basic_plus_adr(Node* base, Node* offset) {
52 return basic_plus_adr(base, base, offset);
53 }
54 Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) {
55 Node* adr = new AddPNode(base, ptr, offset);
56 return transform_later(adr);
57 }
58 Node* transform_later(Node* n) {
59 // equivalent to _gvn.transform in GraphKit, Ideal, etc.
60 _igvn.register_new_node_with_optimizer(n);
61 return n;
62 }
63 void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr);
64 Node* make_load( Node* ctl, Node* mem, Node* base, int offset,
77 ProjNode *_resproj;
78
79 // Additional data collected during macro expansion
80 bool _has_locks;
81
82 void expand_allocate(AllocateNode *alloc);
83 void expand_allocate_array(AllocateArrayNode *alloc);
84 void expand_allocate_common(AllocateNode* alloc,
85 Node* length,
86 const TypeFunc* slow_call_type,
87 address slow_call_address);
88 Node *value_from_mem(Node *mem, Node *ctl, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc);
89 Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc, Node_Stack *value_phis, int level);
90
91 bool eliminate_boxing_node(CallStaticJavaNode *boxing);
92 bool eliminate_allocate_node(AllocateNode *alloc);
93 bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
94 bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
95 void process_users_of_allocation(CallNode *alloc);
96
97 void eliminate_card_mark(Node *cm);
98 void mark_eliminated_box(Node* box, Node* obj);
99 void mark_eliminated_locking_nodes(AbstractLockNode *alock);
100 bool eliminate_locking_node(AbstractLockNode *alock);
101 void expand_lock_node(LockNode *lock);
102 void expand_unlock_node(UnlockNode *unlock);
103
104 // More helper methods modeled after GraphKit for array copy
105 void insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent = NULL);
106 Node* array_element_address(Node* ary, Node* idx, BasicType elembt);
107 Node* ConvI2L(Node* offset);
108 Node* make_leaf_call(Node* ctrl, Node* mem,
109 const TypeFunc* call_type, address call_addr,
110 const char* call_name,
111 const TypePtr* adr_type,
112 Node* parm0 = NULL, Node* parm1 = NULL,
113 Node* parm2 = NULL, Node* parm3 = NULL,
114 Node* parm4 = NULL, Node* parm5 = NULL,
115 Node* parm6 = NULL, Node* parm7 = NULL);
116
117 // helper methods modeled after LibraryCallKit for array copy
192
193 Node* initialize_object(AllocateNode* alloc,
194 Node* control, Node* rawmem, Node* object,
195 Node* klass_node, Node* length,
196 Node* size_in_bytes);
197
198 Node* prefetch_allocation(Node* i_o,
199 Node*& needgc_false, Node*& contended_phi_rawmem,
200 Node* old_eden_top, Node* new_eden_top,
201 Node* length);
202
203 Node* make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset, Node* ctl, Node* mem, BasicType ft, const Type *ftype, AllocateNode *alloc);
204
205 public:
206 PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) {
207 _igvn.set_delay_transform(true);
208 }
209 void eliminate_macro_nodes();
210 bool expand_macro_nodes();
211
212 };
213
214 #endif // SHARE_VM_OPTO_MACRO_HPP
|
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OPTO_MACRO_HPP
26 #define SHARE_VM_OPTO_MACRO_HPP
27
28 #include "opto/phase.hpp"
29
30 class AllocateNode;
31 class AllocateArrayNode;
32 class CallNode;
33 class Node;
34 class PhaseIterGVN;
35
36 class PhaseMacroExpand : public Phase {
37 private:
38 PhaseIterGVN &_igvn;
39
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,
73 ProjNode *_resproj;
74
75 // Additional data collected during macro expansion
76 bool _has_locks;
77
78 void expand_allocate(AllocateNode *alloc);
79 void expand_allocate_array(AllocateArrayNode *alloc);
80 void expand_allocate_common(AllocateNode* alloc,
81 Node* length,
82 const TypeFunc* slow_call_type,
83 address slow_call_address);
84 Node *value_from_mem(Node *mem, Node *ctl, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc);
85 Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc, Node_Stack *value_phis, int level);
86
87 bool eliminate_boxing_node(CallStaticJavaNode *boxing);
88 bool eliminate_allocate_node(AllocateNode *alloc);
89 bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints);
90 bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done);
91 void process_users_of_allocation(CallNode *alloc);
92
93 void eliminate_gc_barrier(Node *p2x);
94 void mark_eliminated_box(Node* box, Node* obj);
95 void mark_eliminated_locking_nodes(AbstractLockNode *alock);
96 bool eliminate_locking_node(AbstractLockNode *alock);
97 void expand_lock_node(LockNode *lock);
98 void expand_unlock_node(UnlockNode *unlock);
99
100 // More helper methods modeled after GraphKit for array copy
101 void insert_mem_bar(Node** ctrl, Node** mem, int opcode, Node* precedent = NULL);
102 Node* array_element_address(Node* ary, Node* idx, BasicType elembt);
103 Node* ConvI2L(Node* offset);
104 Node* make_leaf_call(Node* ctrl, Node* mem,
105 const TypeFunc* call_type, address call_addr,
106 const char* call_name,
107 const TypePtr* adr_type,
108 Node* parm0 = NULL, Node* parm1 = NULL,
109 Node* parm2 = NULL, Node* parm3 = NULL,
110 Node* parm4 = NULL, Node* parm5 = NULL,
111 Node* parm6 = NULL, Node* parm7 = NULL);
112
113 // helper methods modeled after LibraryCallKit for array copy
188
189 Node* initialize_object(AllocateNode* alloc,
190 Node* control, Node* rawmem, Node* object,
191 Node* klass_node, Node* length,
192 Node* size_in_bytes);
193
194 Node* prefetch_allocation(Node* i_o,
195 Node*& needgc_false, Node*& contended_phi_rawmem,
196 Node* old_eden_top, Node* new_eden_top,
197 Node* length);
198
199 Node* make_arraycopy_load(ArrayCopyNode* ac, intptr_t offset, Node* ctl, Node* mem, BasicType ft, const Type *ftype, AllocateNode *alloc);
200
201 public:
202 PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) {
203 _igvn.set_delay_transform(true);
204 }
205 void eliminate_macro_nodes();
206 bool expand_macro_nodes();
207
208 // Members accessed from C2BarrierSetCodeGen
209 void replace_node(Node* source, Node* target) { _igvn.replace_node(source, target); }
210 Node* intcon(jint con) const { return _igvn.intcon(con); }
211 Node* longcon(jlong con) const { return _igvn.longcon(con); }
212 Node* makecon(const Type *t) const { return _igvn.makecon(t); }
213 Node* top() const { return C->top(); }
214 };
215
216 #endif // SHARE_VM_OPTO_MACRO_HPP
|