Mercurial > hg > truffle
annotate src/share/vm/ci/bcEscapeAnalyzer.cpp @ 6266:1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
6984705: JSR 292 method handle creation should not go through JNI
Summary: remove assembly code for JDK 7 chained method handles
Reviewed-by: jrose, twisti, kvn, mhaupt
Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>
author | twisti |
---|---|
date | Tue, 24 Jul 2012 10:51:00 -0700 |
parents | 5ed8f599a788 |
children | 7f813940ac35 |
rev | line source |
---|---|
0 | 1 /* |
4869
5ed8f599a788
7140924: SIGSEGV in compiled code for sun.awt.X11.XDecoratedPeer.updateMinSizeHints
kvn
parents:
4122
diff
changeset
|
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 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 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1397
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1397
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1397
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "ci/bcEscapeAnalyzer.hpp" | |
27 #include "ci/ciConstant.hpp" | |
28 #include "ci/ciField.hpp" | |
29 #include "ci/ciMethodBlocks.hpp" | |
30 #include "ci/ciStreams.hpp" | |
31 #include "interpreter/bytecode.hpp" | |
32 #include "utilities/bitMap.inline.hpp" | |
0 | 33 |
34 | |
35 | |
36 #ifndef PRODUCT | |
37 #define TRACE_BCEA(level, code) \ | |
38 if (EstimateArgEscape && BCEATraceLevel >= level) { \ | |
39 code; \ | |
40 } | |
41 #else | |
42 #define TRACE_BCEA(level, code) | |
43 #endif | |
44 | |
45 // Maintain a map of which aguments a local variable or | |
46 // stack slot may contain. In addition to tracking | |
47 // arguments, it tracks two special values, "allocated" | |
48 // which represents any object allocated in the current | |
49 // method, and "unknown" which is any other object. | |
50 // Up to 30 arguments are handled, with the last one | |
51 // representing summary information for any extra arguments | |
52 class BCEscapeAnalyzer::ArgumentMap { | |
53 uint _bits; | |
54 enum {MAXBIT = 29, | |
55 ALLOCATED = 1, | |
56 UNKNOWN = 2}; | |
57 | |
58 uint int_to_bit(uint e) const { | |
59 if (e > MAXBIT) | |
60 e = MAXBIT; | |
61 return (1 << (e + 2)); | |
62 } | |
63 | |
64 public: | |
65 ArgumentMap() { _bits = 0;} | |
66 void set_bits(uint bits) { _bits = bits;} | |
67 uint get_bits() const { return _bits;} | |
68 void clear() { _bits = 0;} | |
69 void set_all() { _bits = ~0u; } | |
70 bool is_empty() const { return _bits == 0; } | |
71 bool contains(uint var) const { return (_bits & int_to_bit(var)) != 0; } | |
72 bool is_singleton(uint var) const { return (_bits == int_to_bit(var)); } | |
73 bool contains_unknown() const { return (_bits & UNKNOWN) != 0; } | |
74 bool contains_allocated() const { return (_bits & ALLOCATED) != 0; } | |
75 bool contains_vars() const { return (_bits & (((1 << MAXBIT) -1) << 2)) != 0; } | |
76 void set(uint var) { _bits = int_to_bit(var); } | |
77 void add(uint var) { _bits |= int_to_bit(var); } | |
78 void add_unknown() { _bits = UNKNOWN; } | |
79 void add_allocated() { _bits = ALLOCATED; } | |
80 void set_union(const ArgumentMap &am) { _bits |= am._bits; } | |
81 void set_intersect(const ArgumentMap &am) { _bits |= am._bits; } | |
82 void set_difference(const ArgumentMap &am) { _bits &= ~am._bits; } | |
83 void operator=(const ArgumentMap &am) { _bits = am._bits; } | |
84 bool operator==(const ArgumentMap &am) { return _bits == am._bits; } | |
85 bool operator!=(const ArgumentMap &am) { return _bits != am._bits; } | |
86 }; | |
87 | |
88 class BCEscapeAnalyzer::StateInfo { | |
89 public: | |
90 ArgumentMap *_vars; | |
91 ArgumentMap *_stack; | |
92 short _stack_height; | |
93 short _max_stack; | |
94 bool _initialized; | |
95 ArgumentMap empty_map; | |
96 | |
97 StateInfo() { | |
98 empty_map.clear(); | |
99 } | |
100 | |
1747
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
101 ArgumentMap raw_pop() { guarantee(_stack_height > 0, "stack underflow"); return _stack[--_stack_height]; } |
0 | 102 ArgumentMap apop() { return raw_pop(); } |
103 void spop() { raw_pop(); } | |
104 void lpop() { spop(); spop(); } | |
1747
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
105 void raw_push(ArgumentMap i) { guarantee(_stack_height < _max_stack, "stack overflow"); _stack[_stack_height++] = i; } |
0 | 106 void apush(ArgumentMap i) { raw_push(i); } |
107 void spush() { raw_push(empty_map); } | |
108 void lpush() { spush(); spush(); } | |
109 | |
110 }; | |
111 | |
112 void BCEscapeAnalyzer::set_returned(ArgumentMap vars) { | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
113 for (int i = 0; i < _arg_size; i++) { |
0 | 114 if (vars.contains(i)) |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
115 _arg_returned.set(i); |
0 | 116 } |
117 _return_local = _return_local && !(vars.contains_unknown() || vars.contains_allocated()); | |
118 _return_allocated = _return_allocated && vars.contains_allocated() && !(vars.contains_unknown() || vars.contains_vars()); | |
119 } | |
120 | |
121 // return true if any element of vars is an argument | |
122 bool BCEscapeAnalyzer::is_argument(ArgumentMap vars) { | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
123 for (int i = 0; i < _arg_size; i++) { |
0 | 124 if (vars.contains(i)) |
125 return true; | |
126 } | |
127 return false; | |
128 } | |
129 | |
130 // return true if any element of vars is an arg_stack argument | |
131 bool BCEscapeAnalyzer::is_arg_stack(ArgumentMap vars){ | |
132 if (_conservative) | |
133 return true; | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
134 for (int i = 0; i < _arg_size; i++) { |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
135 if (vars.contains(i) && _arg_stack.test(i)) |
0 | 136 return true; |
137 } | |
138 return false; | |
139 } | |
140 | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
141 void BCEscapeAnalyzer::clear_bits(ArgumentMap vars, VectorSet &bm) { |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
142 for (int i = 0; i < _arg_size; i++) { |
0 | 143 if (vars.contains(i)) { |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
144 bm >>= i; |
0 | 145 } |
146 } | |
147 } | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
148 |
0 | 149 void BCEscapeAnalyzer::set_method_escape(ArgumentMap vars) { |
150 clear_bits(vars, _arg_local); | |
151 } | |
152 | |
4122
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
153 void BCEscapeAnalyzer::set_global_escape(ArgumentMap vars, bool merge) { |
0 | 154 clear_bits(vars, _arg_local); |
155 clear_bits(vars, _arg_stack); | |
156 if (vars.contains_allocated()) | |
157 _allocated_escapes = true; | |
4122
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
158 |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
159 if (merge && !vars.is_empty()) { |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
160 // Merge new state into already processed block. |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
161 // New state is not taken into account and |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
162 // it may invalidate set_returned() result. |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
163 if (vars.contains_unknown() || vars.contains_allocated()) { |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
164 _return_local = false; |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
165 } |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
166 if (vars.contains_unknown() || vars.contains_vars()) { |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
167 _return_allocated = false; |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
168 } |
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
169 } |
0 | 170 } |
171 | |
172 void BCEscapeAnalyzer::set_dirty(ArgumentMap vars) { | |
173 clear_bits(vars, _dirty); | |
174 } | |
175 | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
176 void BCEscapeAnalyzer::set_modified(ArgumentMap vars, int offs, int size) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
177 |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
178 for (int i = 0; i < _arg_size; i++) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
179 if (vars.contains(i)) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
180 set_arg_modified(i, offs, size); |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
181 } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
182 } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
183 if (vars.contains_unknown()) |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
184 _unknown_modified = true; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
185 } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
186 |
0 | 187 bool BCEscapeAnalyzer::is_recursive_call(ciMethod* callee) { |
188 for (BCEscapeAnalyzer* scope = this; scope != NULL; scope = scope->_parent) { | |
189 if (scope->method() == callee) { | |
190 return true; | |
191 } | |
192 } | |
193 return false; | |
194 } | |
195 | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
196 bool BCEscapeAnalyzer::is_arg_modified(int arg, int offset, int size_in_bytes) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
197 if (offset == OFFSET_ANY) |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
198 return _arg_modified[arg] != 0; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
199 assert(arg >= 0 && arg < _arg_size, "must be an argument."); |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
200 bool modified = false; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
201 int l = offset / HeapWordSize; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
202 int h = round_to(offset + size_in_bytes, HeapWordSize) / HeapWordSize; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
203 if (l > ARG_OFFSET_MAX) |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
204 l = ARG_OFFSET_MAX; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
205 if (h > ARG_OFFSET_MAX+1) |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
206 h = ARG_OFFSET_MAX + 1; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
207 for (int i = l; i < h; i++) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
208 modified = modified || (_arg_modified[arg] & (1 << i)) != 0; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
209 } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
210 return modified; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
211 } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
212 |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
213 void BCEscapeAnalyzer::set_arg_modified(int arg, int offset, int size_in_bytes) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
214 if (offset == OFFSET_ANY) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
215 _arg_modified[arg] = (uint) -1; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
216 return; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
217 } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
218 assert(arg >= 0 && arg < _arg_size, "must be an argument."); |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
219 int l = offset / HeapWordSize; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
220 int h = round_to(offset + size_in_bytes, HeapWordSize) / HeapWordSize; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
221 if (l > ARG_OFFSET_MAX) |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
222 l = ARG_OFFSET_MAX; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
223 if (h > ARG_OFFSET_MAX+1) |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
224 h = ARG_OFFSET_MAX + 1; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
225 for (int i = l; i < h; i++) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
226 _arg_modified[arg] |= (1 << i); |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
227 } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
228 } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
229 |
0 | 230 void BCEscapeAnalyzer::invoke(StateInfo &state, Bytecodes::Code code, ciMethod* target, ciKlass* holder) { |
231 int i; | |
232 | |
233 // retrieve information about the callee | |
234 ciInstanceKlass* klass = target->holder(); | |
235 ciInstanceKlass* calling_klass = method()->holder(); | |
236 ciInstanceKlass* callee_holder = ciEnv::get_instance_klass_for_declared_method_holder(holder); | |
237 ciInstanceKlass* actual_recv = callee_holder; | |
238 | |
154
09c2ba680204
6700102: c2 assertion "counter_changed,"failed dependencies, but counter didn't change")" with AggressiveOpts
kvn
parents:
78
diff
changeset
|
239 // some methods are obviously bindable without any type checks so |
09c2ba680204
6700102: c2 assertion "counter_changed,"failed dependencies, but counter didn't change")" with AggressiveOpts
kvn
parents:
78
diff
changeset
|
240 // convert them directly to an invokespecial. |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
241 if (target->is_loaded() && !target->is_abstract() && target->can_be_statically_bound()) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
242 switch (code) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
243 case Bytecodes::_invokevirtual: code = Bytecodes::_invokespecial; break; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
244 case Bytecodes::_invokehandle: code = Bytecodes::_invokestatic; break; |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
245 } |
154
09c2ba680204
6700102: c2 assertion "counter_changed,"failed dependencies, but counter didn't change")" with AggressiveOpts
kvn
parents:
78
diff
changeset
|
246 } |
09c2ba680204
6700102: c2 assertion "counter_changed,"failed dependencies, but counter didn't change")" with AggressiveOpts
kvn
parents:
78
diff
changeset
|
247 |
0 | 248 // compute size of arguments |
3280
548597e74aa4
7030715: JSR 292 JRuby test/test_super_call_site_caching.rb asserts with +DoEscapeAnalysis
never
parents:
2165
diff
changeset
|
249 int arg_size = target->invoke_arg_size(code); |
0 | 250 int arg_base = MAX2(state._stack_height - arg_size, 0); |
251 | |
252 // direct recursive calls are skipped if they can be bound statically without introducing | |
253 // dependencies and if parameters are passed at the same position as in the current method | |
254 // other calls are skipped if there are no unescaped arguments passed to them | |
255 bool directly_recursive = (method() == target) && | |
256 (code != Bytecodes::_invokevirtual || target->is_final_method() || state._stack[arg_base] .is_empty()); | |
257 | |
258 // check if analysis of callee can safely be skipped | |
259 bool skip_callee = true; | |
260 for (i = state._stack_height - 1; i >= arg_base && skip_callee; i--) { | |
261 ArgumentMap arg = state._stack[i]; | |
262 skip_callee = !is_argument(arg) || !is_arg_stack(arg) || (directly_recursive && arg.is_singleton(i - arg_base)); | |
263 } | |
2164
bb2c2878f134
7011839: JSR 292 turn on escape analysis when using invokedynamic
twisti
parents:
1972
diff
changeset
|
264 // For now we conservatively skip invokedynamic. |
bb2c2878f134
7011839: JSR 292 turn on escape analysis when using invokedynamic
twisti
parents:
1972
diff
changeset
|
265 if (code == Bytecodes::_invokedynamic) { |
bb2c2878f134
7011839: JSR 292 turn on escape analysis when using invokedynamic
twisti
parents:
1972
diff
changeset
|
266 skip_callee = true; |
bb2c2878f134
7011839: JSR 292 turn on escape analysis when using invokedynamic
twisti
parents:
1972
diff
changeset
|
267 } |
0 | 268 if (skip_callee) { |
269 TRACE_BCEA(3, tty->print_cr("[EA] skipping method %s::%s", holder->name()->as_utf8(), target->name()->as_utf8())); | |
270 for (i = 0; i < arg_size; i++) { | |
271 set_method_escape(state.raw_pop()); | |
272 } | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
273 _unknown_modified = true; // assume the worst since we don't analyze the called method |
0 | 274 return; |
275 } | |
276 | |
277 // determine actual method (use CHA if necessary) | |
278 ciMethod* inline_target = NULL; | |
279 if (target->is_loaded() && klass->is_loaded() | |
280 && (klass->is_initialized() || klass->is_interface() && target->holder()->is_initialized()) | |
281 && target->will_link(klass, callee_holder, code)) { | |
282 if (code == Bytecodes::_invokestatic | |
283 || code == Bytecodes::_invokespecial | |
284 || code == Bytecodes::_invokevirtual && target->is_final_method()) { | |
285 inline_target = target; | |
286 } else { | |
287 inline_target = target->find_monomorphic_target(calling_klass, callee_holder, actual_recv); | |
288 } | |
289 } | |
290 | |
291 if (inline_target != NULL && !is_recursive_call(inline_target)) { | |
292 // analyze callee | |
293 BCEscapeAnalyzer analyzer(inline_target, this); | |
294 | |
295 // adjust escape state of actual parameters | |
296 bool must_record_dependencies = false; | |
297 for (i = arg_size - 1; i >= 0; i--) { | |
298 ArgumentMap arg = state.raw_pop(); | |
299 if (!is_argument(arg)) | |
300 continue; | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
301 for (int j = 0; j < _arg_size; j++) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
302 if (arg.contains(j)) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
303 _arg_modified[j] |= analyzer._arg_modified[i]; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
304 } |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
305 } |
0 | 306 if (!is_arg_stack(arg)) { |
307 // arguments have already been recognized as escaping | |
308 } else if (analyzer.is_arg_stack(i) && !analyzer.is_arg_returned(i)) { | |
309 set_method_escape(arg); | |
310 must_record_dependencies = true; | |
311 } else { | |
312 set_global_escape(arg); | |
313 } | |
314 } | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
315 _unknown_modified = _unknown_modified || analyzer.has_non_arg_side_affects(); |
0 | 316 |
317 // record dependencies if at least one parameter retained stack-allocatable | |
318 if (must_record_dependencies) { | |
319 if (code == Bytecodes::_invokeinterface || code == Bytecodes::_invokevirtual && !target->is_final_method()) { | |
320 _dependencies.append(actual_recv); | |
321 _dependencies.append(inline_target); | |
322 } | |
323 _dependencies.appendAll(analyzer.dependencies()); | |
324 } | |
325 } else { | |
326 TRACE_BCEA(1, tty->print_cr("[EA] virtual method %s is not monomorphic.", | |
327 target->name()->as_utf8())); | |
328 // conservatively mark all actual parameters as escaping globally | |
329 for (i = 0; i < arg_size; i++) { | |
330 ArgumentMap arg = state.raw_pop(); | |
331 if (!is_argument(arg)) | |
332 continue; | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
333 set_modified(arg, OFFSET_ANY, type2size[T_INT]*HeapWordSize); |
0 | 334 set_global_escape(arg); |
335 } | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
336 _unknown_modified = true; // assume the worst since we don't know the called method |
0 | 337 } |
338 } | |
339 | |
340 bool BCEscapeAnalyzer::contains(uint arg_set1, uint arg_set2) { | |
341 return ((~arg_set1) | arg_set2) == 0; | |
342 } | |
343 | |
344 | |
345 void BCEscapeAnalyzer::iterate_one_block(ciBlock *blk, StateInfo &state, GrowableArray<ciBlock *> &successors) { | |
346 | |
347 blk->set_processed(); | |
348 ciBytecodeStream s(method()); | |
349 int limit_bci = blk->limit_bci(); | |
350 bool fall_through = false; | |
351 ArgumentMap allocated_obj; | |
352 allocated_obj.add_allocated(); | |
353 ArgumentMap unknown_obj; | |
354 unknown_obj.add_unknown(); | |
355 ArgumentMap empty_map; | |
356 | |
357 s.reset_to_bci(blk->start_bci()); | |
358 while (s.next() != ciBytecodeStream::EOBC() && s.cur_bci() < limit_bci) { | |
359 fall_through = true; | |
360 switch (s.cur_bc()) { | |
361 case Bytecodes::_nop: | |
362 break; | |
363 case Bytecodes::_aconst_null: | |
4869
5ed8f599a788
7140924: SIGSEGV in compiled code for sun.awt.X11.XDecoratedPeer.updateMinSizeHints
kvn
parents:
4122
diff
changeset
|
364 state.apush(unknown_obj); |
0 | 365 break; |
366 case Bytecodes::_iconst_m1: | |
367 case Bytecodes::_iconst_0: | |
368 case Bytecodes::_iconst_1: | |
369 case Bytecodes::_iconst_2: | |
370 case Bytecodes::_iconst_3: | |
371 case Bytecodes::_iconst_4: | |
372 case Bytecodes::_iconst_5: | |
373 case Bytecodes::_fconst_0: | |
374 case Bytecodes::_fconst_1: | |
375 case Bytecodes::_fconst_2: | |
376 case Bytecodes::_bipush: | |
377 case Bytecodes::_sipush: | |
378 state.spush(); | |
379 break; | |
380 case Bytecodes::_lconst_0: | |
381 case Bytecodes::_lconst_1: | |
382 case Bytecodes::_dconst_0: | |
383 case Bytecodes::_dconst_1: | |
384 state.lpush(); | |
385 break; | |
386 case Bytecodes::_ldc: | |
387 case Bytecodes::_ldc_w: | |
388 case Bytecodes::_ldc2_w: | |
1747
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
389 { |
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
390 // Avoid calling get_constant() which will try to allocate |
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
391 // unloaded constant. We need only constant's type. |
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
392 int index = s.get_constant_pool_index(); |
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
393 constantTag tag = s.get_constant_pool_tag(index); |
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
394 if (tag.is_long() || tag.is_double()) { |
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
395 // Only longs and doubles use 2 stack slots. |
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
396 state.lpush(); |
4869
5ed8f599a788
7140924: SIGSEGV in compiled code for sun.awt.X11.XDecoratedPeer.updateMinSizeHints
kvn
parents:
4122
diff
changeset
|
397 } else if (tag.basic_type() == T_OBJECT) { |
5ed8f599a788
7140924: SIGSEGV in compiled code for sun.awt.X11.XDecoratedPeer.updateMinSizeHints
kvn
parents:
4122
diff
changeset
|
398 state.apush(unknown_obj); |
1747
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
399 } else { |
0 | 400 state.spush(); |
401 } | |
402 break; | |
1747
53dbe853fb3a
6896381: CTW fails share/vm/ci/bcEscapeAnalyzer.cpp:99, assert(_stack_height < _max_stack,"stack overflow")
kvn
parents:
1648
diff
changeset
|
403 } |
0 | 404 case Bytecodes::_aload: |
405 state.apush(state._vars[s.get_index()]); | |
406 break; | |
407 case Bytecodes::_iload: | |
408 case Bytecodes::_fload: | |
409 case Bytecodes::_iload_0: | |
410 case Bytecodes::_iload_1: | |
411 case Bytecodes::_iload_2: | |
412 case Bytecodes::_iload_3: | |
413 case Bytecodes::_fload_0: | |
414 case Bytecodes::_fload_1: | |
415 case Bytecodes::_fload_2: | |
416 case Bytecodes::_fload_3: | |
417 state.spush(); | |
418 break; | |
419 case Bytecodes::_lload: | |
420 case Bytecodes::_dload: | |
421 case Bytecodes::_lload_0: | |
422 case Bytecodes::_lload_1: | |
423 case Bytecodes::_lload_2: | |
424 case Bytecodes::_lload_3: | |
425 case Bytecodes::_dload_0: | |
426 case Bytecodes::_dload_1: | |
427 case Bytecodes::_dload_2: | |
428 case Bytecodes::_dload_3: | |
429 state.lpush(); | |
430 break; | |
431 case Bytecodes::_aload_0: | |
432 state.apush(state._vars[0]); | |
433 break; | |
434 case Bytecodes::_aload_1: | |
435 state.apush(state._vars[1]); | |
436 break; | |
437 case Bytecodes::_aload_2: | |
438 state.apush(state._vars[2]); | |
439 break; | |
440 case Bytecodes::_aload_3: | |
441 state.apush(state._vars[3]); | |
442 break; | |
443 case Bytecodes::_iaload: | |
444 case Bytecodes::_faload: | |
445 case Bytecodes::_baload: | |
446 case Bytecodes::_caload: | |
447 case Bytecodes::_saload: | |
448 state.spop(); | |
449 set_method_escape(state.apop()); | |
450 state.spush(); | |
451 break; | |
452 case Bytecodes::_laload: | |
453 case Bytecodes::_daload: | |
454 state.spop(); | |
455 set_method_escape(state.apop()); | |
456 state.lpush(); | |
457 break; | |
458 case Bytecodes::_aaload: | |
459 { state.spop(); | |
460 ArgumentMap array = state.apop(); | |
461 set_method_escape(array); | |
462 state.apush(unknown_obj); | |
463 set_dirty(array); | |
464 } | |
465 break; | |
466 case Bytecodes::_istore: | |
467 case Bytecodes::_fstore: | |
468 case Bytecodes::_istore_0: | |
469 case Bytecodes::_istore_1: | |
470 case Bytecodes::_istore_2: | |
471 case Bytecodes::_istore_3: | |
472 case Bytecodes::_fstore_0: | |
473 case Bytecodes::_fstore_1: | |
474 case Bytecodes::_fstore_2: | |
475 case Bytecodes::_fstore_3: | |
476 state.spop(); | |
477 break; | |
478 case Bytecodes::_lstore: | |
479 case Bytecodes::_dstore: | |
480 case Bytecodes::_lstore_0: | |
481 case Bytecodes::_lstore_1: | |
482 case Bytecodes::_lstore_2: | |
483 case Bytecodes::_lstore_3: | |
484 case Bytecodes::_dstore_0: | |
485 case Bytecodes::_dstore_1: | |
486 case Bytecodes::_dstore_2: | |
487 case Bytecodes::_dstore_3: | |
488 state.lpop(); | |
489 break; | |
490 case Bytecodes::_astore: | |
491 state._vars[s.get_index()] = state.apop(); | |
492 break; | |
493 case Bytecodes::_astore_0: | |
494 state._vars[0] = state.apop(); | |
495 break; | |
496 case Bytecodes::_astore_1: | |
497 state._vars[1] = state.apop(); | |
498 break; | |
499 case Bytecodes::_astore_2: | |
500 state._vars[2] = state.apop(); | |
501 break; | |
502 case Bytecodes::_astore_3: | |
503 state._vars[3] = state.apop(); | |
504 break; | |
505 case Bytecodes::_iastore: | |
506 case Bytecodes::_fastore: | |
507 case Bytecodes::_bastore: | |
508 case Bytecodes::_castore: | |
509 case Bytecodes::_sastore: | |
510 { | |
511 state.spop(); | |
512 state.spop(); | |
513 ArgumentMap arr = state.apop(); | |
514 set_method_escape(arr); | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
515 set_modified(arr, OFFSET_ANY, type2size[T_INT]*HeapWordSize); |
0 | 516 break; |
517 } | |
518 case Bytecodes::_lastore: | |
519 case Bytecodes::_dastore: | |
520 { | |
521 state.lpop(); | |
522 state.spop(); | |
523 ArgumentMap arr = state.apop(); | |
524 set_method_escape(arr); | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
525 set_modified(arr, OFFSET_ANY, type2size[T_LONG]*HeapWordSize); |
0 | 526 break; |
527 } | |
528 case Bytecodes::_aastore: | |
529 { | |
530 set_global_escape(state.apop()); | |
531 state.spop(); | |
532 ArgumentMap arr = state.apop(); | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
533 set_modified(arr, OFFSET_ANY, type2size[T_OBJECT]*HeapWordSize); |
0 | 534 break; |
535 } | |
536 case Bytecodes::_pop: | |
537 state.raw_pop(); | |
538 break; | |
539 case Bytecodes::_pop2: | |
540 state.raw_pop(); | |
541 state.raw_pop(); | |
542 break; | |
543 case Bytecodes::_dup: | |
544 { ArgumentMap w1 = state.raw_pop(); | |
545 state.raw_push(w1); | |
546 state.raw_push(w1); | |
547 } | |
548 break; | |
549 case Bytecodes::_dup_x1: | |
550 { ArgumentMap w1 = state.raw_pop(); | |
551 ArgumentMap w2 = state.raw_pop(); | |
552 state.raw_push(w1); | |
553 state.raw_push(w2); | |
554 state.raw_push(w1); | |
555 } | |
556 break; | |
557 case Bytecodes::_dup_x2: | |
558 { ArgumentMap w1 = state.raw_pop(); | |
559 ArgumentMap w2 = state.raw_pop(); | |
560 ArgumentMap w3 = state.raw_pop(); | |
561 state.raw_push(w1); | |
562 state.raw_push(w3); | |
563 state.raw_push(w2); | |
564 state.raw_push(w1); | |
565 } | |
566 break; | |
567 case Bytecodes::_dup2: | |
568 { ArgumentMap w1 = state.raw_pop(); | |
569 ArgumentMap w2 = state.raw_pop(); | |
570 state.raw_push(w2); | |
571 state.raw_push(w1); | |
572 state.raw_push(w2); | |
573 state.raw_push(w1); | |
574 } | |
575 break; | |
576 case Bytecodes::_dup2_x1: | |
577 { ArgumentMap w1 = state.raw_pop(); | |
578 ArgumentMap w2 = state.raw_pop(); | |
579 ArgumentMap w3 = state.raw_pop(); | |
580 state.raw_push(w2); | |
581 state.raw_push(w1); | |
582 state.raw_push(w3); | |
583 state.raw_push(w2); | |
584 state.raw_push(w1); | |
585 } | |
586 break; | |
587 case Bytecodes::_dup2_x2: | |
588 { ArgumentMap w1 = state.raw_pop(); | |
589 ArgumentMap w2 = state.raw_pop(); | |
590 ArgumentMap w3 = state.raw_pop(); | |
591 ArgumentMap w4 = state.raw_pop(); | |
592 state.raw_push(w2); | |
593 state.raw_push(w1); | |
594 state.raw_push(w4); | |
595 state.raw_push(w3); | |
596 state.raw_push(w2); | |
597 state.raw_push(w1); | |
598 } | |
599 break; | |
600 case Bytecodes::_swap: | |
601 { ArgumentMap w1 = state.raw_pop(); | |
602 ArgumentMap w2 = state.raw_pop(); | |
603 state.raw_push(w1); | |
604 state.raw_push(w2); | |
605 } | |
606 break; | |
607 case Bytecodes::_iadd: | |
608 case Bytecodes::_fadd: | |
609 case Bytecodes::_isub: | |
610 case Bytecodes::_fsub: | |
611 case Bytecodes::_imul: | |
612 case Bytecodes::_fmul: | |
613 case Bytecodes::_idiv: | |
614 case Bytecodes::_fdiv: | |
615 case Bytecodes::_irem: | |
616 case Bytecodes::_frem: | |
617 case Bytecodes::_iand: | |
618 case Bytecodes::_ior: | |
619 case Bytecodes::_ixor: | |
620 state.spop(); | |
621 state.spop(); | |
622 state.spush(); | |
623 break; | |
624 case Bytecodes::_ladd: | |
625 case Bytecodes::_dadd: | |
626 case Bytecodes::_lsub: | |
627 case Bytecodes::_dsub: | |
628 case Bytecodes::_lmul: | |
629 case Bytecodes::_dmul: | |
630 case Bytecodes::_ldiv: | |
631 case Bytecodes::_ddiv: | |
632 case Bytecodes::_lrem: | |
633 case Bytecodes::_drem: | |
634 case Bytecodes::_land: | |
635 case Bytecodes::_lor: | |
636 case Bytecodes::_lxor: | |
637 state.lpop(); | |
638 state.lpop(); | |
639 state.lpush(); | |
640 break; | |
641 case Bytecodes::_ishl: | |
642 case Bytecodes::_ishr: | |
643 case Bytecodes::_iushr: | |
644 state.spop(); | |
645 state.spop(); | |
646 state.spush(); | |
647 break; | |
648 case Bytecodes::_lshl: | |
649 case Bytecodes::_lshr: | |
650 case Bytecodes::_lushr: | |
651 state.spop(); | |
652 state.lpop(); | |
653 state.lpush(); | |
654 break; | |
655 case Bytecodes::_ineg: | |
656 case Bytecodes::_fneg: | |
657 state.spop(); | |
658 state.spush(); | |
659 break; | |
660 case Bytecodes::_lneg: | |
661 case Bytecodes::_dneg: | |
662 state.lpop(); | |
663 state.lpush(); | |
664 break; | |
665 case Bytecodes::_iinc: | |
666 break; | |
667 case Bytecodes::_i2l: | |
668 case Bytecodes::_i2d: | |
669 case Bytecodes::_f2l: | |
670 case Bytecodes::_f2d: | |
671 state.spop(); | |
672 state.lpush(); | |
673 break; | |
674 case Bytecodes::_i2f: | |
675 case Bytecodes::_f2i: | |
676 state.spop(); | |
677 state.spush(); | |
678 break; | |
679 case Bytecodes::_l2i: | |
680 case Bytecodes::_l2f: | |
681 case Bytecodes::_d2i: | |
682 case Bytecodes::_d2f: | |
683 state.lpop(); | |
684 state.spush(); | |
685 break; | |
686 case Bytecodes::_l2d: | |
687 case Bytecodes::_d2l: | |
688 state.lpop(); | |
689 state.lpush(); | |
690 break; | |
691 case Bytecodes::_i2b: | |
692 case Bytecodes::_i2c: | |
693 case Bytecodes::_i2s: | |
694 state.spop(); | |
695 state.spush(); | |
696 break; | |
697 case Bytecodes::_lcmp: | |
698 case Bytecodes::_dcmpl: | |
699 case Bytecodes::_dcmpg: | |
700 state.lpop(); | |
701 state.lpop(); | |
702 state.spush(); | |
703 break; | |
704 case Bytecodes::_fcmpl: | |
705 case Bytecodes::_fcmpg: | |
706 state.spop(); | |
707 state.spop(); | |
708 state.spush(); | |
709 break; | |
710 case Bytecodes::_ifeq: | |
711 case Bytecodes::_ifne: | |
712 case Bytecodes::_iflt: | |
713 case Bytecodes::_ifge: | |
714 case Bytecodes::_ifgt: | |
715 case Bytecodes::_ifle: | |
716 { | |
717 state.spop(); | |
718 int dest_bci = s.get_dest(); | |
719 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); | |
720 assert(s.next_bci() == limit_bci, "branch must end block"); | |
721 successors.push(_methodBlocks->block_containing(dest_bci)); | |
722 break; | |
723 } | |
724 case Bytecodes::_if_icmpeq: | |
725 case Bytecodes::_if_icmpne: | |
726 case Bytecodes::_if_icmplt: | |
727 case Bytecodes::_if_icmpge: | |
728 case Bytecodes::_if_icmpgt: | |
729 case Bytecodes::_if_icmple: | |
730 { | |
731 state.spop(); | |
732 state.spop(); | |
733 int dest_bci = s.get_dest(); | |
734 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); | |
735 assert(s.next_bci() == limit_bci, "branch must end block"); | |
736 successors.push(_methodBlocks->block_containing(dest_bci)); | |
737 break; | |
738 } | |
739 case Bytecodes::_if_acmpeq: | |
740 case Bytecodes::_if_acmpne: | |
741 { | |
742 set_method_escape(state.apop()); | |
743 set_method_escape(state.apop()); | |
744 int dest_bci = s.get_dest(); | |
745 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); | |
746 assert(s.next_bci() == limit_bci, "branch must end block"); | |
747 successors.push(_methodBlocks->block_containing(dest_bci)); | |
748 break; | |
749 } | |
750 case Bytecodes::_goto: | |
751 { | |
752 int dest_bci = s.get_dest(); | |
753 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); | |
754 assert(s.next_bci() == limit_bci, "branch must end block"); | |
755 successors.push(_methodBlocks->block_containing(dest_bci)); | |
756 fall_through = false; | |
757 break; | |
758 } | |
759 case Bytecodes::_jsr: | |
760 { | |
761 int dest_bci = s.get_dest(); | |
762 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); | |
763 assert(s.next_bci() == limit_bci, "branch must end block"); | |
764 state.apush(empty_map); | |
765 successors.push(_methodBlocks->block_containing(dest_bci)); | |
766 fall_through = false; | |
767 break; | |
768 } | |
769 case Bytecodes::_ret: | |
770 // we don't track the destination of a "ret" instruction | |
771 assert(s.next_bci() == limit_bci, "branch must end block"); | |
772 fall_through = false; | |
773 break; | |
774 case Bytecodes::_return: | |
775 assert(s.next_bci() == limit_bci, "return must end block"); | |
776 fall_through = false; | |
777 break; | |
778 case Bytecodes::_tableswitch: | |
779 { | |
780 state.spop(); | |
2142 | 781 Bytecode_tableswitch sw(&s); |
782 int len = sw.length(); | |
0 | 783 int dest_bci; |
784 for (int i = 0; i < len; i++) { | |
2142 | 785 dest_bci = s.cur_bci() + sw.dest_offset_at(i); |
0 | 786 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
787 successors.push(_methodBlocks->block_containing(dest_bci)); | |
788 } | |
2142 | 789 dest_bci = s.cur_bci() + sw.default_offset(); |
0 | 790 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
791 successors.push(_methodBlocks->block_containing(dest_bci)); | |
792 assert(s.next_bci() == limit_bci, "branch must end block"); | |
793 fall_through = false; | |
794 break; | |
795 } | |
796 case Bytecodes::_lookupswitch: | |
797 { | |
798 state.spop(); | |
2142 | 799 Bytecode_lookupswitch sw(&s); |
800 int len = sw.number_of_pairs(); | |
0 | 801 int dest_bci; |
802 for (int i = 0; i < len; i++) { | |
2142 | 803 dest_bci = s.cur_bci() + sw.pair_at(i).offset(); |
0 | 804 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
805 successors.push(_methodBlocks->block_containing(dest_bci)); | |
806 } | |
2142 | 807 dest_bci = s.cur_bci() + sw.default_offset(); |
0 | 808 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); |
809 successors.push(_methodBlocks->block_containing(dest_bci)); | |
810 fall_through = false; | |
811 break; | |
812 } | |
813 case Bytecodes::_ireturn: | |
814 case Bytecodes::_freturn: | |
815 state.spop(); | |
816 fall_through = false; | |
817 break; | |
818 case Bytecodes::_lreturn: | |
819 case Bytecodes::_dreturn: | |
820 state.lpop(); | |
821 fall_through = false; | |
822 break; | |
823 case Bytecodes::_areturn: | |
824 set_returned(state.apop()); | |
825 fall_through = false; | |
826 break; | |
827 case Bytecodes::_getstatic: | |
828 case Bytecodes::_getfield: | |
829 { bool will_link; | |
830 ciField* field = s.get_field(will_link); | |
831 BasicType field_type = field->type()->basic_type(); | |
832 if (s.cur_bc() != Bytecodes::_getstatic) { | |
833 set_method_escape(state.apop()); | |
834 } | |
835 if (field_type == T_OBJECT || field_type == T_ARRAY) { | |
836 state.apush(unknown_obj); | |
837 } else if (type2size[field_type] == 1) { | |
838 state.spush(); | |
839 } else { | |
840 state.lpush(); | |
841 } | |
842 } | |
843 break; | |
844 case Bytecodes::_putstatic: | |
845 case Bytecodes::_putfield: | |
846 { bool will_link; | |
847 ciField* field = s.get_field(will_link); | |
848 BasicType field_type = field->type()->basic_type(); | |
849 if (field_type == T_OBJECT || field_type == T_ARRAY) { | |
850 set_global_escape(state.apop()); | |
851 } else if (type2size[field_type] == 1) { | |
852 state.spop(); | |
853 } else { | |
854 state.lpop(); | |
855 } | |
856 if (s.cur_bc() != Bytecodes::_putstatic) { | |
857 ArgumentMap p = state.apop(); | |
858 set_method_escape(p); | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
859 set_modified(p, will_link ? field->offset() : OFFSET_ANY, type2size[field_type]*HeapWordSize); |
0 | 860 } |
861 } | |
862 break; | |
863 case Bytecodes::_invokevirtual: | |
864 case Bytecodes::_invokespecial: | |
865 case Bytecodes::_invokestatic: | |
726
be93aad57795
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
196
diff
changeset
|
866 case Bytecodes::_invokedynamic: |
0 | 867 case Bytecodes::_invokeinterface: |
868 { bool will_link; | |
869 ciMethod* target = s.get_method(will_link); | |
870 ciKlass* holder = s.get_declared_method_holder(); | |
6266
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
871 // Push appendix argument, if one. |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
872 if (s.has_appendix()) { |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
873 state.apush(unknown_obj); |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
874 } |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
875 // Pass in raw bytecode because we need to see invokehandle instructions. |
1d7922586cf6
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
4869
diff
changeset
|
876 invoke(state, s.cur_bc_raw(), target, holder); |
0 | 877 ciType* return_type = target->return_type(); |
878 if (!return_type->is_primitive_type()) { | |
879 state.apush(unknown_obj); | |
880 } else if (return_type->is_one_word()) { | |
881 state.spush(); | |
882 } else if (return_type->is_two_word()) { | |
883 state.lpush(); | |
884 } | |
885 } | |
886 break; | |
887 case Bytecodes::_new: | |
888 state.apush(allocated_obj); | |
889 break; | |
890 case Bytecodes::_newarray: | |
891 case Bytecodes::_anewarray: | |
892 state.spop(); | |
893 state.apush(allocated_obj); | |
894 break; | |
895 case Bytecodes::_multianewarray: | |
896 { int i = s.cur_bcp()[3]; | |
897 while (i-- > 0) state.spop(); | |
898 state.apush(allocated_obj); | |
899 } | |
900 break; | |
901 case Bytecodes::_arraylength: | |
902 set_method_escape(state.apop()); | |
903 state.spush(); | |
904 break; | |
905 case Bytecodes::_athrow: | |
906 set_global_escape(state.apop()); | |
907 fall_through = false; | |
908 break; | |
909 case Bytecodes::_checkcast: | |
910 { ArgumentMap obj = state.apop(); | |
911 set_method_escape(obj); | |
912 state.apush(obj); | |
913 } | |
914 break; | |
915 case Bytecodes::_instanceof: | |
916 set_method_escape(state.apop()); | |
917 state.spush(); | |
918 break; | |
919 case Bytecodes::_monitorenter: | |
920 case Bytecodes::_monitorexit: | |
921 state.apop(); | |
922 break; | |
923 case Bytecodes::_wide: | |
924 ShouldNotReachHere(); | |
925 break; | |
926 case Bytecodes::_ifnull: | |
927 case Bytecodes::_ifnonnull: | |
928 { | |
929 set_method_escape(state.apop()); | |
930 int dest_bci = s.get_dest(); | |
931 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); | |
932 assert(s.next_bci() == limit_bci, "branch must end block"); | |
933 successors.push(_methodBlocks->block_containing(dest_bci)); | |
934 break; | |
935 } | |
936 case Bytecodes::_goto_w: | |
937 { | |
938 int dest_bci = s.get_far_dest(); | |
939 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); | |
940 assert(s.next_bci() == limit_bci, "branch must end block"); | |
941 successors.push(_methodBlocks->block_containing(dest_bci)); | |
942 fall_through = false; | |
943 break; | |
944 } | |
945 case Bytecodes::_jsr_w: | |
946 { | |
947 int dest_bci = s.get_far_dest(); | |
948 assert(_methodBlocks->is_block_start(dest_bci), "branch destination must start a block"); | |
949 assert(s.next_bci() == limit_bci, "branch must end block"); | |
950 state.apush(empty_map); | |
951 successors.push(_methodBlocks->block_containing(dest_bci)); | |
952 fall_through = false; | |
953 break; | |
954 } | |
955 case Bytecodes::_breakpoint: | |
956 break; | |
957 default: | |
958 ShouldNotReachHere(); | |
959 break; | |
960 } | |
961 | |
962 } | |
963 if (fall_through) { | |
964 int fall_through_bci = s.cur_bci(); | |
965 if (fall_through_bci < _method->code_size()) { | |
966 assert(_methodBlocks->is_block_start(fall_through_bci), "must fall through to block start."); | |
967 successors.push(_methodBlocks->block_containing(fall_through_bci)); | |
968 } | |
969 } | |
970 } | |
971 | |
972 void BCEscapeAnalyzer::merge_block_states(StateInfo *blockstates, ciBlock *dest, StateInfo *s_state) { | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
973 StateInfo *d_state = blockstates + dest->index(); |
0 | 974 int nlocals = _method->max_locals(); |
975 | |
976 // exceptions may cause transfer of control to handlers in the middle of a | |
977 // block, so we don't merge the incoming state of exception handlers | |
978 if (dest->is_handler()) | |
979 return; | |
980 if (!d_state->_initialized ) { | |
981 // destination not initialized, just copy | |
982 for (int i = 0; i < nlocals; i++) { | |
983 d_state->_vars[i] = s_state->_vars[i]; | |
984 } | |
985 for (int i = 0; i < s_state->_stack_height; i++) { | |
986 d_state->_stack[i] = s_state->_stack[i]; | |
987 } | |
988 d_state->_stack_height = s_state->_stack_height; | |
989 d_state->_max_stack = s_state->_max_stack; | |
990 d_state->_initialized = true; | |
991 } else if (!dest->processed()) { | |
992 // we have not yet walked the bytecodes of dest, we can merge | |
993 // the states | |
994 assert(d_state->_stack_height == s_state->_stack_height, "computed stack heights must match"); | |
995 for (int i = 0; i < nlocals; i++) { | |
996 d_state->_vars[i].set_union(s_state->_vars[i]); | |
997 } | |
998 for (int i = 0; i < s_state->_stack_height; i++) { | |
999 d_state->_stack[i].set_union(s_state->_stack[i]); | |
1000 } | |
1001 } else { | |
1002 // the bytecodes of dest have already been processed, mark any | |
1003 // arguments in the source state which are not in the dest state | |
1004 // as global escape. | |
1005 // Future refinement: we only need to mark these variable to the | |
1006 // maximum escape of any variables in dest state | |
1007 assert(d_state->_stack_height == s_state->_stack_height, "computed stack heights must match"); | |
1008 ArgumentMap extra_vars; | |
1009 for (int i = 0; i < nlocals; i++) { | |
1010 ArgumentMap t; | |
1011 t = s_state->_vars[i]; | |
1012 t.set_difference(d_state->_vars[i]); | |
1013 extra_vars.set_union(t); | |
1014 } | |
1015 for (int i = 0; i < s_state->_stack_height; i++) { | |
1016 ArgumentMap t; | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1017 //extra_vars |= !d_state->_vars[i] & s_state->_vars[i]; |
0 | 1018 t.clear(); |
1019 t = s_state->_stack[i]; | |
1020 t.set_difference(d_state->_stack[i]); | |
1021 extra_vars.set_union(t); | |
1022 } | |
4122
cc81b9c09bbb
7112478: after 7105605 JRuby bench_define_method_methods.rb fails with NPE
kvn
parents:
3280
diff
changeset
|
1023 set_global_escape(extra_vars, true); |
0 | 1024 } |
1025 } | |
1026 | |
1027 void BCEscapeAnalyzer::iterate_blocks(Arena *arena) { | |
1028 int numblocks = _methodBlocks->num_blocks(); | |
1029 int stkSize = _method->max_stack(); | |
1030 int numLocals = _method->max_locals(); | |
1031 StateInfo state; | |
1032 | |
1033 int datacount = (numblocks + 1) * (stkSize + numLocals); | |
1034 int datasize = datacount * sizeof(ArgumentMap); | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1035 StateInfo *blockstates = (StateInfo *) arena->Amalloc(numblocks * sizeof(StateInfo)); |
0 | 1036 ArgumentMap *statedata = (ArgumentMap *) arena->Amalloc(datasize); |
1037 for (int i = 0; i < datacount; i++) ::new ((void*)&statedata[i]) ArgumentMap(); | |
1038 ArgumentMap *dp = statedata; | |
1039 state._vars = dp; | |
1040 dp += numLocals; | |
1041 state._stack = dp; | |
1042 dp += stkSize; | |
1043 state._initialized = false; | |
1044 state._max_stack = stkSize; | |
1045 for (int i = 0; i < numblocks; i++) { | |
1046 blockstates[i]._vars = dp; | |
1047 dp += numLocals; | |
1048 blockstates[i]._stack = dp; | |
1049 dp += stkSize; | |
1050 blockstates[i]._initialized = false; | |
1051 blockstates[i]._stack_height = 0; | |
1052 blockstates[i]._max_stack = stkSize; | |
1053 } | |
1054 GrowableArray<ciBlock *> worklist(arena, numblocks / 4, 0, NULL); | |
1055 GrowableArray<ciBlock *> successors(arena, 4, 0, NULL); | |
1056 | |
1057 _methodBlocks->clear_processed(); | |
1058 | |
1059 // initialize block 0 state from method signature | |
1060 ArgumentMap allVars; // all oop arguments to method | |
1061 ciSignature* sig = method()->signature(); | |
1062 int j = 0; | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1063 ciBlock* first_blk = _methodBlocks->block_containing(0); |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1064 int fb_i = first_blk->index(); |
0 | 1065 if (!method()->is_static()) { |
1066 // record information for "this" | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1067 blockstates[fb_i]._vars[j].set(j); |
0 | 1068 allVars.add(j); |
1069 j++; | |
1070 } | |
1071 for (int i = 0; i < sig->count(); i++) { | |
1072 ciType* t = sig->type_at(i); | |
1073 if (!t->is_primitive_type()) { | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1074 blockstates[fb_i]._vars[j].set(j); |
0 | 1075 allVars.add(j); |
1076 } | |
1077 j += t->size(); | |
1078 } | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1079 blockstates[fb_i]._initialized = true; |
0 | 1080 assert(j == _arg_size, "just checking"); |
1081 | |
1082 ArgumentMap unknown_map; | |
1083 unknown_map.add_unknown(); | |
1084 | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1085 worklist.push(first_blk); |
0 | 1086 while(worklist.length() > 0) { |
1087 ciBlock *blk = worklist.pop(); | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1088 StateInfo *blkState = blockstates + blk->index(); |
0 | 1089 if (blk->is_handler() || blk->is_ret_target()) { |
1090 // for an exception handler or a target of a ret instruction, we assume the worst case, | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1091 // that any variable could contain any argument |
0 | 1092 for (int i = 0; i < numLocals; i++) { |
1093 state._vars[i] = allVars; | |
1094 } | |
1095 if (blk->is_handler()) { | |
1096 state._stack_height = 1; | |
1097 } else { | |
1098 state._stack_height = blkState->_stack_height; | |
1099 } | |
1100 for (int i = 0; i < state._stack_height; i++) { | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1101 // ??? should this be unknown_map ??? |
0 | 1102 state._stack[i] = allVars; |
1103 } | |
1104 } else { | |
1105 for (int i = 0; i < numLocals; i++) { | |
1106 state._vars[i] = blkState->_vars[i]; | |
1107 } | |
1108 for (int i = 0; i < blkState->_stack_height; i++) { | |
1109 state._stack[i] = blkState->_stack[i]; | |
1110 } | |
1111 state._stack_height = blkState->_stack_height; | |
1112 } | |
1113 iterate_one_block(blk, state, successors); | |
1114 // if this block has any exception handlers, push them | |
1115 // onto successor list | |
1116 if (blk->has_handler()) { | |
1117 DEBUG_ONLY(int handler_count = 0;) | |
1118 int blk_start = blk->start_bci(); | |
1119 int blk_end = blk->limit_bci(); | |
1120 for (int i = 0; i < numblocks; i++) { | |
1121 ciBlock *b = _methodBlocks->block(i); | |
1122 if (b->is_handler()) { | |
1123 int ex_start = b->ex_start_bci(); | |
1124 int ex_end = b->ex_limit_bci(); | |
1125 if ((ex_start >= blk_start && ex_start < blk_end) || | |
1126 (ex_end > blk_start && ex_end <= blk_end)) { | |
1127 successors.push(b); | |
1128 } | |
1129 DEBUG_ONLY(handler_count++;) | |
1130 } | |
1131 } | |
1132 assert(handler_count > 0, "must find at least one handler"); | |
1133 } | |
1134 // merge computed variable state with successors | |
1135 while(successors.length() > 0) { | |
1136 ciBlock *succ = successors.pop(); | |
1137 merge_block_states(blockstates, succ, &state); | |
1138 if (!succ->processed()) | |
1139 worklist.push(succ); | |
1140 } | |
1141 } | |
1142 } | |
1143 | |
1144 bool BCEscapeAnalyzer::do_analysis() { | |
1145 Arena* arena = CURRENT_ENV->arena(); | |
1146 // identify basic blocks | |
1147 _methodBlocks = _method->get_method_blocks(); | |
1148 | |
1149 iterate_blocks(arena); | |
1150 // TEMPORARY | |
1151 return true; | |
1152 } | |
1153 | |
1154 vmIntrinsics::ID BCEscapeAnalyzer::known_intrinsic() { | |
1155 vmIntrinsics::ID iid = method()->intrinsic_id(); | |
1156 | |
1157 if (iid == vmIntrinsics::_getClass || | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1158 iid == vmIntrinsics::_fillInStackTrace || |
0 | 1159 iid == vmIntrinsics::_hashCode) |
1160 return iid; | |
1161 else | |
1162 return vmIntrinsics::_none; | |
1163 } | |
1164 | |
1165 bool BCEscapeAnalyzer::compute_escape_for_intrinsic(vmIntrinsics::ID iid) { | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1166 ArgumentMap arg; |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1167 arg.clear(); |
0 | 1168 switch (iid) { |
1169 case vmIntrinsics::_getClass: | |
1170 _return_local = false; | |
1171 break; | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1172 case vmIntrinsics::_fillInStackTrace: |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1173 arg.set(0); // 'this' |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1174 set_returned(arg); |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1175 break; |
0 | 1176 case vmIntrinsics::_hashCode: |
1177 // initialized state is correct | |
1178 break; | |
1179 default: | |
1180 assert(false, "unexpected intrinsic"); | |
1181 } | |
1182 return true; | |
1183 } | |
1184 | |
1185 void BCEscapeAnalyzer::initialize() { | |
1186 int i; | |
1187 | |
1188 // clear escape information (method may have been deoptimized) | |
1189 methodData()->clear_escape_info(); | |
1190 | |
1191 // initialize escape state of object parameters | |
1192 ciSignature* sig = method()->signature(); | |
1193 int j = 0; | |
1194 if (!method()->is_static()) { | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1195 _arg_local.set(0); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1196 _arg_stack.set(0); |
0 | 1197 j++; |
1198 } | |
1199 for (i = 0; i < sig->count(); i++) { | |
1200 ciType* t = sig->type_at(i); | |
1201 if (!t->is_primitive_type()) { | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1202 _arg_local.set(j); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1203 _arg_stack.set(j); |
0 | 1204 } |
1205 j += t->size(); | |
1206 } | |
1207 assert(j == _arg_size, "just checking"); | |
1208 | |
1209 // start with optimistic assumption | |
1210 ciType *rt = _method->return_type(); | |
1211 if (rt->is_primitive_type()) { | |
1212 _return_local = false; | |
1213 _return_allocated = false; | |
1214 } else { | |
1215 _return_local = true; | |
1216 _return_allocated = true; | |
1217 } | |
1218 _allocated_escapes = false; | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1219 _unknown_modified = false; |
0 | 1220 } |
1221 | |
1222 void BCEscapeAnalyzer::clear_escape_info() { | |
1223 ciSignature* sig = method()->signature(); | |
1224 int arg_count = sig->count(); | |
1225 ArgumentMap var; | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1226 if (!method()->is_static()) { |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1227 arg_count++; // allow for "this" |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1228 } |
0 | 1229 for (int i = 0; i < arg_count; i++) { |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1230 set_arg_modified(i, OFFSET_ANY, 4); |
0 | 1231 var.clear(); |
1232 var.set(i); | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1233 set_modified(var, OFFSET_ANY, 4); |
0 | 1234 set_global_escape(var); |
1235 } | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1236 _arg_local.Clear(); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1237 _arg_stack.Clear(); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1238 _arg_returned.Clear(); |
0 | 1239 _return_local = false; |
1240 _return_allocated = false; | |
1241 _allocated_escapes = true; | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1242 _unknown_modified = true; |
0 | 1243 } |
1244 | |
1245 | |
1246 void BCEscapeAnalyzer::compute_escape_info() { | |
1247 int i; | |
1248 assert(!methodData()->has_escape_info(), "do not overwrite escape info"); | |
1249 | |
1250 vmIntrinsics::ID iid = known_intrinsic(); | |
1251 | |
1252 // check if method can be analyzed | |
1253 if (iid == vmIntrinsics::_none && (method()->is_abstract() || method()->is_native() || !method()->holder()->is_initialized() | |
1254 || _level > MaxBCEAEstimateLevel | |
1255 || method()->code_size() > MaxBCEAEstimateSize)) { | |
1256 if (BCEATraceLevel >= 1) { | |
1257 tty->print("Skipping method because: "); | |
1258 if (method()->is_abstract()) | |
1259 tty->print_cr("method is abstract."); | |
1260 else if (method()->is_native()) | |
1261 tty->print_cr("method is native."); | |
1262 else if (!method()->holder()->is_initialized()) | |
1263 tty->print_cr("class of method is not initialized."); | |
1264 else if (_level > MaxBCEAEstimateLevel) | |
1265 tty->print_cr("level (%d) exceeds MaxBCEAEstimateLevel (%d).", | |
1266 _level, MaxBCEAEstimateLevel); | |
1267 else if (method()->code_size() > MaxBCEAEstimateSize) | |
1268 tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize.", | |
1269 method()->code_size(), MaxBCEAEstimateSize); | |
1270 else | |
1271 ShouldNotReachHere(); | |
1272 } | |
1273 clear_escape_info(); | |
1274 | |
1275 return; | |
1276 } | |
1277 | |
1278 if (BCEATraceLevel >= 1) { | |
1279 tty->print("[EA] estimating escape information for"); | |
1280 if (iid != vmIntrinsics::_none) | |
1281 tty->print(" intrinsic"); | |
1282 method()->print_short_name(); | |
1283 tty->print_cr(" (%d bytes)", method()->code_size()); | |
1284 } | |
1285 | |
1286 bool success; | |
1287 | |
1288 initialize(); | |
1289 | |
78
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1290 // Do not scan method if it has no object parameters and |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1291 // does not returns an object (_return_allocated is set in initialize()). |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1292 if (_arg_local.Size() == 0 && !_return_allocated) { |
78
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1293 // Clear all info since method's bytecode was not analysed and |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1294 // set pessimistic escape information. |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1295 clear_escape_info(); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1296 methodData()->set_eflag(methodDataOopDesc::allocated_escapes); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1297 methodData()->set_eflag(methodDataOopDesc::unknown_modified); |
0 | 1298 methodData()->set_eflag(methodDataOopDesc::estimated); |
1299 return; | |
1300 } | |
1301 | |
1302 if (iid != vmIntrinsics::_none) | |
1303 success = compute_escape_for_intrinsic(iid); | |
1304 else { | |
1305 success = do_analysis(); | |
1306 } | |
1307 | |
78
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1308 // don't store interprocedural escape information if it introduces |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1309 // dependencies or if method data is empty |
0 | 1310 // |
1311 if (!has_dependencies() && !methodData()->is_empty()) { | |
1312 for (i = 0; i < _arg_size; i++) { | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1313 if (_arg_local.test(i)) { |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1314 assert(_arg_stack.test(i), "inconsistent escape info"); |
0 | 1315 methodData()->set_arg_local(i); |
1316 methodData()->set_arg_stack(i); | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1317 } else if (_arg_stack.test(i)) { |
0 | 1318 methodData()->set_arg_stack(i); |
1319 } | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1320 if (_arg_returned.test(i)) { |
0 | 1321 methodData()->set_arg_returned(i); |
1322 } | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1323 methodData()->set_arg_modified(i, _arg_modified[i]); |
0 | 1324 } |
1325 if (_return_local) { | |
1326 methodData()->set_eflag(methodDataOopDesc::return_local); | |
1327 } | |
78
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1328 if (_return_allocated) { |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1329 methodData()->set_eflag(methodDataOopDesc::return_allocated); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1330 } |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1331 if (_allocated_escapes) { |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1332 methodData()->set_eflag(methodDataOopDesc::allocated_escapes); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1333 } |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1334 if (_unknown_modified) { |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1335 methodData()->set_eflag(methodDataOopDesc::unknown_modified); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1336 } |
0 | 1337 methodData()->set_eflag(methodDataOopDesc::estimated); |
1338 } | |
1339 } | |
1340 | |
1341 void BCEscapeAnalyzer::read_escape_info() { | |
1342 assert(methodData()->has_escape_info(), "no escape info available"); | |
1343 | |
1344 // read escape information from method descriptor | |
1345 for (int i = 0; i < _arg_size; i++) { | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1346 if (methodData()->is_arg_local(i)) |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1347 _arg_local.set(i); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1348 if (methodData()->is_arg_stack(i)) |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1349 _arg_stack.set(i); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1350 if (methodData()->is_arg_returned(i)) |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1351 _arg_returned.set(i); |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1352 _arg_modified[i] = methodData()->arg_modified(i); |
0 | 1353 } |
1354 _return_local = methodData()->eflag_set(methodDataOopDesc::return_local); | |
78
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1355 _return_allocated = methodData()->eflag_set(methodDataOopDesc::return_allocated); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1356 _allocated_escapes = methodData()->eflag_set(methodDataOopDesc::allocated_escapes); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1357 _unknown_modified = methodData()->eflag_set(methodDataOopDesc::unknown_modified); |
0 | 1358 |
1359 } | |
1360 | |
78
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1361 #ifndef PRODUCT |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1362 void BCEscapeAnalyzer::dump() { |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1363 tty->print("[EA] estimated escape information for"); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1364 method()->print_short_name(); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1365 tty->print_cr(has_dependencies() ? " (not stored)" : ""); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1366 tty->print(" non-escaping args: "); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1367 _arg_local.print_on(tty); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1368 tty->print(" stack-allocatable args: "); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1369 _arg_stack.print_on(tty); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1370 if (_return_local) { |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1371 tty->print(" returned args: "); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1372 _arg_returned.print_on(tty); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1373 } else if (is_return_allocated()) { |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1374 tty->print_cr(" return allocated value"); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1375 } else { |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1376 tty->print_cr(" return non-local value"); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1377 } |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1378 tty->print(" modified args: "); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1379 for (int i = 0; i < _arg_size; i++) { |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1380 if (_arg_modified[i] == 0) |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1381 tty->print(" 0"); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1382 else |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1383 tty->print(" 0x%x", _arg_modified[i]); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1384 } |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1385 tty->cr(); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1386 tty->print(" flags: "); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1387 if (_return_allocated) |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1388 tty->print(" return_allocated"); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1389 if (_allocated_escapes) |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1390 tty->print(" allocated_escapes"); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1391 if (_unknown_modified) |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1392 tty->print(" unknown_modified"); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1393 tty->cr(); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1394 } |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1395 #endif |
0 | 1396 |
1397 BCEscapeAnalyzer::BCEscapeAnalyzer(ciMethod* method, BCEscapeAnalyzer* parent) | |
1398 : _conservative(method == NULL || !EstimateArgEscape) | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1399 , _arena(CURRENT_ENV->arena()) |
0 | 1400 , _method(method) |
1401 , _methodData(method ? method->method_data() : NULL) | |
1402 , _arg_size(method ? method->arg_size() : 0) | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1403 , _arg_local(_arena) |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1404 , _arg_stack(_arena) |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1405 , _arg_returned(_arena) |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1406 , _dirty(_arena) |
0 | 1407 , _return_local(false) |
1408 , _return_allocated(false) | |
1409 , _allocated_escapes(false) | |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1410 , _unknown_modified(false) |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1411 , _dependencies(_arena, 4, 0, NULL) |
0 | 1412 , _parent(parent) |
1413 , _level(parent == NULL ? 0 : parent->level() + 1) { | |
1414 if (!_conservative) { | |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1415 _arg_local.Clear(); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1416 _arg_stack.Clear(); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1417 _arg_returned.Clear(); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1418 _dirty.Clear(); |
0 | 1419 Arena* arena = CURRENT_ENV->arena(); |
45
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1420 _arg_modified = (uint *) arena->Amalloc(_arg_size * sizeof(uint)); |
48a3fa21394b
6667615: (Escape Analysis) extend MDO to cache arguments escape state
kvn
parents:
0
diff
changeset
|
1421 Copy::zero_to_bytes(_arg_modified, _arg_size * sizeof(uint)); |
0 | 1422 |
1423 if (methodData() == NULL) | |
1424 return; | |
1425 bool printit = _method->should_print_assembly(); | |
1426 if (methodData()->has_escape_info()) { | |
1427 TRACE_BCEA(2, tty->print_cr("[EA] Reading previous results for %s.%s", | |
1428 method->holder()->name()->as_utf8(), | |
1429 method->name()->as_utf8())); | |
1430 read_escape_info(); | |
1431 } else { | |
1432 TRACE_BCEA(2, tty->print_cr("[EA] computing results for %s.%s", | |
1433 method->holder()->name()->as_utf8(), | |
1434 method->name()->as_utf8())); | |
1435 | |
1436 compute_escape_info(); | |
1437 methodData()->update_escape_info(); | |
1438 } | |
78
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1439 #ifndef PRODUCT |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1440 if (BCEATraceLevel >= 3) { |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1441 // dump escape information |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1442 dump(); |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1443 } |
e1e86702e43e
6680665: bytecode Escape Analyzer produces incorrect escape information for methods without oop arguments
kvn
parents:
45
diff
changeset
|
1444 #endif |
0 | 1445 } |
1446 } | |
1447 | |
1448 void BCEscapeAnalyzer::copy_dependencies(Dependencies *deps) { | |
1397
b4776199210f
6943485: JVMTI always on capabilities change code generation too much
never
parents:
844
diff
changeset
|
1449 if (ciEnv::current()->jvmti_can_hotswap_or_post_breakpoint()) { |
b4776199210f
6943485: JVMTI always on capabilities change code generation too much
never
parents:
844
diff
changeset
|
1450 // Also record evol dependencies so redefinition of the |
b4776199210f
6943485: JVMTI always on capabilities change code generation too much
never
parents:
844
diff
changeset
|
1451 // callee will trigger recompilation. |
b4776199210f
6943485: JVMTI always on capabilities change code generation too much
never
parents:
844
diff
changeset
|
1452 deps->assert_evol_method(method()); |
b4776199210f
6943485: JVMTI always on capabilities change code generation too much
never
parents:
844
diff
changeset
|
1453 } |
0 | 1454 for (int i = 0; i < _dependencies.length(); i+=2) { |
1648
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1455 ciKlass *k = _dependencies.at(i)->as_klass(); |
8099e71601df
6968368: SIGSEGV in the BCEscapeAnalyzer::copy_dependencies
kvn
parents:
1552
diff
changeset
|
1456 ciMethod *m = _dependencies.at(i+1)->as_method(); |
0 | 1457 deps->assert_unique_concrete_method(k, m); |
1458 } | |
1459 } |