src/share/vm/prims/methodComparator.cpp

Sun, 15 Sep 2013 15:28:58 +0200

author
goetz
date
Sun, 15 Sep 2013 15:28:58 +0200
changeset 6470
abe03600372a
parent 4037
da91efe96a93
child 6876
710a3c8b516e
permissions
-rw-r--r--

8024468: PPC64 (part 201): cppInterpreter: implement bytecode profiling
Summary: Implement profiling for c2 jit compilation. Also enable new cppInterpreter features.
Reviewed-by: kvn

duke@435 1 /*
coleenp@4037 2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "oops/oop.inline.hpp"
coleenp@2497 27 #include "oops/symbol.hpp"
stefank@2314 28 #include "prims/jvmtiRedefineClassesTrace.hpp"
stefank@2314 29 #include "prims/methodComparator.hpp"
stefank@2314 30 #include "runtime/handles.inline.hpp"
stefank@2314 31 #include "utilities/globalDefinitions.hpp"
duke@435 32
duke@435 33 BytecodeStream *MethodComparator::_s_old;
duke@435 34 BytecodeStream *MethodComparator::_s_new;
coleenp@4037 35 ConstantPool* MethodComparator::_old_cp;
coleenp@4037 36 ConstantPool* MethodComparator::_new_cp;
duke@435 37 BciMap *MethodComparator::_bci_map;
duke@435 38 bool MethodComparator::_switchable_test;
duke@435 39 GrowableArray<int> *MethodComparator::_fwd_jmps;
duke@435 40
coleenp@4037 41 bool MethodComparator::methods_EMCP(Method* old_method, Method* new_method) {
duke@435 42 if (old_method->code_size() != new_method->code_size())
duke@435 43 return false;
duke@435 44 if (check_stack_and_locals_size(old_method, new_method) != 0) {
duke@435 45 // RC_TRACE macro has an embedded ResourceMark
duke@435 46 RC_TRACE(0x00800000, ("Methods %s non-comparable with diagnosis %d",
duke@435 47 old_method->name()->as_C_string(),
duke@435 48 check_stack_and_locals_size(old_method, new_method)));
duke@435 49 return false;
duke@435 50 }
duke@435 51
duke@435 52 _old_cp = old_method->constants();
duke@435 53 _new_cp = new_method->constants();
duke@435 54 BytecodeStream s_old(old_method);
duke@435 55 BytecodeStream s_new(new_method);
duke@435 56 _s_old = &s_old;
duke@435 57 _s_new = &s_new;
duke@435 58 _switchable_test = false;
duke@435 59 Bytecodes::Code c_old, c_new;
duke@435 60
duke@435 61 while ((c_old = s_old.next()) >= 0) {
duke@435 62 if ((c_new = s_new.next()) < 0 || c_old != c_new)
duke@435 63 return false;
duke@435 64
duke@435 65 if (! args_same(c_old, c_new))
duke@435 66 return false;
duke@435 67 }
duke@435 68 return true;
duke@435 69 }
duke@435 70
duke@435 71
coleenp@4037 72 bool MethodComparator::methods_switchable(Method* old_method, Method* new_method,
duke@435 73 BciMap &bci_map) {
duke@435 74 if (old_method->code_size() > new_method->code_size())
duke@435 75 // Something has definitely been deleted in the new method, compared to the old one.
duke@435 76 return false;
duke@435 77
duke@435 78 if (! check_stack_and_locals_size(old_method, new_method))
duke@435 79 return false;
duke@435 80
duke@435 81 _old_cp = old_method->constants();
duke@435 82 _new_cp = new_method->constants();
duke@435 83 BytecodeStream s_old(old_method);
duke@435 84 BytecodeStream s_new(new_method);
duke@435 85 _s_old = &s_old;
duke@435 86 _s_new = &s_new;
duke@435 87 _bci_map = &bci_map;
duke@435 88 _switchable_test = true;
duke@435 89 GrowableArray<int> fwd_jmps(16);
duke@435 90 _fwd_jmps = &fwd_jmps;
duke@435 91 Bytecodes::Code c_old, c_new;
duke@435 92
duke@435 93 while ((c_old = s_old.next()) >= 0) {
duke@435 94 if ((c_new = s_new.next()) < 0)
duke@435 95 return false;
duke@435 96 if (! (c_old == c_new && args_same(c_old, c_new))) {
duke@435 97 int old_bci = s_old.bci();
duke@435 98 int new_st_bci = s_new.bci();
duke@435 99 bool found_match = false;
duke@435 100 do {
duke@435 101 c_new = s_new.next();
duke@435 102 if (c_new == c_old && args_same(c_old, c_new)) {
duke@435 103 found_match = true;
duke@435 104 break;
duke@435 105 }
duke@435 106 } while (c_new >= 0);
duke@435 107 if (! found_match)
duke@435 108 return false;
duke@435 109 int new_end_bci = s_new.bci();
duke@435 110 bci_map.store_fragment_location(old_bci, new_st_bci, new_end_bci);
duke@435 111 }
duke@435 112 }
duke@435 113
duke@435 114 // Now we can test all forward jumps
duke@435 115 for (int i = 0; i < fwd_jmps.length() / 2; i++) {
duke@435 116 if (! bci_map.old_and_new_locations_same(fwd_jmps.at(i*2), fwd_jmps.at(i*2+1))) {
duke@435 117 RC_TRACE(0x00800000,
duke@435 118 ("Fwd jump miss: old dest = %d, calc new dest = %d, act new dest = %d",
duke@435 119 fwd_jmps.at(i*2), bci_map.new_bci_for_old(fwd_jmps.at(i*2)),
duke@435 120 fwd_jmps.at(i*2+1)));
duke@435 121 return false;
duke@435 122 }
duke@435 123 }
duke@435 124
duke@435 125 return true;
duke@435 126 }
duke@435 127
duke@435 128
duke@435 129 bool MethodComparator::args_same(Bytecodes::Code c_old, Bytecodes::Code c_new) {
duke@435 130 // BytecodeStream returns the correct standard Java bytecodes for various "fast"
duke@435 131 // bytecode versions, so we don't have to bother about them here..
duke@435 132 switch (c_old) {
duke@435 133 case Bytecodes::_new : // fall through
duke@435 134 case Bytecodes::_anewarray : // fall through
duke@435 135 case Bytecodes::_multianewarray : // fall through
duke@435 136 case Bytecodes::_checkcast : // fall through
duke@435 137 case Bytecodes::_instanceof : {
jrose@1920 138 u2 cpi_old = _s_old->get_index_u2();
jrose@1920 139 u2 cpi_new = _s_new->get_index_u2();
duke@435 140 if ((_old_cp->klass_at_noresolve(cpi_old) != _new_cp->klass_at_noresolve(cpi_new)))
duke@435 141 return false;
duke@435 142 if (c_old == Bytecodes::_multianewarray &&
duke@435 143 *(jbyte*)(_s_old->bcp() + 3) != *(jbyte*)(_s_new->bcp() + 3))
duke@435 144 return false;
duke@435 145 break;
duke@435 146 }
duke@435 147
duke@435 148 case Bytecodes::_getstatic : // fall through
duke@435 149 case Bytecodes::_putstatic : // fall through
duke@435 150 case Bytecodes::_getfield : // fall through
duke@435 151 case Bytecodes::_putfield : // fall through
duke@435 152 case Bytecodes::_invokevirtual : // fall through
duke@435 153 case Bytecodes::_invokespecial : // fall through
duke@435 154 case Bytecodes::_invokestatic : // fall through
duke@435 155 case Bytecodes::_invokeinterface : {
jrose@2268 156 int cpci_old = _s_old->get_index_u2_cpcache();
jrose@2268 157 int cpci_new = _s_new->get_index_u2_cpcache();
duke@435 158 // Check if the names of classes, field/method names and signatures at these indexes
duke@435 159 // are the same. Indices which are really into constantpool cache (rather than constant
duke@435 160 // pool itself) are accepted by the constantpool query routines below.
duke@435 161 if ((_old_cp->klass_ref_at_noresolve(cpci_old) != _new_cp->klass_ref_at_noresolve(cpci_new)) ||
duke@435 162 (_old_cp->name_ref_at(cpci_old) != _new_cp->name_ref_at(cpci_new)) ||
duke@435 163 (_old_cp->signature_ref_at(cpci_old) != _new_cp->signature_ref_at(cpci_new)))
duke@435 164 return false;
duke@435 165 break;
duke@435 166 }
jrose@2268 167 case Bytecodes::_invokedynamic: {
jrose@2268 168 int cpci_old = _s_old->get_index_u4();
jrose@2268 169 int cpci_new = _s_new->get_index_u4();
coleenp@4037 170
jrose@2268 171 // Check if the names of classes, field/method names and signatures at these indexes
jrose@2268 172 // are the same. Indices which are really into constantpool cache (rather than constant
jrose@2268 173 // pool itself) are accepted by the constantpool query routines below.
jrose@2268 174 if ((_old_cp->name_ref_at(cpci_old) != _new_cp->name_ref_at(cpci_new)) ||
jrose@2268 175 (_old_cp->signature_ref_at(cpci_old) != _new_cp->signature_ref_at(cpci_new)))
jrose@2268 176 return false;
coleenp@4037 177
coleenp@4037 178 // Translate object indexes to constant pool cache indexes.
coleenp@4037 179 cpci_old = _old_cp->invokedynamic_cp_cache_index(cpci_old);
coleenp@4037 180 cpci_new = _new_cp->invokedynamic_cp_cache_index(cpci_new);
coleenp@4037 181
coleenp@4037 182 int cpi_old = _old_cp->cache()->entry_at(cpci_old)->constant_pool_index();
coleenp@4037 183 int cpi_new = _new_cp->cache()->entry_at(cpci_new)->constant_pool_index();
jrose@2268 184 int bsm_old = _old_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_old);
jrose@2268 185 int bsm_new = _new_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_new);
jrose@2268 186 if (!pool_constants_same(bsm_old, bsm_new))
jrose@2268 187 return false;
jrose@2268 188 int cnt_old = _old_cp->invoke_dynamic_argument_count_at(cpi_old);
jrose@2268 189 int cnt_new = _new_cp->invoke_dynamic_argument_count_at(cpi_new);
jrose@2268 190 if (cnt_old != cnt_new)
jrose@2268 191 return false;
jrose@2268 192 for (int arg_i = 0; arg_i < cnt_old; arg_i++) {
jrose@2268 193 int idx_old = _old_cp->invoke_dynamic_argument_index_at(cpi_old, arg_i);
jrose@2268 194 int idx_new = _new_cp->invoke_dynamic_argument_index_at(cpi_new, arg_i);
jrose@2268 195 if (!pool_constants_same(idx_old, idx_new))
jrose@2268 196 return false;
jrose@2268 197 }
jrose@2268 198 break;
jrose@2268 199 }
duke@435 200
duke@435 201 case Bytecodes::_ldc : // fall through
duke@435 202 case Bytecodes::_ldc_w : {
never@2462 203 Bytecode_loadconstant ldc_old(_s_old->method(), _s_old->bci());
never@2462 204 Bytecode_loadconstant ldc_new(_s_new->method(), _s_new->bci());
never@2462 205 int cpi_old = ldc_old.pool_index();
never@2462 206 int cpi_new = ldc_new.pool_index();
jrose@2268 207 if (!pool_constants_same(cpi_old, cpi_new))
jrose@2268 208 return false;
duke@435 209 break;
duke@435 210 }
duke@435 211
duke@435 212 case Bytecodes::_ldc2_w : {
jrose@1920 213 u2 cpi_old = _s_old->get_index_u2();
jrose@1920 214 u2 cpi_new = _s_new->get_index_u2();
duke@435 215 constantTag tag_old = _old_cp->tag_at(cpi_old);
duke@435 216 constantTag tag_new = _new_cp->tag_at(cpi_new);
duke@435 217 if (tag_old.value() != tag_new.value())
duke@435 218 return false;
duke@435 219 if (tag_old.is_long()) {
duke@435 220 if (_old_cp->long_at(cpi_old) != _new_cp->long_at(cpi_new))
duke@435 221 return false;
duke@435 222 } else {
jrose@1929 223 // Use jlong_cast to compare the bits rather than numerical values.
jrose@1929 224 // This makes a difference for NaN constants.
jrose@1929 225 if (jlong_cast(_old_cp->double_at(cpi_old)) != jlong_cast(_new_cp->double_at(cpi_new)))
duke@435 226 return false;
duke@435 227 }
duke@435 228 break;
duke@435 229 }
duke@435 230
duke@435 231 case Bytecodes::_bipush :
duke@435 232 if (_s_old->bcp()[1] != _s_new->bcp()[1])
duke@435 233 return false;
duke@435 234 break;
duke@435 235
duke@435 236 case Bytecodes::_sipush :
jrose@1920 237 if (_s_old->get_index_u2() != _s_new->get_index_u2())
duke@435 238 return false;
duke@435 239 break;
duke@435 240
duke@435 241 case Bytecodes::_aload : // fall through
duke@435 242 case Bytecodes::_astore : // fall through
duke@435 243 case Bytecodes::_dload : // fall through
duke@435 244 case Bytecodes::_dstore : // fall through
duke@435 245 case Bytecodes::_fload : // fall through
duke@435 246 case Bytecodes::_fstore : // fall through
duke@435 247 case Bytecodes::_iload : // fall through
duke@435 248 case Bytecodes::_istore : // fall through
duke@435 249 case Bytecodes::_lload : // fall through
duke@435 250 case Bytecodes::_lstore : // fall through
duke@435 251 case Bytecodes::_ret :
duke@435 252 if (_s_old->is_wide() != _s_new->is_wide())
duke@435 253 return false;
duke@435 254 if (_s_old->get_index() != _s_new->get_index())
duke@435 255 return false;
duke@435 256 break;
duke@435 257
duke@435 258 case Bytecodes::_goto : // fall through
duke@435 259 case Bytecodes::_if_acmpeq : // fall through
duke@435 260 case Bytecodes::_if_acmpne : // fall through
duke@435 261 case Bytecodes::_if_icmpeq : // fall through
duke@435 262 case Bytecodes::_if_icmpne : // fall through
duke@435 263 case Bytecodes::_if_icmplt : // fall through
duke@435 264 case Bytecodes::_if_icmpge : // fall through
duke@435 265 case Bytecodes::_if_icmpgt : // fall through
duke@435 266 case Bytecodes::_if_icmple : // fall through
duke@435 267 case Bytecodes::_ifeq : // fall through
duke@435 268 case Bytecodes::_ifne : // fall through
duke@435 269 case Bytecodes::_iflt : // fall through
duke@435 270 case Bytecodes::_ifge : // fall through
duke@435 271 case Bytecodes::_ifgt : // fall through
duke@435 272 case Bytecodes::_ifle : // fall through
duke@435 273 case Bytecodes::_ifnonnull : // fall through
duke@435 274 case Bytecodes::_ifnull : // fall through
duke@435 275 case Bytecodes::_jsr : {
never@2462 276 int old_ofs = _s_old->bytecode().get_offset_s2(c_old);
never@2462 277 int new_ofs = _s_new->bytecode().get_offset_s2(c_new);
duke@435 278 if (_switchable_test) {
duke@435 279 int old_dest = _s_old->bci() + old_ofs;
duke@435 280 int new_dest = _s_new->bci() + new_ofs;
duke@435 281 if (old_ofs < 0 && new_ofs < 0) {
duke@435 282 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest))
duke@435 283 return false;
duke@435 284 } else if (old_ofs > 0 && new_ofs > 0) {
duke@435 285 _fwd_jmps->append(old_dest);
duke@435 286 _fwd_jmps->append(new_dest);
duke@435 287 } else {
duke@435 288 return false;
duke@435 289 }
duke@435 290 } else {
duke@435 291 if (old_ofs != new_ofs)
duke@435 292 return false;
duke@435 293 }
duke@435 294 break;
duke@435 295 }
duke@435 296
duke@435 297 case Bytecodes::_iinc :
duke@435 298 if (_s_old->is_wide() != _s_new->is_wide())
duke@435 299 return false;
duke@435 300 if (! _s_old->is_wide()) {
jrose@1920 301 // We could use get_index_u1 and get_constant_u1, but it's simpler to grab both bytes at once:
jrose@1920 302 if (Bytes::get_Java_u2(_s_old->bcp() + 1) != Bytes::get_Java_u2(_s_new->bcp() + 1))
duke@435 303 return false;
duke@435 304 } else {
jrose@1920 305 // We could use get_index_u2 and get_constant_u2, but it's simpler to grab all four bytes at once:
duke@435 306 if (Bytes::get_Java_u4(_s_old->bcp() + 1) != Bytes::get_Java_u4(_s_new->bcp() + 1))
duke@435 307 return false;
duke@435 308 }
duke@435 309 break;
duke@435 310
duke@435 311 case Bytecodes::_goto_w : // fall through
duke@435 312 case Bytecodes::_jsr_w : {
never@2462 313 int old_ofs = _s_old->bytecode().get_offset_s4(c_old);
never@2462 314 int new_ofs = _s_new->bytecode().get_offset_s4(c_new);
duke@435 315 if (_switchable_test) {
duke@435 316 int old_dest = _s_old->bci() + old_ofs;
duke@435 317 int new_dest = _s_new->bci() + new_ofs;
duke@435 318 if (old_ofs < 0 && new_ofs < 0) {
duke@435 319 if (! _bci_map->old_and_new_locations_same(old_dest, new_dest))
duke@435 320 return false;
duke@435 321 } else if (old_ofs > 0 && new_ofs > 0) {
duke@435 322 _fwd_jmps->append(old_dest);
duke@435 323 _fwd_jmps->append(new_dest);
duke@435 324 } else {
duke@435 325 return false;
duke@435 326 }
duke@435 327 } else {
duke@435 328 if (old_ofs != new_ofs)
duke@435 329 return false;
duke@435 330 }
duke@435 331 break;
duke@435 332 }
duke@435 333
duke@435 334 case Bytecodes::_lookupswitch : // fall through
duke@435 335 case Bytecodes::_tableswitch : {
duke@435 336 if (_switchable_test) {
duke@435 337 address aligned_bcp_old = (address) round_to((intptr_t)_s_old->bcp() + 1, jintSize);
duke@435 338 address aligned_bcp_new = (address) round_to((intptr_t)_s_new->bcp() + 1, jintSize);
duke@435 339 int default_old = (int) Bytes::get_Java_u4(aligned_bcp_old);
duke@435 340 int default_new = (int) Bytes::get_Java_u4(aligned_bcp_new);
duke@435 341 _fwd_jmps->append(_s_old->bci() + default_old);
duke@435 342 _fwd_jmps->append(_s_new->bci() + default_new);
duke@435 343 if (c_old == Bytecodes::_lookupswitch) {
duke@435 344 int npairs_old = (int) Bytes::get_Java_u4(aligned_bcp_old + jintSize);
duke@435 345 int npairs_new = (int) Bytes::get_Java_u4(aligned_bcp_new + jintSize);
duke@435 346 if (npairs_old != npairs_new)
duke@435 347 return false;
duke@435 348 for (int i = 0; i < npairs_old; i++) {
duke@435 349 int match_old = (int) Bytes::get_Java_u4(aligned_bcp_old + (2+2*i)*jintSize);
duke@435 350 int match_new = (int) Bytes::get_Java_u4(aligned_bcp_new + (2+2*i)*jintSize);
duke@435 351 if (match_old != match_new)
duke@435 352 return false;
duke@435 353 int ofs_old = (int) Bytes::get_Java_u4(aligned_bcp_old + (2+2*i+1)*jintSize);
duke@435 354 int ofs_new = (int) Bytes::get_Java_u4(aligned_bcp_new + (2+2*i+1)*jintSize);
duke@435 355 _fwd_jmps->append(_s_old->bci() + ofs_old);
duke@435 356 _fwd_jmps->append(_s_new->bci() + ofs_new);
duke@435 357 }
duke@435 358 } else if (c_old == Bytecodes::_tableswitch) {
duke@435 359 int lo_old = (int) Bytes::get_Java_u4(aligned_bcp_old + jintSize);
duke@435 360 int lo_new = (int) Bytes::get_Java_u4(aligned_bcp_new + jintSize);
duke@435 361 if (lo_old != lo_new)
duke@435 362 return false;
duke@435 363 int hi_old = (int) Bytes::get_Java_u4(aligned_bcp_old + 2*jintSize);
duke@435 364 int hi_new = (int) Bytes::get_Java_u4(aligned_bcp_new + 2*jintSize);
duke@435 365 if (hi_old != hi_new)
duke@435 366 return false;
duke@435 367 for (int i = 0; i < hi_old - lo_old + 1; i++) {
duke@435 368 int ofs_old = (int) Bytes::get_Java_u4(aligned_bcp_old + (3+i)*jintSize);
duke@435 369 int ofs_new = (int) Bytes::get_Java_u4(aligned_bcp_new + (3+i)*jintSize);
duke@435 370 _fwd_jmps->append(_s_old->bci() + ofs_old);
duke@435 371 _fwd_jmps->append(_s_new->bci() + ofs_new);
duke@435 372 }
duke@435 373 }
duke@435 374 } else { // !_switchable_test, can use fast rough compare
jrose@1920 375 int len_old = _s_old->instruction_size();
jrose@1920 376 int len_new = _s_new->instruction_size();
duke@435 377 if (len_old != len_new)
duke@435 378 return false;
duke@435 379 if (memcmp(_s_old->bcp(), _s_new->bcp(), len_old) != 0)
duke@435 380 return false;
duke@435 381 }
duke@435 382 break;
duke@435 383 }
duke@435 384 }
duke@435 385
duke@435 386 return true;
duke@435 387 }
duke@435 388
jrose@2268 389 bool MethodComparator::pool_constants_same(int cpi_old, int cpi_new) {
jrose@2268 390 constantTag tag_old = _old_cp->tag_at(cpi_old);
jrose@2268 391 constantTag tag_new = _new_cp->tag_at(cpi_new);
jrose@2268 392 if (tag_old.is_int() || tag_old.is_float()) {
jrose@2268 393 if (tag_old.value() != tag_new.value())
jrose@2268 394 return false;
jrose@2268 395 if (tag_old.is_int()) {
jrose@2268 396 if (_old_cp->int_at(cpi_old) != _new_cp->int_at(cpi_new))
jrose@2268 397 return false;
jrose@2268 398 } else {
jrose@2268 399 // Use jint_cast to compare the bits rather than numerical values.
jrose@2268 400 // This makes a difference for NaN constants.
jrose@2268 401 if (jint_cast(_old_cp->float_at(cpi_old)) != jint_cast(_new_cp->float_at(cpi_new)))
jrose@2268 402 return false;
jrose@2268 403 }
coleenp@4037 404 } else if (tag_old.is_string() && tag_new.is_string()) {
jrose@2268 405 if (strcmp(_old_cp->string_at_noresolve(cpi_old),
jrose@2268 406 _new_cp->string_at_noresolve(cpi_new)) != 0)
jrose@2268 407 return false;
jrose@2268 408 } else if (tag_old.is_klass() || tag_old.is_unresolved_klass()) {
jrose@2268 409 // tag_old should be klass - 4881222
jrose@2268 410 if (! (tag_new.is_unresolved_klass() || tag_new.is_klass()))
jrose@2268 411 return false;
jrose@2268 412 if (_old_cp->klass_at_noresolve(cpi_old) !=
jrose@2268 413 _new_cp->klass_at_noresolve(cpi_new))
jrose@2268 414 return false;
jrose@2268 415 } else if (tag_old.is_method_type() && tag_new.is_method_type()) {
jrose@2268 416 int mti_old = _old_cp->method_type_index_at(cpi_old);
jrose@2268 417 int mti_new = _new_cp->method_type_index_at(cpi_new);
jrose@2268 418 if ((_old_cp->symbol_at(mti_old) != _new_cp->symbol_at(mti_new)))
jrose@2268 419 return false;
jrose@2268 420 } else if (tag_old.is_method_handle() && tag_new.is_method_handle()) {
jrose@2268 421 if (_old_cp->method_handle_ref_kind_at(cpi_old) !=
jrose@2268 422 _new_cp->method_handle_ref_kind_at(cpi_new))
jrose@2268 423 return false;
jrose@2268 424 int mhi_old = _old_cp->method_handle_index_at(cpi_old);
jrose@2268 425 int mhi_new = _new_cp->method_handle_index_at(cpi_new);
jrose@2268 426 if ((_old_cp->uncached_klass_ref_at_noresolve(mhi_old) != _new_cp->uncached_klass_ref_at_noresolve(mhi_new)) ||
jrose@2268 427 (_old_cp->uncached_name_ref_at(mhi_old) != _new_cp->uncached_name_ref_at(mhi_new)) ||
jrose@2268 428 (_old_cp->uncached_signature_ref_at(mhi_old) != _new_cp->uncached_signature_ref_at(mhi_new)))
jrose@2268 429 return false;
jrose@2268 430 } else {
jrose@2268 431 return false; // unknown tag
jrose@2268 432 }
jrose@2268 433 return true;
jrose@2268 434 }
jrose@2268 435
duke@435 436
coleenp@4037 437 int MethodComparator::check_stack_and_locals_size(Method* old_method, Method* new_method) {
duke@435 438 if (old_method->max_stack() != new_method->max_stack()) {
duke@435 439 return 1;
duke@435 440 } else if (old_method->max_locals() != new_method->max_locals()) {
duke@435 441 return 2;
duke@435 442 } else if (old_method->size_of_parameters() != new_method->size_of_parameters()) {
duke@435 443 return 3;
duke@435 444 } else return 0;
duke@435 445 }

mercurial