< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page

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

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