< prev index next >

src/hotspot/share/classfile/fieldLayoutBuilder.cpp

Print this page




 544     case T_ARRAY:
 545       if (group != _static_fields) _nonstatic_oopmap_count++;
 546       group->add_oop_field(fs);
 547       break;
 548     case T_VALUETYPE: {
 549       if (group == _static_fields) {
 550         // static fields are never flattened
 551         group->add_oop_field(fs);
 552       } else {
 553         _has_flattening_information = true;
 554         // Flattening decision to be taken here
 555         // This code assumes all verification have been performed before
 556         // (field is a flattenable field, field's type has been loaded
 557         // and it is an inline klass
 558         Klass* klass =
 559             SystemDictionary::resolve_flattenable_field_or_fail(&fs,
 560                 Handle(THREAD, _cfp->_loader_data->class_loader()),
 561                 _cfp->_protection_domain, true, CHECK);
 562         assert(klass != NULL, "Sanity check");
 563         ValueKlass* vk = ValueKlass::cast(klass);
 564         bool flattened = (ValueFieldMaxFlatSize < 0)
 565                          || (vk->size_helper() * HeapWordSize) <= ValueFieldMaxFlatSize;


 566         if (flattened) {
 567           group->add_flattened_field(fs, vk);
 568           _nonstatic_oopmap_count += vk->nonstatic_oop_map_count();
 569           fs.set_flattened(true);
 570         } else {
 571           _nonstatic_oopmap_count++;
 572           group->add_oop_field(fs);
 573         }
 574       }
 575       break;
 576     }
 577     default:
 578       fatal("Something wrong?");
 579     }
 580   }
 581 }
 582 /* Field sorting for inline classes:
 583  *   - because inline classes are immutable, the @Contended annotation is ignored
 584  *     when computing their layout (with only read operation, there's no false
 585  *     sharing issue)




 544     case T_ARRAY:
 545       if (group != _static_fields) _nonstatic_oopmap_count++;
 546       group->add_oop_field(fs);
 547       break;
 548     case T_VALUETYPE: {
 549       if (group == _static_fields) {
 550         // static fields are never flattened
 551         group->add_oop_field(fs);
 552       } else {
 553         _has_flattening_information = true;
 554         // Flattening decision to be taken here
 555         // This code assumes all verification have been performed before
 556         // (field is a flattenable field, field's type has been loaded
 557         // and it is an inline klass
 558         Klass* klass =
 559             SystemDictionary::resolve_flattenable_field_or_fail(&fs,
 560                 Handle(THREAD, _cfp->_loader_data->class_loader()),
 561                 _cfp->_protection_domain, true, CHECK);
 562         assert(klass != NULL, "Sanity check");
 563         ValueKlass* vk = ValueKlass::cast(klass);
 564         bool has_flattenable_size = (ValueFieldMaxFlatSize < 0)
 565                          || (vk->size_helper() * HeapWordSize) <= ValueFieldMaxFlatSize;
 566         // volatile fields are currently never flattened, this could change in the future
 567         bool flattened = !fs.access_flags().is_volatile() && has_flattenable_size;
 568         if (flattened) {
 569           group->add_flattened_field(fs, vk);
 570           _nonstatic_oopmap_count += vk->nonstatic_oop_map_count();
 571           fs.set_flattened(true);
 572         } else {
 573           _nonstatic_oopmap_count++;
 574           group->add_oop_field(fs);
 575         }
 576       }
 577       break;
 578     }
 579     default:
 580       fatal("Something wrong?");
 581     }
 582   }
 583 }
 584 /* Field sorting for inline classes:
 585  *   - because inline classes are immutable, the @Contended annotation is ignored
 586  *     when computing their layout (with only read operation, there's no false
 587  *     sharing issue)


< prev index next >