< prev index next >

src/share/vm/oops/klassVtable.cpp

Print this page




1314 
1315   itableMethodEntry* method_entry() const { return _method_entry; }
1316 
1317   void doit(Klass* intf, int method_count) {
1318     int offset = ((address)_method_entry) - _klass_begin;
1319     _offset_entry->initialize(intf, offset);
1320     _offset_entry++;
1321     _method_entry += method_count;
1322   }
1323 };
1324 
1325 int klassItable::compute_itable_size(Array<Klass*>* transitive_interfaces) {
1326   // Count no of interfaces and total number of interface methods
1327   CountInterfacesClosure cic;
1328   visit_all_interfaces(transitive_interfaces, &cic);
1329 
1330   // There's alway an extra itable entry so we can null-terminate it.
1331   int itable_size = calc_itable_size(cic.nof_interfaces() + 1, cic.nof_methods());
1332 
1333   // Statistics
1334   update_stats(itable_size * HeapWordSize);
1335 
1336   return itable_size;
1337 }
1338 
1339 
1340 // Fill out offset table and interface klasses into the itable space
1341 void klassItable::setup_itable_offset_table(instanceKlassHandle klass) {
1342   if (klass->itable_length() == 0) return;
1343   assert(!klass->is_interface(), "Should have zero length itable");
1344 
1345   // Count no of interfaces and total number of interface methods
1346   CountInterfacesClosure cic;
1347   visit_all_interfaces(klass->transitive_interfaces(), &cic);
1348   int nof_methods    = cic.nof_methods();
1349   int nof_interfaces = cic.nof_interfaces();
1350 
1351   // Add one extra entry so we can null-terminate the table
1352   nof_interfaces++;
1353 
1354   assert(compute_itable_size(klass->transitive_interfaces()) ==




1314 
1315   itableMethodEntry* method_entry() const { return _method_entry; }
1316 
1317   void doit(Klass* intf, int method_count) {
1318     int offset = ((address)_method_entry) - _klass_begin;
1319     _offset_entry->initialize(intf, offset);
1320     _offset_entry++;
1321     _method_entry += method_count;
1322   }
1323 };
1324 
1325 int klassItable::compute_itable_size(Array<Klass*>* transitive_interfaces) {
1326   // Count no of interfaces and total number of interface methods
1327   CountInterfacesClosure cic;
1328   visit_all_interfaces(transitive_interfaces, &cic);
1329 
1330   // There's alway an extra itable entry so we can null-terminate it.
1331   int itable_size = calc_itable_size(cic.nof_interfaces() + 1, cic.nof_methods());
1332 
1333   // Statistics
1334   update_stats(itable_size * wordSize);
1335 
1336   return itable_size;
1337 }
1338 
1339 
1340 // Fill out offset table and interface klasses into the itable space
1341 void klassItable::setup_itable_offset_table(instanceKlassHandle klass) {
1342   if (klass->itable_length() == 0) return;
1343   assert(!klass->is_interface(), "Should have zero length itable");
1344 
1345   // Count no of interfaces and total number of interface methods
1346   CountInterfacesClosure cic;
1347   visit_all_interfaces(klass->transitive_interfaces(), &cic);
1348   int nof_methods    = cic.nof_methods();
1349   int nof_interfaces = cic.nof_interfaces();
1350 
1351   // Add one extra entry so we can null-terminate the table
1352   nof_interfaces++;
1353 
1354   assert(compute_itable_size(klass->transitive_interfaces()) ==


< prev index next >