src/share/vm/prims/methodComparator.cpp

Print this page


   1 /*
   2  * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
   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  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 385 
 386   return true;
 387 }
 388 
 389 bool MethodComparator::pool_constants_same(int cpi_old, int cpi_new) {
 390   constantTag tag_old = _old_cp->tag_at(cpi_old);
 391   constantTag tag_new = _new_cp->tag_at(cpi_new);
 392   if (tag_old.is_int() || tag_old.is_float()) {
 393     if (tag_old.value() != tag_new.value())
 394       return false;
 395     if (tag_old.is_int()) {
 396       if (_old_cp->int_at(cpi_old) != _new_cp->int_at(cpi_new))
 397         return false;
 398     } else {
 399       // Use jint_cast to compare the bits rather than numerical values.
 400       // This makes a difference for NaN constants.
 401       if (jint_cast(_old_cp->float_at(cpi_old)) != jint_cast(_new_cp->float_at(cpi_new)))
 402         return false;
 403     }
 404   } else if (tag_old.is_string() && tag_new.is_string()) {



 405     if (strcmp(_old_cp->string_at_noresolve(cpi_old),
 406                _new_cp->string_at_noresolve(cpi_new)) != 0)
 407       return false;
 408   } else if (tag_old.is_klass() || tag_old.is_unresolved_klass()) {
 409     // tag_old should be klass - 4881222
 410     if (! (tag_new.is_unresolved_klass() || tag_new.is_klass()))
 411       return false;
 412     if (_old_cp->klass_at_noresolve(cpi_old) !=
 413         _new_cp->klass_at_noresolve(cpi_new))
 414       return false;
 415   } else if (tag_old.is_method_type() && tag_new.is_method_type()) {
 416     int mti_old = _old_cp->method_type_index_at(cpi_old);
 417     int mti_new = _new_cp->method_type_index_at(cpi_new);
 418     if ((_old_cp->symbol_at(mti_old) != _new_cp->symbol_at(mti_new)))
 419       return false;
 420   } else if (tag_old.is_method_handle() && tag_new.is_method_handle()) {
 421     if (_old_cp->method_handle_ref_kind_at(cpi_old) !=
 422         _new_cp->method_handle_ref_kind_at(cpi_new))
 423       return false;
 424     int mhi_old = _old_cp->method_handle_index_at(cpi_old);


   1 /*
   2  * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
   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  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 385 
 386   return true;
 387 }
 388 
 389 bool MethodComparator::pool_constants_same(int cpi_old, int cpi_new) {
 390   constantTag tag_old = _old_cp->tag_at(cpi_old);
 391   constantTag tag_new = _new_cp->tag_at(cpi_new);
 392   if (tag_old.is_int() || tag_old.is_float()) {
 393     if (tag_old.value() != tag_new.value())
 394       return false;
 395     if (tag_old.is_int()) {
 396       if (_old_cp->int_at(cpi_old) != _new_cp->int_at(cpi_new))
 397         return false;
 398     } else {
 399       // Use jint_cast to compare the bits rather than numerical values.
 400       // This makes a difference for NaN constants.
 401       if (jint_cast(_old_cp->float_at(cpi_old)) != jint_cast(_new_cp->float_at(cpi_new)))
 402         return false;
 403     }
 404   } else if (tag_old.is_string() && tag_new.is_string()) {
 405     if (_old_cp->is_pseudo_string_at(cpi_old) || _new_cp->is_pseudo_string_at(cpi_new)) {
 406       return (_old_cp->is_pseudo_string_at(cpi_old) == _new_cp->is_pseudo_string_at(cpi_new));
 407     }
 408     if (strcmp(_old_cp->string_at_noresolve(cpi_old),
 409                _new_cp->string_at_noresolve(cpi_new)) != 0)
 410       return false;
 411   } else if (tag_old.is_klass() || tag_old.is_unresolved_klass()) {
 412     // tag_old should be klass - 4881222
 413     if (! (tag_new.is_unresolved_klass() || tag_new.is_klass()))
 414       return false;
 415     if (_old_cp->klass_at_noresolve(cpi_old) !=
 416         _new_cp->klass_at_noresolve(cpi_new))
 417       return false;
 418   } else if (tag_old.is_method_type() && tag_new.is_method_type()) {
 419     int mti_old = _old_cp->method_type_index_at(cpi_old);
 420     int mti_new = _new_cp->method_type_index_at(cpi_new);
 421     if ((_old_cp->symbol_at(mti_old) != _new_cp->symbol_at(mti_new)))
 422       return false;
 423   } else if (tag_old.is_method_handle() && tag_new.is_method_handle()) {
 424     if (_old_cp->method_handle_ref_kind_at(cpi_old) !=
 425         _new_cp->method_handle_ref_kind_at(cpi_new))
 426       return false;
 427     int mhi_old = _old_cp->method_handle_index_at(cpi_old);