int init_generic_signature_start_slot() { int length = _fields->length(); int num_fields = 0; int skipped_generic_signature_slots = 0; FieldInfo* fi; AccessFlags flags; /* Scan from 0 to the current _index. Count the number of generic signature slots for field[0] to field[_index - 1]. */ for (int i = 0; i < _index; i++) { fi = FieldInfo::from_field_array(_fields, i); flags.set_flags(fi->access_flags()); if (flags.field_has_generic_signature()) { length --; skipped_generic_signature_slots ++; } } /* Scan from the current _index. */ for (int i = _index; i*FieldInfo::field_slots < length; i++) { fi = FieldInfo::from_field_array(_fields, i); flags.set_flags(fi->access_flags()); if (flags.field_has_generic_signature()) { length --; } num_fields ++; } _generic_signature_slot = length + skipped_generic_signature_slots; assert(_generic_signature_slot <= _fields->length(), ""); return num_fields; }
Klass::Klass() { Klass* k = this; { // Preinitialize supertype information. // A later call to initialize_supers() may update these settings: set_super(NULL); for (juint i = 0; i < Klass::primary_super_limit(); i++) { _primary_supers[i] = NULL; } set_secondary_supers(NULL); _primary_supers[0] = k; set_super_check_offset(in_bytes(primary_supers_offset())); } set_java_mirror(NULL); set_modifier_flags(0); set_layout_helper(Klass::_lh_neutral_value); set_name(NULL); AccessFlags af; af.set_flags(0); set_access_flags(af); set_subklass(NULL); set_next_sibling(NULL); set_next_link(NULL); set_alloc_count(0); TRACE_SET_KLASS_TRACE_ID(this, 0); set_prototype_header(markOopDesc::prototype()); set_biased_lock_revocation_count(0); set_last_biased_lock_bulk_revocation_time(0); // The klass doesn't have any references at this point. clear_modified_oops(); clear_accumulated_modified_oops(); }
// ------------------------------------------------------------------ // ciFieldLayout::fill_in_instance_fields // // Set up the instance fields in this ciFieldLayout. void ciFieldLayout::fill_in_instance_fields(GrowableArray<BasicType>* fieldtypes, GrowableArray<int>* fieldoffsets, GrowableArray<int>* aflags, int& pos, klassOop current) { Klass* k = current->klass_part(); assert(k->oop_is_instance(), "must be instanceKlass"); instanceKlass* ik = (instanceKlass*)k; klassOop super = k->super(); if (super) { fill_in_instance_fields(fieldtypes, fieldoffsets, aflags, pos, super); } // Fill in this klass's instance fields. typeArrayOop field_list = ik->fields(); constantPoolOop cpool = ik->constants(); uint num_fields = field_list->length(); for (uint i = 0; i < num_fields; i += instanceKlass::next_offset) { AccessFlags flags; flags.set_flags(field_list->short_at(i + instanceKlass::access_flags_offset)); if (!flags.is_static()) { // This is an instance field. Add it to our list. int field_offset = ik->offset_from_fields( i ); // Add the type to our list. symbolOop type_sym = cpool->symbol_at(field_list->short_at(i+ instanceKlass::signature_index_offset)); BasicType field_type; field_type = type2field[FieldType::basic_type(type_sym)]; fieldtypes->at_put_grow(pos, field_type, T_VOID); aflags->at_put_grow(pos, flags.as_int(), 0); // The field offset we set here includes the header_size fieldoffsets->at_put_grow(pos, field_offset, 0); pos++; } } }
klassOop Klass::base_create_klass_oop(KlassHandle& klass, int size, const Klass_vtbl& vtbl, TRAPS) { size = align_object_size(size); // allocate and initialize vtable Klass* kl = (Klass*) vtbl.allocate_permanent(klass, size, CHECK_NULL); klassOop k = kl->as_klassOop(); { // Preinitialize supertype information. // A later call to initialize_supers() may update these settings: kl->set_super(NULL); for (juint i = 0; i < Klass::primary_super_limit(); i++) { kl->_primary_supers[i] = NULL; } kl->set_secondary_supers(NULL); oop_store_without_check((oop*) &kl->_primary_supers[0], k); kl->set_super_check_offset(in_bytes(primary_supers_offset())); } kl->set_java_mirror(NULL); kl->set_modifier_flags(0); kl->set_layout_helper(Klass::_lh_neutral_value); kl->set_name(NULL); AccessFlags af; af.set_flags(0); kl->set_access_flags(af); kl->set_subklass(NULL); kl->set_next_sibling(NULL); kl->set_alloc_count(0); kl->set_alloc_size(0); TRACE_SET_KLASS_TRACE_ID(kl, 0); kl->set_prototype_header(markOopDesc::prototype()); kl->set_biased_lock_revocation_count(0); kl->set_last_biased_lock_bulk_revocation_time(0); return k; }
// Accessors for current field AccessFlags access_flags() const { AccessFlags flags; flags.set_flags(field()->access_flags()); return flags; }