author | dsamersoff |
Fri, 25 Mar 2016 12:54:16 +0300 | |
changeset 37195 | 88b6f1271f64 |
parent 36092 | b1bf903783b8 |
child 38259 | b495d1cfe673 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
36092 | 2 |
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "oops/oop.inline.hpp" |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7913
diff
changeset
|
27 |
#include "oops/symbol.hpp" |
7397 | 28 |
#include "prims/jvmtiRedefineClassesTrace.hpp" |
29 |
#include "prims/methodComparator.hpp" |
|
30 |
#include "runtime/handles.inline.hpp" |
|
31 |
#include "utilities/globalDefinitions.hpp" |
|
1 | 32 |
|
33 |
BytecodeStream *MethodComparator::_s_old; |
|
34 |
BytecodeStream *MethodComparator::_s_new; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
35 |
ConstantPool* MethodComparator::_old_cp; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
36 |
ConstantPool* MethodComparator::_new_cp; |
1 | 37 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
38 |
bool MethodComparator::methods_EMCP(Method* old_method, Method* new_method) { |
1 | 39 |
if (old_method->code_size() != new_method->code_size()) |
40 |
return false; |
|
41 |
if (check_stack_and_locals_size(old_method, new_method) != 0) { |
|
42 |
// RC_TRACE macro has an embedded ResourceMark |
|
43 |
RC_TRACE(0x00800000, ("Methods %s non-comparable with diagnosis %d", |
|
44 |
old_method->name()->as_C_string(), |
|
45 |
check_stack_and_locals_size(old_method, new_method))); |
|
46 |
return false; |
|
47 |
} |
|
48 |
||
49 |
_old_cp = old_method->constants(); |
|
50 |
_new_cp = new_method->constants(); |
|
51 |
BytecodeStream s_old(old_method); |
|
52 |
BytecodeStream s_new(new_method); |
|
53 |
_s_old = &s_old; |
|
54 |
_s_new = &s_new; |
|
55 |
Bytecodes::Code c_old, c_new; |
|
56 |
||
57 |
while ((c_old = s_old.next()) >= 0) { |
|
58 |
if ((c_new = s_new.next()) < 0 || c_old != c_new) |
|
59 |
return false; |
|
60 |
||
61 |
if (! args_same(c_old, c_new)) |
|
62 |
return false; |
|
63 |
} |
|
64 |
return true; |
|
65 |
} |
|
66 |
||
67 |
bool MethodComparator::args_same(Bytecodes::Code c_old, Bytecodes::Code c_new) { |
|
68 |
// BytecodeStream returns the correct standard Java bytecodes for various "fast" |
|
69 |
// bytecode versions, so we don't have to bother about them here.. |
|
70 |
switch (c_old) { |
|
71 |
case Bytecodes::_new : // fall through |
|
72 |
case Bytecodes::_anewarray : // fall through |
|
73 |
case Bytecodes::_multianewarray : // fall through |
|
74 |
case Bytecodes::_checkcast : // fall through |
|
75 |
case Bytecodes::_instanceof : { |
|
5688 | 76 |
u2 cpi_old = _s_old->get_index_u2(); |
77 |
u2 cpi_new = _s_new->get_index_u2(); |
|
1 | 78 |
if ((_old_cp->klass_at_noresolve(cpi_old) != _new_cp->klass_at_noresolve(cpi_new))) |
79 |
return false; |
|
80 |
if (c_old == Bytecodes::_multianewarray && |
|
81 |
*(jbyte*)(_s_old->bcp() + 3) != *(jbyte*)(_s_new->bcp() + 3)) |
|
82 |
return false; |
|
83 |
break; |
|
84 |
} |
|
85 |
||
86 |
case Bytecodes::_getstatic : // fall through |
|
87 |
case Bytecodes::_putstatic : // fall through |
|
88 |
case Bytecodes::_getfield : // fall through |
|
89 |
case Bytecodes::_putfield : // fall through |
|
90 |
case Bytecodes::_invokevirtual : // fall through |
|
91 |
case Bytecodes::_invokespecial : // fall through |
|
92 |
case Bytecodes::_invokestatic : // fall through |
|
93 |
case Bytecodes::_invokeinterface : { |
|
7114
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
94 |
int cpci_old = _s_old->get_index_u2_cpcache(); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
95 |
int cpci_new = _s_new->get_index_u2_cpcache(); |
1 | 96 |
// Check if the names of classes, field/method names and signatures at these indexes |
97 |
// are the same. Indices which are really into constantpool cache (rather than constant |
|
98 |
// pool itself) are accepted by the constantpool query routines below. |
|
99 |
if ((_old_cp->klass_ref_at_noresolve(cpci_old) != _new_cp->klass_ref_at_noresolve(cpci_new)) || |
|
100 |
(_old_cp->name_ref_at(cpci_old) != _new_cp->name_ref_at(cpci_new)) || |
|
101 |
(_old_cp->signature_ref_at(cpci_old) != _new_cp->signature_ref_at(cpci_new))) |
|
102 |
return false; |
|
103 |
break; |
|
104 |
} |
|
7114
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
105 |
case Bytecodes::_invokedynamic: { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
106 |
int cpci_old = _s_old->get_index_u4(); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
107 |
int cpci_new = _s_new->get_index_u4(); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
108 |
|
7114
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
109 |
// Check if the names of classes, field/method names and signatures at these indexes |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
110 |
// are the same. Indices which are really into constantpool cache (rather than constant |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
111 |
// pool itself) are accepted by the constantpool query routines below. |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
112 |
if ((_old_cp->name_ref_at(cpci_old) != _new_cp->name_ref_at(cpci_new)) || |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
113 |
(_old_cp->signature_ref_at(cpci_old) != _new_cp->signature_ref_at(cpci_new))) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
114 |
return false; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
115 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
116 |
// Translate object indexes to constant pool cache indexes. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
117 |
cpci_old = _old_cp->invokedynamic_cp_cache_index(cpci_old); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
118 |
cpci_new = _new_cp->invokedynamic_cp_cache_index(cpci_new); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
119 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
120 |
int cpi_old = _old_cp->cache()->entry_at(cpci_old)->constant_pool_index(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
121 |
int cpi_new = _new_cp->cache()->entry_at(cpci_new)->constant_pool_index(); |
7114
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
122 |
int bsm_old = _old_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_old); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
123 |
int bsm_new = _new_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_new); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
124 |
if (!pool_constants_same(bsm_old, bsm_new)) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
125 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
126 |
int cnt_old = _old_cp->invoke_dynamic_argument_count_at(cpi_old); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
127 |
int cnt_new = _new_cp->invoke_dynamic_argument_count_at(cpi_new); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
128 |
if (cnt_old != cnt_new) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
129 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
130 |
for (int arg_i = 0; arg_i < cnt_old; arg_i++) { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
131 |
int idx_old = _old_cp->invoke_dynamic_argument_index_at(cpi_old, arg_i); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
132 |
int idx_new = _new_cp->invoke_dynamic_argument_index_at(cpi_new, arg_i); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
133 |
if (!pool_constants_same(idx_old, idx_new)) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
134 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
135 |
} |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
136 |
break; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
137 |
} |
1 | 138 |
|
139 |
case Bytecodes::_ldc : // fall through |
|
140 |
case Bytecodes::_ldc_w : { |
|
7913 | 141 |
Bytecode_loadconstant ldc_old(_s_old->method(), _s_old->bci()); |
142 |
Bytecode_loadconstant ldc_new(_s_new->method(), _s_new->bci()); |
|
143 |
int cpi_old = ldc_old.pool_index(); |
|
144 |
int cpi_new = ldc_new.pool_index(); |
|
7114
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
145 |
if (!pool_constants_same(cpi_old, cpi_new)) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
146 |
return false; |
1 | 147 |
break; |
148 |
} |
|
149 |
||
150 |
case Bytecodes::_ldc2_w : { |
|
5688 | 151 |
u2 cpi_old = _s_old->get_index_u2(); |
152 |
u2 cpi_new = _s_new->get_index_u2(); |
|
1 | 153 |
constantTag tag_old = _old_cp->tag_at(cpi_old); |
154 |
constantTag tag_new = _new_cp->tag_at(cpi_new); |
|
155 |
if (tag_old.value() != tag_new.value()) |
|
156 |
return false; |
|
157 |
if (tag_old.is_long()) { |
|
158 |
if (_old_cp->long_at(cpi_old) != _new_cp->long_at(cpi_new)) |
|
159 |
return false; |
|
160 |
} else { |
|
5697 | 161 |
// Use jlong_cast to compare the bits rather than numerical values. |
162 |
// This makes a difference for NaN constants. |
|
163 |
if (jlong_cast(_old_cp->double_at(cpi_old)) != jlong_cast(_new_cp->double_at(cpi_new))) |
|
1 | 164 |
return false; |
165 |
} |
|
166 |
break; |
|
167 |
} |
|
168 |
||
169 |
case Bytecodes::_bipush : |
|
170 |
if (_s_old->bcp()[1] != _s_new->bcp()[1]) |
|
171 |
return false; |
|
172 |
break; |
|
173 |
||
174 |
case Bytecodes::_sipush : |
|
5688 | 175 |
if (_s_old->get_index_u2() != _s_new->get_index_u2()) |
1 | 176 |
return false; |
177 |
break; |
|
178 |
||
179 |
case Bytecodes::_aload : // fall through |
|
180 |
case Bytecodes::_astore : // fall through |
|
181 |
case Bytecodes::_dload : // fall through |
|
182 |
case Bytecodes::_dstore : // fall through |
|
183 |
case Bytecodes::_fload : // fall through |
|
184 |
case Bytecodes::_fstore : // fall through |
|
185 |
case Bytecodes::_iload : // fall through |
|
186 |
case Bytecodes::_istore : // fall through |
|
187 |
case Bytecodes::_lload : // fall through |
|
188 |
case Bytecodes::_lstore : // fall through |
|
189 |
case Bytecodes::_ret : |
|
190 |
if (_s_old->is_wide() != _s_new->is_wide()) |
|
191 |
return false; |
|
192 |
if (_s_old->get_index() != _s_new->get_index()) |
|
193 |
return false; |
|
194 |
break; |
|
195 |
||
196 |
case Bytecodes::_goto : // fall through |
|
197 |
case Bytecodes::_if_acmpeq : // fall through |
|
198 |
case Bytecodes::_if_acmpne : // fall through |
|
199 |
case Bytecodes::_if_icmpeq : // fall through |
|
200 |
case Bytecodes::_if_icmpne : // fall through |
|
201 |
case Bytecodes::_if_icmplt : // fall through |
|
202 |
case Bytecodes::_if_icmpge : // fall through |
|
203 |
case Bytecodes::_if_icmpgt : // fall through |
|
204 |
case Bytecodes::_if_icmple : // fall through |
|
205 |
case Bytecodes::_ifeq : // fall through |
|
206 |
case Bytecodes::_ifne : // fall through |
|
207 |
case Bytecodes::_iflt : // fall through |
|
208 |
case Bytecodes::_ifge : // fall through |
|
209 |
case Bytecodes::_ifgt : // fall through |
|
210 |
case Bytecodes::_ifle : // fall through |
|
211 |
case Bytecodes::_ifnonnull : // fall through |
|
212 |
case Bytecodes::_ifnull : // fall through |
|
213 |
case Bytecodes::_jsr : { |
|
7913 | 214 |
int old_ofs = _s_old->bytecode().get_offset_s2(c_old); |
215 |
int new_ofs = _s_new->bytecode().get_offset_s2(c_new); |
|
36092 | 216 |
if (old_ofs != new_ofs) |
217 |
return false; |
|
1 | 218 |
break; |
219 |
} |
|
220 |
||
221 |
case Bytecodes::_iinc : |
|
222 |
if (_s_old->is_wide() != _s_new->is_wide()) |
|
223 |
return false; |
|
224 |
if (! _s_old->is_wide()) { |
|
5688 | 225 |
// We could use get_index_u1 and get_constant_u1, but it's simpler to grab both bytes at once: |
226 |
if (Bytes::get_Java_u2(_s_old->bcp() + 1) != Bytes::get_Java_u2(_s_new->bcp() + 1)) |
|
1 | 227 |
return false; |
228 |
} else { |
|
5688 | 229 |
// We could use get_index_u2 and get_constant_u2, but it's simpler to grab all four bytes at once: |
1 | 230 |
if (Bytes::get_Java_u4(_s_old->bcp() + 1) != Bytes::get_Java_u4(_s_new->bcp() + 1)) |
231 |
return false; |
|
232 |
} |
|
233 |
break; |
|
234 |
||
235 |
case Bytecodes::_goto_w : // fall through |
|
236 |
case Bytecodes::_jsr_w : { |
|
7913 | 237 |
int old_ofs = _s_old->bytecode().get_offset_s4(c_old); |
238 |
int new_ofs = _s_new->bytecode().get_offset_s4(c_new); |
|
36092 | 239 |
if (old_ofs != new_ofs) |
240 |
return false; |
|
1 | 241 |
break; |
242 |
} |
|
243 |
||
244 |
case Bytecodes::_lookupswitch : // fall through |
|
245 |
case Bytecodes::_tableswitch : { |
|
36092 | 246 |
int len_old = _s_old->instruction_size(); |
247 |
int len_new = _s_new->instruction_size(); |
|
248 |
if (len_old != len_new) |
|
249 |
return false; |
|
250 |
if (memcmp(_s_old->bcp(), _s_new->bcp(), len_old) != 0) |
|
251 |
return false; |
|
1 | 252 |
break; |
253 |
} |
|
254 |
} |
|
255 |
||
256 |
return true; |
|
257 |
} |
|
258 |
||
7114
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
259 |
bool MethodComparator::pool_constants_same(int cpi_old, int cpi_new) { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
260 |
constantTag tag_old = _old_cp->tag_at(cpi_old); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
261 |
constantTag tag_new = _new_cp->tag_at(cpi_new); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
262 |
if (tag_old.is_int() || tag_old.is_float()) { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
263 |
if (tag_old.value() != tag_new.value()) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
264 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
265 |
if (tag_old.is_int()) { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
266 |
if (_old_cp->int_at(cpi_old) != _new_cp->int_at(cpi_new)) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
267 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
268 |
} else { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
269 |
// Use jint_cast to compare the bits rather than numerical values. |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
270 |
// This makes a difference for NaN constants. |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
271 |
if (jint_cast(_old_cp->float_at(cpi_old)) != jint_cast(_new_cp->float_at(cpi_new))) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
272 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
273 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
274 |
} else if (tag_old.is_string() && tag_new.is_string()) { |
7114
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
275 |
if (strcmp(_old_cp->string_at_noresolve(cpi_old), |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
276 |
_new_cp->string_at_noresolve(cpi_new)) != 0) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
277 |
return false; |
28741
1f10b1bd612d
8008678: JSR 292: constant pool reconstitution must support pseudo strings
sspitsyn
parents:
13728
diff
changeset
|
278 |
if (_old_cp->is_pseudo_string_at(cpi_old) || _new_cp->is_pseudo_string_at(cpi_new)) |
1f10b1bd612d
8008678: JSR 292: constant pool reconstitution must support pseudo strings
sspitsyn
parents:
13728
diff
changeset
|
279 |
return (_old_cp->is_pseudo_string_at(cpi_old) == _new_cp->is_pseudo_string_at(cpi_new)); |
7114
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
280 |
} else if (tag_old.is_klass() || tag_old.is_unresolved_klass()) { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
281 |
// tag_old should be klass - 4881222 |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
282 |
if (! (tag_new.is_unresolved_klass() || tag_new.is_klass())) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
283 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
284 |
if (_old_cp->klass_at_noresolve(cpi_old) != |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
285 |
_new_cp->klass_at_noresolve(cpi_new)) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
286 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
287 |
} else if (tag_old.is_method_type() && tag_new.is_method_type()) { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
288 |
int mti_old = _old_cp->method_type_index_at(cpi_old); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
289 |
int mti_new = _new_cp->method_type_index_at(cpi_new); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
290 |
if ((_old_cp->symbol_at(mti_old) != _new_cp->symbol_at(mti_new))) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
291 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
292 |
} else if (tag_old.is_method_handle() && tag_new.is_method_handle()) { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
293 |
if (_old_cp->method_handle_ref_kind_at(cpi_old) != |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
294 |
_new_cp->method_handle_ref_kind_at(cpi_new)) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
295 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
296 |
int mhi_old = _old_cp->method_handle_index_at(cpi_old); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
297 |
int mhi_new = _new_cp->method_handle_index_at(cpi_new); |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
298 |
if ((_old_cp->uncached_klass_ref_at_noresolve(mhi_old) != _new_cp->uncached_klass_ref_at_noresolve(mhi_new)) || |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
299 |
(_old_cp->uncached_name_ref_at(mhi_old) != _new_cp->uncached_name_ref_at(mhi_new)) || |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
300 |
(_old_cp->uncached_signature_ref_at(mhi_old) != _new_cp->uncached_signature_ref_at(mhi_new))) |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
301 |
return false; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
302 |
} else { |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
303 |
return false; // unknown tag |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
304 |
} |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
305 |
return true; |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
306 |
} |
65d21c4c6337
6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents:
5882
diff
changeset
|
307 |
|
1 | 308 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8076
diff
changeset
|
309 |
int MethodComparator::check_stack_and_locals_size(Method* old_method, Method* new_method) { |
1 | 310 |
if (old_method->max_stack() != new_method->max_stack()) { |
311 |
return 1; |
|
312 |
} else if (old_method->max_locals() != new_method->max_locals()) { |
|
313 |
return 2; |
|
314 |
} else if (old_method->size_of_parameters() != new_method->size_of_parameters()) { |
|
315 |
return 3; |
|
316 |
} else return 0; |
|
317 |
} |