< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page

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

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