< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page

 377 
 378   if (length == 0) {
 379     return SECONDARY_SUPERS_BITMAP_EMPTY;
 380   }
 381 
 382   if (length == 1) {
 383     int hash_slot = secondaries->at(0)->hash_slot();
 384     return uintx(1) << hash_slot;
 385   }
 386 
 387   // Invariant: _secondary_supers.length >= population_count(_secondary_supers_bitmap)
 388 
 389   // Don't attempt to hash a table that's completely full, because in
 390   // the case of an absent interface linear probing would not
 391   // terminate.
 392   if (length >= SECONDARY_SUPERS_TABLE_SIZE) {
 393     return SECONDARY_SUPERS_BITMAP_FULL;
 394   }
 395 
 396   {
 397     PerfTraceTime ptt(ClassLoader::perf_secondary_hash_time());
 398 
 399     ResourceMark rm;
 400     uintx bitmap = SECONDARY_SUPERS_BITMAP_EMPTY;
 401     auto hashed_secondaries = new GrowableArray<Klass*>(SECONDARY_SUPERS_TABLE_SIZE,
 402                                                         SECONDARY_SUPERS_TABLE_SIZE, nullptr);
 403 
 404     for (int j = 0; j < length; j++) {
 405       Klass* k = secondaries->at(j);
 406       hash_insert(k, hashed_secondaries, bitmap);
 407     }
 408 
 409     // Pack the hashed secondaries array by copying it into the
 410     // secondaries array, sans nulls, if modification is allowed.
 411     // Otherwise, validate the order.
 412     int i = 0;
 413     for (int slot = 0; slot < SECONDARY_SUPERS_TABLE_SIZE; slot++) {
 414       bool has_element = ((bitmap >> slot) & 1) != 0;
 415       assert(has_element == (hashed_secondaries->at(slot) != nullptr), "");
 416       if (has_element) {
 417         Klass* k = hashed_secondaries->at(slot);

 377 
 378   if (length == 0) {
 379     return SECONDARY_SUPERS_BITMAP_EMPTY;
 380   }
 381 
 382   if (length == 1) {
 383     int hash_slot = secondaries->at(0)->hash_slot();
 384     return uintx(1) << hash_slot;
 385   }
 386 
 387   // Invariant: _secondary_supers.length >= population_count(_secondary_supers_bitmap)
 388 
 389   // Don't attempt to hash a table that's completely full, because in
 390   // the case of an absent interface linear probing would not
 391   // terminate.
 392   if (length >= SECONDARY_SUPERS_TABLE_SIZE) {
 393     return SECONDARY_SUPERS_BITMAP_FULL;
 394   }
 395 
 396   {
 397     //PerfTraceTime ptt(ClassLoader::perf_secondary_hash_time()); // Leyden FIXME
 398 
 399     ResourceMark rm;
 400     uintx bitmap = SECONDARY_SUPERS_BITMAP_EMPTY;
 401     auto hashed_secondaries = new GrowableArray<Klass*>(SECONDARY_SUPERS_TABLE_SIZE,
 402                                                         SECONDARY_SUPERS_TABLE_SIZE, nullptr);
 403 
 404     for (int j = 0; j < length; j++) {
 405       Klass* k = secondaries->at(j);
 406       hash_insert(k, hashed_secondaries, bitmap);
 407     }
 408 
 409     // Pack the hashed secondaries array by copying it into the
 410     // secondaries array, sans nulls, if modification is allowed.
 411     // Otherwise, validate the order.
 412     int i = 0;
 413     for (int slot = 0; slot < SECONDARY_SUPERS_TABLE_SIZE; slot++) {
 414       bool has_element = ((bitmap >> slot) & 1) != 0;
 415       assert(has_element == (hashed_secondaries->at(slot) != nullptr), "");
 416       if (has_element) {
 417         Klass* k = hashed_secondaries->at(slot);
< prev index next >