src/share/vm/oops/klassVtable.hpp

Print this page


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


 274                                            return &((itableMethodEntry*)method_start())[i]; }
 275 
 276   int size_offset_table()                { return _size_offset_table; }
 277 
 278   // Initialization
 279   void initialize_itable(bool checkconstraints, TRAPS);
 280 
 281   // Updates
 282   void initialize_with_method(Method* m);
 283 
 284 #if INCLUDE_JVMTI
 285   // RedefineClasses() API support:
 286   // if any entry of this itable points to any of old_methods,
 287   // replace it with the corresponding new_method.
 288   // trace_name_printed is set to true if the current call has
 289   // printed the klass name so that other routines in the adjust_*
 290   // group don't print the klass name.
 291   void adjust_method_entries(Method** old_methods, Method** new_methods,
 292                              int methods_length, bool * trace_name_printed);
 293   bool check_no_old_or_obsolete_entries();

 294   void dump_itable();
 295 #endif // INCLUDE_JVMTI
 296 
 297   // Setup of itable
 298   static int assign_itable_indices_for_interface(Klass* klass);
 299   static int method_count_for_interface(Klass* klass);
 300   static int compute_itable_size(Array<Klass*>* transitive_interfaces);
 301   static void setup_itable_offset_table(instanceKlassHandle klass);
 302 
 303   // Resolving of method to index
 304   static Method* method_for_itable_index(Klass* klass, int itable_index);
 305 
 306   // Debugging/Statistics
 307   static void print_statistics() PRODUCT_RETURN;
 308  private:
 309   intptr_t* vtable_start() const { return ((intptr_t*)_klass()) + _table_offset; }
 310   intptr_t* method_start() const { return vtable_start() + _size_offset_table * itableOffsetEntry::size(); }
 311 
 312   // Helper methods
 313   static int  calc_itable_size(int num_interfaces, int num_methods) { return (num_interfaces * itableOffsetEntry::size()) + (num_methods * itableMethodEntry::size()); }
   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  *


 274                                            return &((itableMethodEntry*)method_start())[i]; }
 275 
 276   int size_offset_table()                { return _size_offset_table; }
 277 
 278   // Initialization
 279   void initialize_itable(bool checkconstraints, TRAPS);
 280 
 281   // Updates
 282   void initialize_with_method(Method* m);
 283 
 284 #if INCLUDE_JVMTI
 285   // RedefineClasses() API support:
 286   // if any entry of this itable points to any of old_methods,
 287   // replace it with the corresponding new_method.
 288   // trace_name_printed is set to true if the current call has
 289   // printed the klass name so that other routines in the adjust_*
 290   // group don't print the klass name.
 291   void adjust_method_entries(Method** old_methods, Method** new_methods,
 292                              int methods_length, bool * trace_name_printed);
 293   bool check_no_old_or_obsolete_entries();
 294   void update_throw_illegal_access_entries();
 295   void dump_itable();
 296 #endif // INCLUDE_JVMTI
 297 
 298   // Setup of itable
 299   static int assign_itable_indices_for_interface(Klass* klass);
 300   static int method_count_for_interface(Klass* klass);
 301   static int compute_itable_size(Array<Klass*>* transitive_interfaces);
 302   static void setup_itable_offset_table(instanceKlassHandle klass);
 303 
 304   // Resolving of method to index
 305   static Method* method_for_itable_index(Klass* klass, int itable_index);
 306 
 307   // Debugging/Statistics
 308   static void print_statistics() PRODUCT_RETURN;
 309  private:
 310   intptr_t* vtable_start() const { return ((intptr_t*)_klass()) + _table_offset; }
 311   intptr_t* method_start() const { return vtable_start() + _size_offset_table * itableOffsetEntry::size(); }
 312 
 313   // Helper methods
 314   static int  calc_itable_size(int num_interfaces, int num_methods) { return (num_interfaces * itableOffsetEntry::size()) + (num_methods * itableMethodEntry::size()); }