< prev index next >

src/hotspot/share/oops/klass.cpp

Print this page

 334 
 335   if (length == 0) {
 336     return SECONDARY_SUPERS_BITMAP_EMPTY;
 337   }
 338 
 339   if (length == 1) {
 340     int hash_slot = secondaries->at(0)->hash_slot();
 341     return uintx(1) << hash_slot;
 342   }
 343 
 344   // Invariant: _secondary_supers.length >= population_count(_secondary_supers_bitmap)
 345 
 346   // Don't attempt to hash a table that's completely full, because in
 347   // the case of an absent interface linear probing would not
 348   // terminate.
 349   if (length >= SECONDARY_SUPERS_TABLE_SIZE) {
 350     return SECONDARY_SUPERS_BITMAP_FULL;
 351   }
 352 
 353   {
 354     PerfTraceTime ptt(ClassLoader::perf_secondary_hash_time());
 355 
 356     ResourceMark rm;
 357     uintx bitmap = SECONDARY_SUPERS_BITMAP_EMPTY;
 358     auto hashed_secondaries = new GrowableArray<Klass*>(SECONDARY_SUPERS_TABLE_SIZE,
 359                                                         SECONDARY_SUPERS_TABLE_SIZE, nullptr);
 360 
 361     for (int j = 0; j < length; j++) {
 362       Klass* k = secondaries->at(j);
 363       hash_insert(k, hashed_secondaries, bitmap);
 364     }
 365 
 366     // Pack the hashed secondaries array by copying it into the
 367     // secondaries array, sans nulls, if modification is allowed.
 368     // Otherwise, validate the order.
 369     int i = 0;
 370     for (int slot = 0; slot < SECONDARY_SUPERS_TABLE_SIZE; slot++) {
 371       bool has_element = ((bitmap >> slot) & 1) != 0;
 372       assert(has_element == (hashed_secondaries->at(slot) != nullptr), "");
 373       if (has_element) {
 374         Klass* k = hashed_secondaries->at(slot);

 334 
 335   if (length == 0) {
 336     return SECONDARY_SUPERS_BITMAP_EMPTY;
 337   }
 338 
 339   if (length == 1) {
 340     int hash_slot = secondaries->at(0)->hash_slot();
 341     return uintx(1) << hash_slot;
 342   }
 343 
 344   // Invariant: _secondary_supers.length >= population_count(_secondary_supers_bitmap)
 345 
 346   // Don't attempt to hash a table that's completely full, because in
 347   // the case of an absent interface linear probing would not
 348   // terminate.
 349   if (length >= SECONDARY_SUPERS_TABLE_SIZE) {
 350     return SECONDARY_SUPERS_BITMAP_FULL;
 351   }
 352 
 353   {
 354     //PerfTraceTime ptt(ClassLoader::perf_secondary_hash_time()); // Leyden FIXME
 355 
 356     ResourceMark rm;
 357     uintx bitmap = SECONDARY_SUPERS_BITMAP_EMPTY;
 358     auto hashed_secondaries = new GrowableArray<Klass*>(SECONDARY_SUPERS_TABLE_SIZE,
 359                                                         SECONDARY_SUPERS_TABLE_SIZE, nullptr);
 360 
 361     for (int j = 0; j < length; j++) {
 362       Klass* k = secondaries->at(j);
 363       hash_insert(k, hashed_secondaries, bitmap);
 364     }
 365 
 366     // Pack the hashed secondaries array by copying it into the
 367     // secondaries array, sans nulls, if modification is allowed.
 368     // Otherwise, validate the order.
 369     int i = 0;
 370     for (int slot = 0; slot < SECONDARY_SUPERS_TABLE_SIZE; slot++) {
 371       bool has_element = ((bitmap >> slot) & 1) != 0;
 372       assert(has_element == (hashed_secondaries->at(slot) != nullptr), "");
 373       if (has_element) {
 374         Klass* k = hashed_secondaries->at(slot);
< prev index next >