< prev index next >

src/hotspot/share/classfile/fieldLayoutBuilder.cpp

Print this page


 734       }
 735     }
 736   }
 737 
 738   nonstatic_oop_maps->compact();
 739 
 740   int instance_end = align_up(_layout->last_block()->offset(), wordSize);
 741   int static_fields_end = align_up(_static_layout->last_block()->offset(), wordSize);
 742   int static_fields_size = (static_fields_end -
 743       InstanceMirrorKlass::offset_of_static_fields()) / wordSize;
 744   int nonstatic_field_end = align_up(_layout->last_block()->offset(), heapOopSize);
 745 
 746   // Pass back information needed for InstanceKlass creation
 747 
 748   _info->oop_map_blocks = nonstatic_oop_maps;
 749   _info->_instance_size = align_object_size(instance_end / wordSize);
 750   _info->_static_field_size = static_fields_size;
 751   _info->_nonstatic_field_size = (nonstatic_field_end - instanceOopDesc::base_offset_in_bytes()) / heapOopSize;
 752   _info->_has_nonstatic_fields = _has_nonstatic_fields;
 753 

 754   if (PrintFieldLayout) {
 755     ResourceMark rm;
 756     tty->print_cr("Layout of class %s", _classname->as_C_string());
 757     tty->print_cr("Instance fields:");
 758     _layout->print(tty, false, _super_klass);
 759     tty->print_cr("Static fields:");
 760     _static_layout->print(tty, true, NULL);
 761     tty->print_cr("Instance size = %d bytes", _info->_instance_size * wordSize);
 762     tty->print_cr("---");
 763   }

 764 }
 765 
 766 void FieldLayoutBuilder::build_layout() {
 767   if (_classname == vmSymbols::java_lang_ref_Reference()) {
 768     compute_java_lang_ref_Reference_layout();
 769   } else if (_classname == vmSymbols::java_lang_Boolean() ||
 770              _classname == vmSymbols::java_lang_Character() ||
 771              _classname == vmSymbols::java_lang_Float() ||
 772              _classname == vmSymbols::java_lang_Double() ||
 773              _classname == vmSymbols::java_lang_Byte() ||
 774              _classname == vmSymbols::java_lang_Short() ||
 775              _classname == vmSymbols::java_lang_Integer() ||
 776              _classname == vmSymbols::java_lang_Long()) {
 777     compute_boxing_class_layout();
 778   } else {
 779     compute_regular_layout();
 780   }
 781 }
 782 


 734       }
 735     }
 736   }
 737 
 738   nonstatic_oop_maps->compact();
 739 
 740   int instance_end = align_up(_layout->last_block()->offset(), wordSize);
 741   int static_fields_end = align_up(_static_layout->last_block()->offset(), wordSize);
 742   int static_fields_size = (static_fields_end -
 743       InstanceMirrorKlass::offset_of_static_fields()) / wordSize;
 744   int nonstatic_field_end = align_up(_layout->last_block()->offset(), heapOopSize);
 745 
 746   // Pass back information needed for InstanceKlass creation
 747 
 748   _info->oop_map_blocks = nonstatic_oop_maps;
 749   _info->_instance_size = align_object_size(instance_end / wordSize);
 750   _info->_static_field_size = static_fields_size;
 751   _info->_nonstatic_field_size = (nonstatic_field_end - instanceOopDesc::base_offset_in_bytes()) / heapOopSize;
 752   _info->_has_nonstatic_fields = _has_nonstatic_fields;
 753 
 754 #ifndef PRODUCT
 755   if (PrintFieldLayout) {
 756     ResourceMark rm;
 757     tty->print_cr("Layout of class %s", _classname->as_C_string());
 758     tty->print_cr("Instance fields:");
 759     _layout->print(tty, false, _super_klass);
 760     tty->print_cr("Static fields:");
 761     _static_layout->print(tty, true, NULL);
 762     tty->print_cr("Instance size = %d bytes", _info->_instance_size * wordSize);
 763     tty->print_cr("---");
 764   }
 765 #endif
 766 }
 767 
 768 void FieldLayoutBuilder::build_layout() {
 769   if (_classname == vmSymbols::java_lang_ref_Reference()) {
 770     compute_java_lang_ref_Reference_layout();
 771   } else if (_classname == vmSymbols::java_lang_Boolean() ||
 772              _classname == vmSymbols::java_lang_Character() ||
 773              _classname == vmSymbols::java_lang_Float() ||
 774              _classname == vmSymbols::java_lang_Double() ||
 775              _classname == vmSymbols::java_lang_Byte() ||
 776              _classname == vmSymbols::java_lang_Short() ||
 777              _classname == vmSymbols::java_lang_Integer() ||
 778              _classname == vmSymbols::java_lang_Long()) {
 779     compute_boxing_class_layout();
 780   } else {
 781     compute_regular_layout();
 782   }
 783 }
 784 
< prev index next >