annotate src/share/vm/prims/methodComparator.cpp @ 12355:cefad50507d8

Merge with hs25-b53
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 11 Oct 2013 10:38:03 +0200
parents da91efe96a93
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
2 * Copyright (c) 2000, 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: 844
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 844
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: 844
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: 1913
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
26 #include "oops/oop.inline.hpp"
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 2142
diff changeset
27 #include "oops/symbol.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
28 #include "prims/jvmtiRedefineClassesTrace.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
29 #include "prims/methodComparator.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
30 #include "runtime/handles.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1913
diff changeset
31 #include "utilities/globalDefinitions.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 BytecodeStream *MethodComparator::_s_old;
a61af66fc99e Initial load
duke
parents:
diff changeset
34 BytecodeStream *MethodComparator::_s_new;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
35 ConstantPool* MethodComparator::_old_cp;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
36 ConstantPool* MethodComparator::_new_cp;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
37 BciMap *MethodComparator::_bci_map;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 bool MethodComparator::_switchable_test;
a61af66fc99e Initial load
duke
parents:
diff changeset
39 GrowableArray<int> *MethodComparator::_fwd_jmps;
a61af66fc99e Initial load
duke
parents:
diff changeset
40
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
41 bool MethodComparator::methods_EMCP(Method* old_method, Method* new_method) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
42 if (old_method->code_size() != new_method->code_size())
a61af66fc99e Initial load
duke
parents:
diff changeset
43 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 if (check_stack_and_locals_size(old_method, new_method) != 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // RC_TRACE macro has an embedded ResourceMark
a61af66fc99e Initial load
duke
parents:
diff changeset
46 RC_TRACE(0x00800000, ("Methods %s non-comparable with diagnosis %d",
a61af66fc99e Initial load
duke
parents:
diff changeset
47 old_method->name()->as_C_string(),
a61af66fc99e Initial load
duke
parents:
diff changeset
48 check_stack_and_locals_size(old_method, new_method)));
a61af66fc99e Initial load
duke
parents:
diff changeset
49 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 }
a61af66fc99e Initial load
duke
parents:
diff changeset
51
a61af66fc99e Initial load
duke
parents:
diff changeset
52 _old_cp = old_method->constants();
a61af66fc99e Initial load
duke
parents:
diff changeset
53 _new_cp = new_method->constants();
a61af66fc99e Initial load
duke
parents:
diff changeset
54 BytecodeStream s_old(old_method);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 BytecodeStream s_new(new_method);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 _s_old = &s_old;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 _s_new = &s_new;
a61af66fc99e Initial load
duke
parents:
diff changeset
58 _switchable_test = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
59 Bytecodes::Code c_old, c_new;
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 while ((c_old = s_old.next()) >= 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
62 if ((c_new = s_new.next()) < 0 || c_old != c_new)
a61af66fc99e Initial load
duke
parents:
diff changeset
63 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 if (! args_same(c_old, c_new))
a61af66fc99e Initial load
duke
parents:
diff changeset
66 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 }
a61af66fc99e Initial load
duke
parents:
diff changeset
68 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
72 bool MethodComparator::methods_switchable(Method* old_method, Method* new_method,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
73 BciMap &bci_map) {
a61af66fc99e Initial load
duke
parents:
diff changeset
74 if (old_method->code_size() > new_method->code_size())
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // Something has definitely been deleted in the new method, compared to the old one.
a61af66fc99e Initial load
duke
parents:
diff changeset
76 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 if (! check_stack_and_locals_size(old_method, new_method))
a61af66fc99e Initial load
duke
parents:
diff changeset
79 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 _old_cp = old_method->constants();
a61af66fc99e Initial load
duke
parents:
diff changeset
82 _new_cp = new_method->constants();
a61af66fc99e Initial load
duke
parents:
diff changeset
83 BytecodeStream s_old(old_method);
a61af66fc99e Initial load
duke
parents:
diff changeset
84 BytecodeStream s_new(new_method);
a61af66fc99e Initial load
duke
parents:
diff changeset
85 _s_old = &s_old;
a61af66fc99e Initial load
duke
parents:
diff changeset
86 _s_new = &s_new;
a61af66fc99e Initial load
duke
parents:
diff changeset
87 _bci_map = &bci_map;
a61af66fc99e Initial load
duke
parents:
diff changeset
88 _switchable_test = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
89 GrowableArray<int> fwd_jmps(16);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 _fwd_jmps = &fwd_jmps;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 Bytecodes::Code c_old, c_new;
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 while ((c_old = s_old.next()) >= 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 if ((c_new = s_new.next()) < 0)
a61af66fc99e Initial load
duke
parents:
diff changeset
95 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
96 if (! (c_old == c_new && args_same(c_old, c_new))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 int old_bci = s_old.bci();
a61af66fc99e Initial load
duke
parents:
diff changeset
98 int new_st_bci = s_new.bci();
a61af66fc99e Initial load
duke
parents:
diff changeset
99 bool found_match = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
100 do {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 c_new = s_new.next();
a61af66fc99e Initial load
duke
parents:
diff changeset
102 if (c_new == c_old && args_same(c_old, c_new)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
103 found_match = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106 } while (c_new >= 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 if (! found_match)
a61af66fc99e Initial load
duke
parents:
diff changeset
108 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
109 int new_end_bci = s_new.bci();
a61af66fc99e Initial load
duke
parents:
diff changeset
110 bci_map.store_fragment_location(old_bci, new_st_bci, new_end_bci);
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // Now we can test all forward jumps
a61af66fc99e Initial load
duke
parents:
diff changeset
115 for (int i = 0; i < fwd_jmps.length() / 2; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 if (! bci_map.old_and_new_locations_same(fwd_jmps.at(i*2), fwd_jmps.at(i*2+1))) {
a61af66fc99e Initial load
duke
parents:
diff changeset
117 RC_TRACE(0x00800000,
a61af66fc99e Initial load
duke
parents:
diff changeset
118 ("Fwd jump miss: old dest = %d, calc new dest = %d, act new dest = %d",
a61af66fc99e Initial load
duke
parents:
diff changeset
119 fwd_jmps.at(i*2), bci_map.new_bci_for_old(fwd_jmps.at(i*2)),
a61af66fc99e Initial load
duke
parents:
diff changeset
120 fwd_jmps.at(i*2+1)));
a61af66fc99e Initial load
duke
parents:
diff changeset
121 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
122 }
a61af66fc99e Initial load
duke
parents:
diff changeset
123 }
a61af66fc99e Initial load
duke
parents:
diff changeset
124
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
a61af66fc99e Initial load
duke
parents:
diff changeset
128
a61af66fc99e Initial load
duke
parents:
diff changeset
129 bool MethodComparator::args_same(Bytecodes::Code c_old, Bytecodes::Code c_new) {
a61af66fc99e Initial load
duke
parents:
diff changeset
130 // BytecodeStream returns the correct standard Java bytecodes for various "fast"
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // bytecode versions, so we don't have to bother about them here..
a61af66fc99e Initial load
duke
parents:
diff changeset
132 switch (c_old) {
a61af66fc99e Initial load
duke
parents:
diff changeset
133 case Bytecodes::_new : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
134 case Bytecodes::_anewarray : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
135 case Bytecodes::_multianewarray : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
136 case Bytecodes::_checkcast : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
137 case Bytecodes::_instanceof : {
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
138 u2 cpi_old = _s_old->get_index_u2();
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
139 u2 cpi_new = _s_new->get_index_u2();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
140 if ((_old_cp->klass_at_noresolve(cpi_old) != _new_cp->klass_at_noresolve(cpi_new)))
a61af66fc99e Initial load
duke
parents:
diff changeset
141 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
142 if (c_old == Bytecodes::_multianewarray &&
a61af66fc99e Initial load
duke
parents:
diff changeset
143 *(jbyte*)(_s_old->bcp() + 3) != *(jbyte*)(_s_new->bcp() + 3))
a61af66fc99e Initial load
duke
parents:
diff changeset
144 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
145 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
146 }
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 case Bytecodes::_getstatic : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
149 case Bytecodes::_putstatic : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
150 case Bytecodes::_getfield : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
151 case Bytecodes::_putfield : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
152 case Bytecodes::_invokevirtual : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
153 case Bytecodes::_invokespecial : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
154 case Bytecodes::_invokestatic : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
155 case Bytecodes::_invokeinterface : {
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
156 int cpci_old = _s_old->get_index_u2_cpcache();
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
157 int cpci_new = _s_new->get_index_u2_cpcache();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
158 // Check if the names of classes, field/method names and signatures at these indexes
a61af66fc99e Initial load
duke
parents:
diff changeset
159 // are the same. Indices which are really into constantpool cache (rather than constant
a61af66fc99e Initial load
duke
parents:
diff changeset
160 // pool itself) are accepted by the constantpool query routines below.
a61af66fc99e Initial load
duke
parents:
diff changeset
161 if ((_old_cp->klass_ref_at_noresolve(cpci_old) != _new_cp->klass_ref_at_noresolve(cpci_new)) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
162 (_old_cp->name_ref_at(cpci_old) != _new_cp->name_ref_at(cpci_new)) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
163 (_old_cp->signature_ref_at(cpci_old) != _new_cp->signature_ref_at(cpci_new)))
a61af66fc99e Initial load
duke
parents:
diff changeset
164 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
165 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
166 }
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
167 case Bytecodes::_invokedynamic: {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
168 int cpci_old = _s_old->get_index_u4();
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
169 int cpci_new = _s_new->get_index_u4();
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
170
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
171 // Check if the names of classes, field/method names and signatures at these indexes
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
172 // are the same. Indices which are really into constantpool cache (rather than constant
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
173 // pool itself) are accepted by the constantpool query routines below.
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
174 if ((_old_cp->name_ref_at(cpci_old) != _new_cp->name_ref_at(cpci_new)) ||
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
175 (_old_cp->signature_ref_at(cpci_old) != _new_cp->signature_ref_at(cpci_new)))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
176 return false;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
177
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
178 // Translate object indexes to constant pool cache indexes.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
179 cpci_old = _old_cp->invokedynamic_cp_cache_index(cpci_old);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
180 cpci_new = _new_cp->invokedynamic_cp_cache_index(cpci_new);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
181
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
182 int cpi_old = _old_cp->cache()->entry_at(cpci_old)->constant_pool_index();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
183 int cpi_new = _new_cp->cache()->entry_at(cpci_new)->constant_pool_index();
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
184 int bsm_old = _old_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_old);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
185 int bsm_new = _new_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_new);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
186 if (!pool_constants_same(bsm_old, bsm_new))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
187 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
188 int cnt_old = _old_cp->invoke_dynamic_argument_count_at(cpi_old);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
189 int cnt_new = _new_cp->invoke_dynamic_argument_count_at(cpi_new);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
190 if (cnt_old != cnt_new)
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
191 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
192 for (int arg_i = 0; arg_i < cnt_old; arg_i++) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
193 int idx_old = _old_cp->invoke_dynamic_argument_index_at(cpi_old, arg_i);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
194 int idx_new = _new_cp->invoke_dynamic_argument_index_at(cpi_new, arg_i);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
195 if (!pool_constants_same(idx_old, idx_new))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
196 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
197 }
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
198 break;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
199 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
200
a61af66fc99e Initial load
duke
parents:
diff changeset
201 case Bytecodes::_ldc : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
202 case Bytecodes::_ldc_w : {
2142
8012aa3ccede 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 1972
diff changeset
203 Bytecode_loadconstant ldc_old(_s_old->method(), _s_old->bci());
8012aa3ccede 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 1972
diff changeset
204 Bytecode_loadconstant ldc_new(_s_new->method(), _s_new->bci());
8012aa3ccede 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 1972
diff changeset
205 int cpi_old = ldc_old.pool_index();
8012aa3ccede 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 1972
diff changeset
206 int cpi_new = ldc_new.pool_index();
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
207 if (!pool_constants_same(cpi_old, cpi_new))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
208 return false;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
209 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
210 }
a61af66fc99e Initial load
duke
parents:
diff changeset
211
a61af66fc99e Initial load
duke
parents:
diff changeset
212 case Bytecodes::_ldc2_w : {
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
213 u2 cpi_old = _s_old->get_index_u2();
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
214 u2 cpi_new = _s_new->get_index_u2();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
215 constantTag tag_old = _old_cp->tag_at(cpi_old);
a61af66fc99e Initial load
duke
parents:
diff changeset
216 constantTag tag_new = _new_cp->tag_at(cpi_new);
a61af66fc99e Initial load
duke
parents:
diff changeset
217 if (tag_old.value() != tag_new.value())
a61af66fc99e Initial load
duke
parents:
diff changeset
218 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
219 if (tag_old.is_long()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
220 if (_old_cp->long_at(cpi_old) != _new_cp->long_at(cpi_new))
a61af66fc99e Initial load
duke
parents:
diff changeset
221 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
222 } else {
1574
1eb493f33423 6957080: MethodComparator needs stress testing
jrose
parents: 1573
diff changeset
223 // Use jlong_cast to compare the bits rather than numerical values.
1eb493f33423 6957080: MethodComparator needs stress testing
jrose
parents: 1573
diff changeset
224 // This makes a difference for NaN constants.
1eb493f33423 6957080: MethodComparator needs stress testing
jrose
parents: 1573
diff changeset
225 if (jlong_cast(_old_cp->double_at(cpi_old)) != jlong_cast(_new_cp->double_at(cpi_new)))
0
a61af66fc99e Initial load
duke
parents:
diff changeset
226 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
227 }
a61af66fc99e Initial load
duke
parents:
diff changeset
228 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
229 }
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 case Bytecodes::_bipush :
a61af66fc99e Initial load
duke
parents:
diff changeset
232 if (_s_old->bcp()[1] != _s_new->bcp()[1])
a61af66fc99e Initial load
duke
parents:
diff changeset
233 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
234 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
235
a61af66fc99e Initial load
duke
parents:
diff changeset
236 case Bytecodes::_sipush :
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
237 if (_s_old->get_index_u2() != _s_new->get_index_u2())
0
a61af66fc99e Initial load
duke
parents:
diff changeset
238 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
239 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 case Bytecodes::_aload : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
242 case Bytecodes::_astore : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
243 case Bytecodes::_dload : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
244 case Bytecodes::_dstore : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
245 case Bytecodes::_fload : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
246 case Bytecodes::_fstore : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
247 case Bytecodes::_iload : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
248 case Bytecodes::_istore : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
249 case Bytecodes::_lload : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
250 case Bytecodes::_lstore : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
251 case Bytecodes::_ret :
a61af66fc99e Initial load
duke
parents:
diff changeset
252 if (_s_old->is_wide() != _s_new->is_wide())
a61af66fc99e Initial load
duke
parents:
diff changeset
253 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
254 if (_s_old->get_index() != _s_new->get_index())
a61af66fc99e Initial load
duke
parents:
diff changeset
255 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
256 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
257
a61af66fc99e Initial load
duke
parents:
diff changeset
258 case Bytecodes::_goto : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
259 case Bytecodes::_if_acmpeq : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
260 case Bytecodes::_if_acmpne : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
261 case Bytecodes::_if_icmpeq : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
262 case Bytecodes::_if_icmpne : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
263 case Bytecodes::_if_icmplt : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
264 case Bytecodes::_if_icmpge : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
265 case Bytecodes::_if_icmpgt : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
266 case Bytecodes::_if_icmple : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
267 case Bytecodes::_ifeq : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
268 case Bytecodes::_ifne : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
269 case Bytecodes::_iflt : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
270 case Bytecodes::_ifge : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
271 case Bytecodes::_ifgt : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
272 case Bytecodes::_ifle : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
273 case Bytecodes::_ifnonnull : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
274 case Bytecodes::_ifnull : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
275 case Bytecodes::_jsr : {
2142
8012aa3ccede 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 1972
diff changeset
276 int old_ofs = _s_old->bytecode().get_offset_s2(c_old);
8012aa3ccede 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 1972
diff changeset
277 int new_ofs = _s_new->bytecode().get_offset_s2(c_new);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
278 if (_switchable_test) {
a61af66fc99e Initial load
duke
parents:
diff changeset
279 int old_dest = _s_old->bci() + old_ofs;
a61af66fc99e Initial load
duke
parents:
diff changeset
280 int new_dest = _s_new->bci() + new_ofs;
a61af66fc99e Initial load
duke
parents:
diff changeset
281 if (old_ofs < 0 && new_ofs < 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
282 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest))
a61af66fc99e Initial load
duke
parents:
diff changeset
283 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
284 } else if (old_ofs > 0 && new_ofs > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
285 _fwd_jmps->append(old_dest);
a61af66fc99e Initial load
duke
parents:
diff changeset
286 _fwd_jmps->append(new_dest);
a61af66fc99e Initial load
duke
parents:
diff changeset
287 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
288 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
289 }
a61af66fc99e Initial load
duke
parents:
diff changeset
290 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
291 if (old_ofs != new_ofs)
a61af66fc99e Initial load
duke
parents:
diff changeset
292 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
293 }
a61af66fc99e Initial load
duke
parents:
diff changeset
294 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
295 }
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 case Bytecodes::_iinc :
a61af66fc99e Initial load
duke
parents:
diff changeset
298 if (_s_old->is_wide() != _s_new->is_wide())
a61af66fc99e Initial load
duke
parents:
diff changeset
299 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
300 if (! _s_old->is_wide()) {
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
301 // We could use get_index_u1 and get_constant_u1, but it's simpler to grab both bytes at once:
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
302 if (Bytes::get_Java_u2(_s_old->bcp() + 1) != Bytes::get_Java_u2(_s_new->bcp() + 1))
0
a61af66fc99e Initial load
duke
parents:
diff changeset
303 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
304 } else {
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
305 // We could use get_index_u2 and get_constant_u2, but it's simpler to grab all four bytes at once:
0
a61af66fc99e Initial load
duke
parents:
diff changeset
306 if (Bytes::get_Java_u4(_s_old->bcp() + 1) != Bytes::get_Java_u4(_s_new->bcp() + 1))
a61af66fc99e Initial load
duke
parents:
diff changeset
307 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
308 }
a61af66fc99e Initial load
duke
parents:
diff changeset
309 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
310
a61af66fc99e Initial load
duke
parents:
diff changeset
311 case Bytecodes::_goto_w : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
312 case Bytecodes::_jsr_w : {
2142
8012aa3ccede 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 1972
diff changeset
313 int old_ofs = _s_old->bytecode().get_offset_s4(c_old);
8012aa3ccede 4926272: methodOopDesc::method_from_bcp is unsafe
never
parents: 1972
diff changeset
314 int new_ofs = _s_new->bytecode().get_offset_s4(c_new);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
315 if (_switchable_test) {
a61af66fc99e Initial load
duke
parents:
diff changeset
316 int old_dest = _s_old->bci() + old_ofs;
a61af66fc99e Initial load
duke
parents:
diff changeset
317 int new_dest = _s_new->bci() + new_ofs;
a61af66fc99e Initial load
duke
parents:
diff changeset
318 if (old_ofs < 0 && new_ofs < 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
319 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest))
a61af66fc99e Initial load
duke
parents:
diff changeset
320 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
321 } else if (old_ofs > 0 && new_ofs > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
322 _fwd_jmps->append(old_dest);
a61af66fc99e Initial load
duke
parents:
diff changeset
323 _fwd_jmps->append(new_dest);
a61af66fc99e Initial load
duke
parents:
diff changeset
324 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
325 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
326 }
a61af66fc99e Initial load
duke
parents:
diff changeset
327 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
328 if (old_ofs != new_ofs)
a61af66fc99e Initial load
duke
parents:
diff changeset
329 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
330 }
a61af66fc99e Initial load
duke
parents:
diff changeset
331 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
332 }
a61af66fc99e Initial load
duke
parents:
diff changeset
333
a61af66fc99e Initial load
duke
parents:
diff changeset
334 case Bytecodes::_lookupswitch : // fall through
a61af66fc99e Initial load
duke
parents:
diff changeset
335 case Bytecodes::_tableswitch : {
a61af66fc99e Initial load
duke
parents:
diff changeset
336 if (_switchable_test) {
a61af66fc99e Initial load
duke
parents:
diff changeset
337 address aligned_bcp_old = (address) round_to((intptr_t)_s_old->bcp() + 1, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
338 address aligned_bcp_new = (address) round_to((intptr_t)_s_new->bcp() + 1, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
339 int default_old = (int) Bytes::get_Java_u4(aligned_bcp_old);
a61af66fc99e Initial load
duke
parents:
diff changeset
340 int default_new = (int) Bytes::get_Java_u4(aligned_bcp_new);
a61af66fc99e Initial load
duke
parents:
diff changeset
341 _fwd_jmps->append(_s_old->bci() + default_old);
a61af66fc99e Initial load
duke
parents:
diff changeset
342 _fwd_jmps->append(_s_new->bci() + default_new);
a61af66fc99e Initial load
duke
parents:
diff changeset
343 if (c_old == Bytecodes::_lookupswitch) {
a61af66fc99e Initial load
duke
parents:
diff changeset
344 int npairs_old = (int) Bytes::get_Java_u4(aligned_bcp_old + jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
345 int npairs_new = (int) Bytes::get_Java_u4(aligned_bcp_new + jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
346 if (npairs_old != npairs_new)
a61af66fc99e Initial load
duke
parents:
diff changeset
347 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
348 for (int i = 0; i < npairs_old; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
349 int match_old = (int) Bytes::get_Java_u4(aligned_bcp_old + (2+2*i)*jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
350 int match_new = (int) Bytes::get_Java_u4(aligned_bcp_new + (2+2*i)*jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
351 if (match_old != match_new)
a61af66fc99e Initial load
duke
parents:
diff changeset
352 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
353 int ofs_old = (int) Bytes::get_Java_u4(aligned_bcp_old + (2+2*i+1)*jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
354 int ofs_new = (int) Bytes::get_Java_u4(aligned_bcp_new + (2+2*i+1)*jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
355 _fwd_jmps->append(_s_old->bci() + ofs_old);
a61af66fc99e Initial load
duke
parents:
diff changeset
356 _fwd_jmps->append(_s_new->bci() + ofs_new);
a61af66fc99e Initial load
duke
parents:
diff changeset
357 }
a61af66fc99e Initial load
duke
parents:
diff changeset
358 } else if (c_old == Bytecodes::_tableswitch) {
a61af66fc99e Initial load
duke
parents:
diff changeset
359 int lo_old = (int) Bytes::get_Java_u4(aligned_bcp_old + jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
360 int lo_new = (int) Bytes::get_Java_u4(aligned_bcp_new + jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
361 if (lo_old != lo_new)
a61af66fc99e Initial load
duke
parents:
diff changeset
362 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
363 int hi_old = (int) Bytes::get_Java_u4(aligned_bcp_old + 2*jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
364 int hi_new = (int) Bytes::get_Java_u4(aligned_bcp_new + 2*jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
365 if (hi_old != hi_new)
a61af66fc99e Initial load
duke
parents:
diff changeset
366 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
367 for (int i = 0; i < hi_old - lo_old + 1; i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
368 int ofs_old = (int) Bytes::get_Java_u4(aligned_bcp_old + (3+i)*jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
369 int ofs_new = (int) Bytes::get_Java_u4(aligned_bcp_new + (3+i)*jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
370 _fwd_jmps->append(_s_old->bci() + ofs_old);
a61af66fc99e Initial load
duke
parents:
diff changeset
371 _fwd_jmps->append(_s_new->bci() + ofs_new);
a61af66fc99e Initial load
duke
parents:
diff changeset
372 }
a61af66fc99e Initial load
duke
parents:
diff changeset
373 }
a61af66fc99e Initial load
duke
parents:
diff changeset
374 } else { // !_switchable_test, can use fast rough compare
1565
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
375 int len_old = _s_old->instruction_size();
ab102d5d923e 6939207: refactor constant pool index processing
jrose
parents: 844
diff changeset
376 int len_new = _s_new->instruction_size();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
377 if (len_old != len_new)
a61af66fc99e Initial load
duke
parents:
diff changeset
378 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
379 if (memcmp(_s_old->bcp(), _s_new->bcp(), len_old) != 0)
a61af66fc99e Initial load
duke
parents:
diff changeset
380 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
381 }
a61af66fc99e Initial load
duke
parents:
diff changeset
382 break;
a61af66fc99e Initial load
duke
parents:
diff changeset
383 }
a61af66fc99e Initial load
duke
parents:
diff changeset
384 }
a61af66fc99e Initial load
duke
parents:
diff changeset
385
a61af66fc99e Initial load
duke
parents:
diff changeset
386 return true;
a61af66fc99e Initial load
duke
parents:
diff changeset
387 }
a61af66fc99e Initial load
duke
parents:
diff changeset
388
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
389 bool MethodComparator::pool_constants_same(int cpi_old, int cpi_new) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
390 constantTag tag_old = _old_cp->tag_at(cpi_old);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
391 constantTag tag_new = _new_cp->tag_at(cpi_new);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
392 if (tag_old.is_int() || tag_old.is_float()) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
393 if (tag_old.value() != tag_new.value())
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
394 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
395 if (tag_old.is_int()) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
396 if (_old_cp->int_at(cpi_old) != _new_cp->int_at(cpi_new))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
397 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
398 } else {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
399 // Use jint_cast to compare the bits rather than numerical values.
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
400 // This makes a difference for NaN constants.
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
401 if (jint_cast(_old_cp->float_at(cpi_old)) != jint_cast(_new_cp->float_at(cpi_new)))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
402 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
403 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
404 } else if (tag_old.is_string() && tag_new.is_string()) {
1913
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
405 if (strcmp(_old_cp->string_at_noresolve(cpi_old),
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
406 _new_cp->string_at_noresolve(cpi_new)) != 0)
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
407 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
408 } else if (tag_old.is_klass() || tag_old.is_unresolved_klass()) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
409 // tag_old should be klass - 4881222
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
410 if (! (tag_new.is_unresolved_klass() || tag_new.is_klass()))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
411 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
412 if (_old_cp->klass_at_noresolve(cpi_old) !=
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
413 _new_cp->klass_at_noresolve(cpi_new))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
414 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
415 } else if (tag_old.is_method_type() && tag_new.is_method_type()) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
416 int mti_old = _old_cp->method_type_index_at(cpi_old);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
417 int mti_new = _new_cp->method_type_index_at(cpi_new);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
418 if ((_old_cp->symbol_at(mti_old) != _new_cp->symbol_at(mti_new)))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
419 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
420 } else if (tag_old.is_method_handle() && tag_new.is_method_handle()) {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
421 if (_old_cp->method_handle_ref_kind_at(cpi_old) !=
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
422 _new_cp->method_handle_ref_kind_at(cpi_new))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
423 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
424 int mhi_old = _old_cp->method_handle_index_at(cpi_old);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
425 int mhi_new = _new_cp->method_handle_index_at(cpi_new);
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
426 if ((_old_cp->uncached_klass_ref_at_noresolve(mhi_old) != _new_cp->uncached_klass_ref_at_noresolve(mhi_new)) ||
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
427 (_old_cp->uncached_name_ref_at(mhi_old) != _new_cp->uncached_name_ref_at(mhi_new)) ||
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
428 (_old_cp->uncached_signature_ref_at(mhi_old) != _new_cp->uncached_signature_ref_at(mhi_new)))
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
429 return false;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
430 } else {
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
431 return false; // unknown tag
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
432 }
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
433 return true;
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
434 }
3b2dea75431e 6984311: JSR 292 needs optional bootstrap method parameters
jrose
parents: 1602
diff changeset
435
0
a61af66fc99e Initial load
duke
parents:
diff changeset
436
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2177
diff changeset
437 int MethodComparator::check_stack_and_locals_size(Method* old_method, Method* new_method) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
438 if (old_method->max_stack() != new_method->max_stack()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
439 return 1;
a61af66fc99e Initial load
duke
parents:
diff changeset
440 } else if (old_method->max_locals() != new_method->max_locals()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
441 return 2;
a61af66fc99e Initial load
duke
parents:
diff changeset
442 } else if (old_method->size_of_parameters() != new_method->size_of_parameters()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
443 return 3;
a61af66fc99e Initial load
duke
parents:
diff changeset
444 } else return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
445 }