author | iveresov |
Thu, 22 Jan 2015 11:25:23 -0800 | |
changeset 28723 | 0a36120cb225 |
parent 26166 | 4b49fd58bbd9 |
child 30244 | d4e471395ff5 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
22234
da823d78ad65
8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents:
17383
diff
changeset
|
2 |
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1500
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1500
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1500
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#ifndef SHARE_VM_OPTO_MACRO_HPP |
26 |
#define SHARE_VM_OPTO_MACRO_HPP |
|
27 |
||
28 |
#include "opto/phase.hpp" |
|
29 |
||
1 | 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 |
||
26166 | 40 |
// Helper methods roughly modeled after GraphKit: |
1 | 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) { |
|
24923
9631f7d691dc
8034812: remove IDX_INIT macro hack in Node class
thartmann
parents:
23491
diff
changeset
|
55 |
Node* adr = new AddPNode(base, ptr, offset); |
1 | 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, |
|
65 |
const Type* value_type, BasicType bt); |
|
66 |
Node* make_store(Node* ctl, Node* mem, Node* base, int offset, |
|
67 |
Node* value, BasicType bt); |
|
68 |
||
69 |
// projections extracted from a call node |
|
70 |
ProjNode *_fallthroughproj; |
|
71 |
ProjNode *_fallthroughcatchproj; |
|
72 |
ProjNode *_ioproj_fallthrough; |
|
73 |
ProjNode *_ioproj_catchall; |
|
74 |
ProjNode *_catchallcatchproj; |
|
75 |
ProjNode *_memproj_fallthrough; |
|
76 |
ProjNode *_memproj_catchall; |
|
77 |
ProjNode *_resproj; |
|
78 |
||
23491 | 79 |
// Additional data collected during macro expansion |
80 |
bool _has_locks; |
|
1 | 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); |
|
246
b029af7e69d3
6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents:
239
diff
changeset
|
88 |
Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc); |
955 | 89 |
Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, Node_Stack *value_phis, int level); |
246
b029af7e69d3
6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents:
239
diff
changeset
|
90 |
|
17383 | 91 |
bool eliminate_boxing_node(CallStaticJavaNode *boxing); |
246
b029af7e69d3
6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents:
239
diff
changeset
|
92 |
bool eliminate_allocate_node(AllocateNode *alloc); |
b029af7e69d3
6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents:
239
diff
changeset
|
93 |
bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints); |
b029af7e69d3
6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents:
239
diff
changeset
|
94 |
bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done); |
17383 | 95 |
void process_users_of_allocation(CallNode *alloc); |
246
b029af7e69d3
6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents:
239
diff
changeset
|
96 |
|
b029af7e69d3
6259129: (Escape Analysis) scalar replacement for not escaping objects
kvn
parents:
239
diff
changeset
|
97 |
void eliminate_card_mark(Node *cm); |
11445 | 98 |
void mark_eliminated_box(Node* box, Node* obj); |
9977
c23d1a8dcaa9
7050280: assert(u->as_Unlock()->is_eliminated()) failed: sanity
kvn
parents:
7397
diff
changeset
|
99 |
void mark_eliminated_locking_nodes(AbstractLockNode *alock); |
239
fb31825d5444
6672848: (Escape Analysis) improve lock elimination with EA
kvn
parents:
1
diff
changeset
|
100 |
bool eliminate_locking_node(AbstractLockNode *alock); |
1 | 101 |
void expand_lock_node(LockNode *lock); |
102 |
void expand_unlock_node(UnlockNode *unlock); |
|
103 |
||
26166 | 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 |
|
118 |
Node* generate_guard(Node** ctrl, Node* test, RegionNode* region, float true_prob); |
|
119 |
Node* generate_slow_guard(Node** ctrl, Node* test, RegionNode* region); |
|
120 |
void generate_negative_guard(Node** ctrl, Node* index, RegionNode* region); |
|
121 |
void generate_limit_guard(Node** ctrl, Node* offset, Node* subseq_length, Node* array_length, RegionNode* region); |
|
122 |
||
123 |
// More helper methods for array copy |
|
124 |
Node* generate_nonpositive_guard(Node** ctrl, Node* index, bool never_negative); |
|
125 |
void finish_arraycopy_call(Node* call, Node** ctrl, MergeMemNode** mem, const TypePtr* adr_type); |
|
126 |
address basictype2arraycopy(BasicType t, |
|
127 |
Node* src_offset, |
|
128 |
Node* dest_offset, |
|
129 |
bool disjoint_bases, |
|
130 |
const char* &name, |
|
131 |
bool dest_uninitialized); |
|
132 |
Node* generate_arraycopy(ArrayCopyNode *ac, |
|
133 |
AllocateArrayNode* alloc, |
|
134 |
Node** ctrl, MergeMemNode* mem, Node** io, |
|
135 |
const TypePtr* adr_type, |
|
136 |
BasicType basic_elem_type, |
|
137 |
Node* src, Node* src_offset, |
|
138 |
Node* dest, Node* dest_offset, |
|
139 |
Node* copy_length, |
|
140 |
bool disjoint_bases = false, |
|
141 |
bool length_never_negative = false, |
|
142 |
RegionNode* slow_region = NULL); |
|
143 |
void generate_clear_array(Node* ctrl, MergeMemNode* merge_mem, |
|
144 |
const TypePtr* adr_type, |
|
145 |
Node* dest, |
|
146 |
BasicType basic_elem_type, |
|
147 |
Node* slice_idx, |
|
148 |
Node* slice_len, |
|
149 |
Node* dest_size); |
|
150 |
bool generate_block_arraycopy(Node** ctrl, MergeMemNode** mem, Node* io, |
|
151 |
const TypePtr* adr_type, |
|
152 |
BasicType basic_elem_type, |
|
153 |
AllocateNode* alloc, |
|
154 |
Node* src, Node* src_offset, |
|
155 |
Node* dest, Node* dest_offset, |
|
156 |
Node* dest_size, bool dest_uninitialized); |
|
157 |
MergeMemNode* generate_slow_arraycopy(ArrayCopyNode *ac, |
|
158 |
Node** ctrl, Node* mem, Node** io, |
|
159 |
const TypePtr* adr_type, |
|
160 |
Node* src, Node* src_offset, |
|
161 |
Node* dest, Node* dest_offset, |
|
162 |
Node* copy_length, bool dest_uninitialized); |
|
163 |
Node* generate_checkcast_arraycopy(Node** ctrl, MergeMemNode** mem, |
|
164 |
const TypePtr* adr_type, |
|
165 |
Node* dest_elem_klass, |
|
166 |
Node* src, Node* src_offset, |
|
167 |
Node* dest, Node* dest_offset, |
|
168 |
Node* copy_length, bool dest_uninitialized); |
|
169 |
Node* generate_generic_arraycopy(Node** ctrl, MergeMemNode** mem, |
|
170 |
const TypePtr* adr_type, |
|
171 |
Node* src, Node* src_offset, |
|
172 |
Node* dest, Node* dest_offset, |
|
173 |
Node* copy_length, bool dest_uninitialized); |
|
174 |
void generate_unchecked_arraycopy(Node** ctrl, MergeMemNode** mem, |
|
175 |
const TypePtr* adr_type, |
|
176 |
BasicType basic_elem_type, |
|
177 |
bool disjoint_bases, |
|
178 |
Node* src, Node* src_offset, |
|
179 |
Node* dest, Node* dest_offset, |
|
180 |
Node* copy_length, bool dest_uninitialized); |
|
181 |
||
182 |
void expand_arraycopy_node(ArrayCopyNode *ac); |
|
183 |
||
1 | 184 |
int replace_input(Node *use, Node *oldref, Node *newref); |
185 |
void copy_call_debug_info(CallNode *oldcall, CallNode * newcall); |
|
1500
bea9a90f3e8f
6462850: generate biased locking code in C2 ideal graph
kvn
parents:
955
diff
changeset
|
186 |
Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false); |
1 | 187 |
void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call); |
188 |
CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call, |
|
189 |
const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1); |
|
190 |
void extract_call_projections(CallNode *call); |
|
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 |
public: |
|
23491 | 203 |
PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn), _has_locks(false) { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
246
diff
changeset
|
204 |
_igvn.set_delay_transform(true); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
246
diff
changeset
|
205 |
} |
11191 | 206 |
void eliminate_macro_nodes(); |
1 | 207 |
bool expand_macro_nodes(); |
208 |
||
209 |
}; |
|
7397 | 210 |
|
211 |
#endif // SHARE_VM_OPTO_MACRO_HPP |