< prev index next >

src/share/vm/oops/klassVtable.cpp

Print this page


 997   }
 998 }
 999 #endif // INCLUDE_JVMTI
1000 
1001 // CDS/RedefineClasses support - clear vtables so they can be reinitialized
1002 void klassVtable::clear_vtable() {
1003   for (int i = 0; i < _length; i++) table()[i].clear();
1004 }
1005 
1006 bool klassVtable::is_initialized() {
1007   return _length == 0 || table()[0].method() != NULL;
1008 }
1009 
1010 //-----------------------------------------------------------------------------------------
1011 // Itable code
1012 
1013 // Initialize a itableMethodEntry
1014 void itableMethodEntry::initialize(Method* m) {
1015   if (m == NULL) return;
1016 

1017   if (MetaspaceShared::is_in_shared_space((void*)&_method) &&
1018      !MetaspaceShared::remapped_readwrite()) {
1019     // At runtime initialize_itable is rerun as part of link_class_impl()
1020     // for a shared class loaded by the non-boot loader.
1021     // The dumptime itable method entry should be the same as the runtime entry.
1022     assert(_method == m, "sanity");
1023   } else {
1024     _method = m;
1025   }


1026 }
1027 
1028 klassItable::klassItable(InstanceKlass* klass) {
1029   _klass = klass;
1030 
1031   if (klass->itable_length() > 0) {
1032     itableOffsetEntry* offset_entry = (itableOffsetEntry*)klass->start_of_itable();
1033     if (offset_entry  != NULL && offset_entry->interface_klass() != NULL) { // Check that itable is initialized
1034       // First offset entry points to the first method_entry
1035       intptr_t* method_entry  = (intptr_t *)(((address)klass) + offset_entry->offset());
1036       intptr_t* end         = klass->end_of_itable();
1037 
1038       _table_offset      = (intptr_t*)offset_entry - (intptr_t*)klass;
1039       _size_offset_table = (method_entry - ((intptr_t*)offset_entry)) / itableOffsetEntry::size();
1040       _size_method_table = (end - method_entry)                  / itableMethodEntry::size();
1041       assert(_table_offset >= 0 && _size_offset_table >= 0 && _size_method_table >= 0, "wrong computation");
1042       return;
1043     }
1044   }
1045 




 997   }
 998 }
 999 #endif // INCLUDE_JVMTI
1000 
1001 // CDS/RedefineClasses support - clear vtables so they can be reinitialized
1002 void klassVtable::clear_vtable() {
1003   for (int i = 0; i < _length; i++) table()[i].clear();
1004 }
1005 
1006 bool klassVtable::is_initialized() {
1007   return _length == 0 || table()[0].method() != NULL;
1008 }
1009 
1010 //-----------------------------------------------------------------------------------------
1011 // Itable code
1012 
1013 // Initialize a itableMethodEntry
1014 void itableMethodEntry::initialize(Method* m) {
1015   if (m == NULL) return;
1016 
1017 #ifndef PRODUCT
1018   if (MetaspaceShared::is_in_shared_space((void*)&_method) &&
1019      !MetaspaceShared::remapped_readwrite()) {
1020     // At runtime initialize_itable is rerun as part of link_class_impl()
1021     // for a shared class loaded by the non-boot loader.
1022     // The dumptime itable method entry should be the same as the runtime entry.
1023     assert(_method == m, "sanity");


1024   }
1025 #endif
1026   _method = m;
1027 }
1028 
1029 klassItable::klassItable(InstanceKlass* klass) {
1030   _klass = klass;
1031 
1032   if (klass->itable_length() > 0) {
1033     itableOffsetEntry* offset_entry = (itableOffsetEntry*)klass->start_of_itable();
1034     if (offset_entry  != NULL && offset_entry->interface_klass() != NULL) { // Check that itable is initialized
1035       // First offset entry points to the first method_entry
1036       intptr_t* method_entry  = (intptr_t *)(((address)klass) + offset_entry->offset());
1037       intptr_t* end         = klass->end_of_itable();
1038 
1039       _table_offset      = (intptr_t*)offset_entry - (intptr_t*)klass;
1040       _size_offset_table = (method_entry - ((intptr_t*)offset_entry)) / itableOffsetEntry::size();
1041       _size_method_table = (end - method_entry)                  / itableMethodEntry::size();
1042       assert(_table_offset >= 0 && _size_offset_table >= 0 && _size_method_table >= 0, "wrong computation");
1043       return;
1044     }
1045   }
1046 


< prev index next >