annotate src/share/vm/ci/bcEscapeAnalyzer.cpp @ 13212:eb03a7335eb0

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