src/share/vm/oops/klassVtable.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 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  *


1173           }
1174           tty->cr();
1175         }
1176       }
1177     }
1178   }
1179 }
1180 
1181 // Update entry for specific Method*
1182 void klassItable::initialize_with_method(Method* m) {
1183   itableMethodEntry* ime = method_entry(0);
1184   for(int i = 0; i < _size_method_table; i++) {
1185     if (ime->method() == m) {
1186       ime->initialize(m);
1187     }
1188     ime++;
1189   }
1190 }
1191 
1192 #if INCLUDE_JVMTI














1193 void klassItable::adjust_method_entries(Method** old_methods, Method** new_methods,
1194                                         int methods_length, bool * trace_name_printed) {
1195   // search the itable for uses of either obsolete or EMCP methods
1196   for (int j = 0; j < methods_length; j++) {
1197     Method* old_method = old_methods[j];
1198     Method* new_method = new_methods[j];
1199     itableMethodEntry* ime = method_entry(0);
1200 
1201     // The itable can describe more than one interface and the same
1202     // method signature can be specified by more than one interface.
1203     // This means we have to do an exhaustive search to find all the
1204     // old_method references.
1205     for (int i = 0; i < _size_method_table; i++) {
1206       if (ime->method() == old_method) {
1207         ime->initialize(new_method);
1208 
1209         if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
1210           if (!(*trace_name_printed)) {
1211             // RC_TRACE_MESG macro has an embedded ResourceMark
1212             RC_TRACE_MESG(("adjust: name=%s",


   1 /*
   2  * Copyright (c) 1997, 2015, 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  *


1173           }
1174           tty->cr();
1175         }
1176       }
1177     }
1178   }
1179 }
1180 
1181 // Update entry for specific Method*
1182 void klassItable::initialize_with_method(Method* m) {
1183   itableMethodEntry* ime = method_entry(0);
1184   for(int i = 0; i < _size_method_table; i++) {
1185     if (ime->method() == m) {
1186       ime->initialize(m);
1187     }
1188     ime++;
1189   }
1190 }
1191 
1192 #if INCLUDE_JVMTI
1193 // Update old Unsafe.throwIllegalAccessError entries
1194 void klassItable::update_throw_illegal_access_entries() {
1195   itableMethodEntry* ime = method_entry(0);
1196   for(int i = 0; i < _size_method_table; i++) {
1197     Method* m = ime->method();
1198     if (m != NULL && m->is_valid() && m->is_old() &&
1199         m->name() ==  vmSymbols::throwIllegalAccessError_name()) {
1200       // replace old Unsafe.throwIllegalAccessError() method with latest version
1201       ime->initialize(Universe::throw_illegal_access_error());
1202     }
1203     ime++;
1204   }
1205 }
1206 
1207 void klassItable::adjust_method_entries(Method** old_methods, Method** new_methods,
1208                                         int methods_length, bool * trace_name_printed) {
1209   // search the itable for uses of either obsolete or EMCP methods
1210   for (int j = 0; j < methods_length; j++) {
1211     Method* old_method = old_methods[j];
1212     Method* new_method = new_methods[j];
1213     itableMethodEntry* ime = method_entry(0);
1214 
1215     // The itable can describe more than one interface and the same
1216     // method signature can be specified by more than one interface.
1217     // This means we have to do an exhaustive search to find all the
1218     // old_method references.
1219     for (int i = 0; i < _size_method_table; i++) {
1220       if (ime->method() == old_method) {
1221         ime->initialize(new_method);
1222 
1223         if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
1224           if (!(*trace_name_printed)) {
1225             // RC_TRACE_MESG macro has an embedded ResourceMark
1226             RC_TRACE_MESG(("adjust: name=%s",