2647 align_object_offset(vtable_size) +
2648 align_object_offset(itable_size)) * wordSize;
2649 next_static_double_offset = next_static_oop_offset +
2650 (fac.static_oop_count * heapOopSize);
2651 if ( fac.static_double_count &&
2652 (Universe::field_type_should_be_aligned(T_DOUBLE) ||
2653 Universe::field_type_should_be_aligned(T_LONG)) ) {
2654 next_static_double_offset = align_size_up(next_static_double_offset, BytesPerLong);
2655 }
2656
2657 next_static_word_offset = next_static_double_offset +
2658 (fac.static_double_count * BytesPerLong);
2659 next_static_short_offset = next_static_word_offset +
2660 (fac.static_word_count * BytesPerInt);
2661 next_static_byte_offset = next_static_short_offset +
2662 (fac.static_short_count * BytesPerShort);
2663 next_static_type_offset = align_size_up((next_static_byte_offset +
2664 fac.static_byte_count ), wordSize );
2665 static_field_size = (next_static_type_offset -
2666 next_static_oop_offset) / wordSize;
2667 first_nonstatic_field_offset = (instanceOopDesc::header_size() +
2668 nonstatic_field_size) * wordSize;
2669 next_nonstatic_field_offset = first_nonstatic_field_offset;
2670
2671 // Add fake fields for java.lang.Class instances (also see below)
2672 if (class_name() == vmSymbols::java_lang_Class() && class_loader.is_null()) {
2673 java_lang_Class_fix_pre(&methods, &fac, CHECK_(nullHandle));
2674 }
2675
2676 // Add a fake "discovered" field if it is not present
2677 // for compatibility with earlier jdk's.
2678 if (class_name() == vmSymbols::java_lang_ref_Reference()
2679 && class_loader.is_null()) {
2680 java_lang_ref_Reference_fix_pre(&fields, cp, &fac, CHECK_(nullHandle));
2681 }
2682 // end of "discovered" field compactibility fix
2683
2684 int nonstatic_double_count = fac.nonstatic_double_count;
2685 int nonstatic_word_count = fac.nonstatic_word_count;
2686 int nonstatic_short_count = fac.nonstatic_short_count;
2687 int nonstatic_byte_count = fac.nonstatic_byte_count;
2688 int nonstatic_oop_count = fac.nonstatic_oop_count;
2717 nonstatic_oop_count -= fake_oop_count;
2718 first_nonstatic_oop_offset = first_nonstatic_field_offset;
2719 } else {
2720 first_nonstatic_oop_offset = 0; // will be set for first oop field
2721 }
2722
2723 #ifndef PRODUCT
2724 if( PrintCompactFieldsSavings ) {
2725 next_nonstatic_double_offset = next_nonstatic_field_offset +
2726 (nonstatic_oop_count * heapOopSize);
2727 if ( nonstatic_double_count > 0 ) {
2728 next_nonstatic_double_offset = align_size_up(next_nonstatic_double_offset, BytesPerLong);
2729 }
2730 next_nonstatic_word_offset = next_nonstatic_double_offset +
2731 (nonstatic_double_count * BytesPerLong);
2732 next_nonstatic_short_offset = next_nonstatic_word_offset +
2733 (nonstatic_word_count * BytesPerInt);
2734 next_nonstatic_byte_offset = next_nonstatic_short_offset +
2735 (nonstatic_short_count * BytesPerShort);
2736 next_nonstatic_type_offset = align_size_up((next_nonstatic_byte_offset +
2737 nonstatic_byte_count ), wordSize );
2738 orig_nonstatic_field_size = nonstatic_field_size +
2739 ((next_nonstatic_type_offset - first_nonstatic_field_offset)/wordSize);
2740 }
2741 #endif
2742 bool compact_fields = CompactFields;
2743 int allocation_style = FieldsAllocationStyle;
2744 if( allocation_style < 0 || allocation_style > 1 ) { // Out of range?
2745 assert(false, "0 <= FieldsAllocationStyle <= 1");
2746 allocation_style = 1; // Optimistic
2747 }
2748
2749 // The next classes have predefined hard-coded fields offsets
2750 // (see in JavaClasses::compute_hard_coded_offsets()).
2751 // Use default fields allocation order for them.
2752 if( (allocation_style != 0 || compact_fields ) && class_loader.is_null() &&
2753 (class_name() == vmSymbols::java_lang_AssertionStatusDirectives() ||
2754 class_name() == vmSymbols::java_lang_Class() ||
2755 class_name() == vmSymbols::java_lang_ClassLoader() ||
2756 class_name() == vmSymbols::java_lang_ref_Reference() ||
2757 class_name() == vmSymbols::java_lang_ref_SoftReference() ||
2758 class_name() == vmSymbols::java_lang_StackTraceElement() ||
2759 class_name() == vmSymbols::java_lang_String() ||
2774 // Fields order: oops, longs/doubles, ints, shorts/chars, bytes
2775 next_nonstatic_oop_offset = next_nonstatic_field_offset;
2776 next_nonstatic_double_offset = next_nonstatic_oop_offset +
2777 (nonstatic_oop_count * heapOopSize);
2778 } else if( allocation_style == 1 ) {
2779 // Fields order: longs/doubles, ints, shorts/chars, bytes, oops
2780 next_nonstatic_double_offset = next_nonstatic_field_offset;
2781 } else {
2782 ShouldNotReachHere();
2783 }
2784
2785 int nonstatic_oop_space_count = 0;
2786 int nonstatic_word_space_count = 0;
2787 int nonstatic_short_space_count = 0;
2788 int nonstatic_byte_space_count = 0;
2789 int nonstatic_oop_space_offset;
2790 int nonstatic_word_space_offset;
2791 int nonstatic_short_space_offset;
2792 int nonstatic_byte_space_offset;
2793
2794 bool compact_into_header = (UseCompressedOops &&
2795 allocation_style == 1 && compact_fields &&
2796 !super_has_nonstatic_fields);
2797
2798 if( compact_into_header || nonstatic_double_count > 0 ) {
2799 int offset;
2800 // Pack something in with the header if no super klass has done so.
2801 if (compact_into_header) {
2802 offset = oopDesc::klass_gap_offset_in_bytes();
2803 } else {
2804 offset = next_nonstatic_double_offset;
2805 }
2806 next_nonstatic_double_offset = align_size_up(offset, BytesPerLong);
2807 if( compact_fields && offset != next_nonstatic_double_offset ) {
2808 // Allocate available fields into the gap before double field.
2809 int length = next_nonstatic_double_offset - offset;
2810 assert(length == BytesPerInt, "");
2811 nonstatic_word_space_offset = offset;
2812 if( nonstatic_word_count > 0 ) {
2813 nonstatic_word_count -= 1;
2814 nonstatic_word_space_count = 1; // Only one will fit
2815 length -= BytesPerInt;
2816 offset += BytesPerInt;
2817 }
2818 nonstatic_short_space_offset = offset;
2819 while( length >= BytesPerShort && nonstatic_short_count > 0 ) {
2820 nonstatic_short_count -= 1;
2821 nonstatic_short_space_count += 1;
2822 length -= BytesPerShort;
2823 offset += BytesPerShort;
2824 }
2825 nonstatic_byte_space_offset = offset;
2826 while( length > 0 && nonstatic_byte_count > 0 ) {
2827 nonstatic_byte_count -= 1;
2828 nonstatic_byte_space_count += 1;
2829 length -= 1;
2830 }
2831 // Allocate oop field in the gap if there are no other fields for that.
2832 nonstatic_oop_space_offset = offset;
2833 if(!compact_into_header && length >= heapOopSize &&
2834 nonstatic_oop_count > 0 &&
2835 allocation_style != 0 ) { // when oop fields not first
2836 nonstatic_oop_count -= 1;
2837 nonstatic_oop_space_count = 1; // Only one will fit
2838 length -= heapOopSize;
2839 offset += heapOopSize;
2840 }
2841 }
2842 }
2843
2844 next_nonstatic_word_offset = next_nonstatic_double_offset +
2845 (nonstatic_double_count * BytesPerLong);
2846 next_nonstatic_short_offset = next_nonstatic_word_offset +
2847 (nonstatic_word_count * BytesPerInt);
2848 next_nonstatic_byte_offset = next_nonstatic_short_offset +
2849 (nonstatic_short_count * BytesPerShort);
2850
2851 int notaligned_offset;
2852 if( allocation_style == 0 ) {
2853 notaligned_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
2854 } else { // allocation_style == 1
2855 next_nonstatic_oop_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
2856 if( nonstatic_oop_count > 0 ) {
2857 notaligned_offset = next_nonstatic_oop_offset;
2858 next_nonstatic_oop_offset = align_size_up(next_nonstatic_oop_offset, heapOopSize);
2859 }
2860 notaligned_offset = next_nonstatic_oop_offset + (nonstatic_oop_count * heapOopSize);
2861 }
2862 next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize );
2863 nonstatic_field_size = nonstatic_field_size + ((next_nonstatic_type_offset
2864 - first_nonstatic_field_offset)/wordSize);
2865
2866 // Iterate over fields again and compute correct offsets.
2867 // The field allocation type was temporarily stored in the offset slot.
2868 // oop fields are located before non-oop fields (static and non-static).
2869 int len = fields->length();
2870 for (int i = 0; i < len; i += instanceKlass::next_offset) {
2871 int real_offset;
2872 FieldAllocationType atype = (FieldAllocationType) fields->ushort_at(i+4);
2873 switch (atype) {
2874 case STATIC_OOP:
2875 real_offset = next_static_oop_offset;
2876 next_static_oop_offset += heapOopSize;
2877 break;
2878 case STATIC_BYTE:
2879 real_offset = next_static_byte_offset;
2880 next_static_byte_offset += 1;
2881 break;
2882 case STATIC_SHORT:
2883 real_offset = next_static_short_offset;
2884 next_static_short_offset += BytesPerShort;
2945 } else {
2946 real_offset = next_nonstatic_word_offset;
2947 next_nonstatic_word_offset += BytesPerInt;
2948 }
2949 break;
2950 case NONSTATIC_ALIGNED_DOUBLE:
2951 case NONSTATIC_DOUBLE:
2952 real_offset = next_nonstatic_double_offset;
2953 next_nonstatic_double_offset += BytesPerLong;
2954 break;
2955 default:
2956 ShouldNotReachHere();
2957 }
2958 fields->short_at_put(i+4, extract_low_short_from_int(real_offset) );
2959 fields->short_at_put(i+5, extract_high_short_from_int(real_offset) );
2960 }
2961
2962 // Size of instances
2963 int instance_size;
2964
2965 instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
2966
2967 assert(instance_size == align_object_size(instanceOopDesc::header_size() + nonstatic_field_size), "consistent layout helper value");
2968
2969 // Size of non-static oop map blocks (in words) allocated at end of klass
2970 int nonstatic_oop_map_size = compute_oop_map_size(super_klass, nonstatic_oop_map_count, first_nonstatic_oop_offset);
2971
2972 // Compute reference type
2973 ReferenceType rt;
2974 if (super_klass() == NULL) {
2975 rt = REF_NONE;
2976 } else {
2977 rt = super_klass->reference_type();
2978 }
2979
2980 // We can now create the basic klassOop for this klass
2981 klassOop ik = oopFactory::new_instanceKlass(
2982 vtable_size, itable_size,
2983 static_field_size, nonstatic_oop_map_size,
2984 rt, CHECK_(nullHandle));
2985 instanceKlassHandle this_klass (THREAD, ik);
2986
2987 assert(this_klass->static_field_size() == static_field_size &&
3105 const char * from = Klass::cast(this_klass())->external_name();
3106 if (this_klass->java_super() != NULL) {
3107 tty->print("RESOLVE %s %s\n", from, instanceKlass::cast(this_klass->java_super())->external_name());
3108 }
3109 // print out each of the interface classes referred to by this class.
3110 objArrayHandle local_interfaces(THREAD, this_klass->local_interfaces());
3111 if (!local_interfaces.is_null()) {
3112 int length = local_interfaces->length();
3113 for (int i = 0; i < length; i++) {
3114 klassOop k = klassOop(local_interfaces->obj_at(i));
3115 instanceKlass* to_class = instanceKlass::cast(k);
3116 const char * to = to_class->external_name();
3117 tty->print("RESOLVE %s %s\n", from, to);
3118 }
3119 }
3120 }
3121
3122 #ifndef PRODUCT
3123 if( PrintCompactFieldsSavings ) {
3124 if( nonstatic_field_size < orig_nonstatic_field_size ) {
3125 tty->print("[Saved %d of %3d words in %s]\n",
3126 orig_nonstatic_field_size - nonstatic_field_size,
3127 orig_nonstatic_field_size, this_klass->external_name());
3128 } else if( nonstatic_field_size > orig_nonstatic_field_size ) {
3129 tty->print("[Wasted %d over %3d words in %s]\n",
3130 nonstatic_field_size - orig_nonstatic_field_size,
3131 orig_nonstatic_field_size, this_klass->external_name());
3132 }
3133 }
3134 #endif
3135
3136 // preserve result across HandleMark
3137 preserve_this_klass = this_klass();
3138 }
3139
3140 // Create new handle outside HandleMark
3141 instanceKlassHandle this_klass (THREAD, preserve_this_klass);
3142 debug_only(this_klass->as_klassOop()->verify();)
3143
3144 return this_klass;
3145 }
3146
3147
3148 int ClassFileParser::compute_oop_map_size(instanceKlassHandle super, int nonstatic_oop_map_count, int first_nonstatic_oop_offset) {
3149 int map_size = super.is_null() ? 0 : super->nonstatic_oop_map_size();
3150 if (nonstatic_oop_map_count > 0) {
3151 // We have oops to add to map
|
2647 align_object_offset(vtable_size) +
2648 align_object_offset(itable_size)) * wordSize;
2649 next_static_double_offset = next_static_oop_offset +
2650 (fac.static_oop_count * heapOopSize);
2651 if ( fac.static_double_count &&
2652 (Universe::field_type_should_be_aligned(T_DOUBLE) ||
2653 Universe::field_type_should_be_aligned(T_LONG)) ) {
2654 next_static_double_offset = align_size_up(next_static_double_offset, BytesPerLong);
2655 }
2656
2657 next_static_word_offset = next_static_double_offset +
2658 (fac.static_double_count * BytesPerLong);
2659 next_static_short_offset = next_static_word_offset +
2660 (fac.static_word_count * BytesPerInt);
2661 next_static_byte_offset = next_static_short_offset +
2662 (fac.static_short_count * BytesPerShort);
2663 next_static_type_offset = align_size_up((next_static_byte_offset +
2664 fac.static_byte_count ), wordSize );
2665 static_field_size = (next_static_type_offset -
2666 next_static_oop_offset) / wordSize;
2667 first_nonstatic_field_offset = instanceOopDesc::base_offset_in_bytes() +
2668 nonstatic_field_size * heapOopSize;
2669 next_nonstatic_field_offset = first_nonstatic_field_offset;
2670
2671 // Add fake fields for java.lang.Class instances (also see below)
2672 if (class_name() == vmSymbols::java_lang_Class() && class_loader.is_null()) {
2673 java_lang_Class_fix_pre(&methods, &fac, CHECK_(nullHandle));
2674 }
2675
2676 // Add a fake "discovered" field if it is not present
2677 // for compatibility with earlier jdk's.
2678 if (class_name() == vmSymbols::java_lang_ref_Reference()
2679 && class_loader.is_null()) {
2680 java_lang_ref_Reference_fix_pre(&fields, cp, &fac, CHECK_(nullHandle));
2681 }
2682 // end of "discovered" field compactibility fix
2683
2684 int nonstatic_double_count = fac.nonstatic_double_count;
2685 int nonstatic_word_count = fac.nonstatic_word_count;
2686 int nonstatic_short_count = fac.nonstatic_short_count;
2687 int nonstatic_byte_count = fac.nonstatic_byte_count;
2688 int nonstatic_oop_count = fac.nonstatic_oop_count;
2717 nonstatic_oop_count -= fake_oop_count;
2718 first_nonstatic_oop_offset = first_nonstatic_field_offset;
2719 } else {
2720 first_nonstatic_oop_offset = 0; // will be set for first oop field
2721 }
2722
2723 #ifndef PRODUCT
2724 if( PrintCompactFieldsSavings ) {
2725 next_nonstatic_double_offset = next_nonstatic_field_offset +
2726 (nonstatic_oop_count * heapOopSize);
2727 if ( nonstatic_double_count > 0 ) {
2728 next_nonstatic_double_offset = align_size_up(next_nonstatic_double_offset, BytesPerLong);
2729 }
2730 next_nonstatic_word_offset = next_nonstatic_double_offset +
2731 (nonstatic_double_count * BytesPerLong);
2732 next_nonstatic_short_offset = next_nonstatic_word_offset +
2733 (nonstatic_word_count * BytesPerInt);
2734 next_nonstatic_byte_offset = next_nonstatic_short_offset +
2735 (nonstatic_short_count * BytesPerShort);
2736 next_nonstatic_type_offset = align_size_up((next_nonstatic_byte_offset +
2737 nonstatic_byte_count ), heapOopSize );
2738 orig_nonstatic_field_size = nonstatic_field_size +
2739 ((next_nonstatic_type_offset - first_nonstatic_field_offset)/heapOopSize);
2740 }
2741 #endif
2742 bool compact_fields = CompactFields;
2743 int allocation_style = FieldsAllocationStyle;
2744 if( allocation_style < 0 || allocation_style > 1 ) { // Out of range?
2745 assert(false, "0 <= FieldsAllocationStyle <= 1");
2746 allocation_style = 1; // Optimistic
2747 }
2748
2749 // The next classes have predefined hard-coded fields offsets
2750 // (see in JavaClasses::compute_hard_coded_offsets()).
2751 // Use default fields allocation order for them.
2752 if( (allocation_style != 0 || compact_fields ) && class_loader.is_null() &&
2753 (class_name() == vmSymbols::java_lang_AssertionStatusDirectives() ||
2754 class_name() == vmSymbols::java_lang_Class() ||
2755 class_name() == vmSymbols::java_lang_ClassLoader() ||
2756 class_name() == vmSymbols::java_lang_ref_Reference() ||
2757 class_name() == vmSymbols::java_lang_ref_SoftReference() ||
2758 class_name() == vmSymbols::java_lang_StackTraceElement() ||
2759 class_name() == vmSymbols::java_lang_String() ||
2774 // Fields order: oops, longs/doubles, ints, shorts/chars, bytes
2775 next_nonstatic_oop_offset = next_nonstatic_field_offset;
2776 next_nonstatic_double_offset = next_nonstatic_oop_offset +
2777 (nonstatic_oop_count * heapOopSize);
2778 } else if( allocation_style == 1 ) {
2779 // Fields order: longs/doubles, ints, shorts/chars, bytes, oops
2780 next_nonstatic_double_offset = next_nonstatic_field_offset;
2781 } else {
2782 ShouldNotReachHere();
2783 }
2784
2785 int nonstatic_oop_space_count = 0;
2786 int nonstatic_word_space_count = 0;
2787 int nonstatic_short_space_count = 0;
2788 int nonstatic_byte_space_count = 0;
2789 int nonstatic_oop_space_offset;
2790 int nonstatic_word_space_offset;
2791 int nonstatic_short_space_offset;
2792 int nonstatic_byte_space_offset;
2793
2794 if( nonstatic_double_count > 0 ) {
2795 int offset = next_nonstatic_double_offset;
2796 next_nonstatic_double_offset = align_size_up(offset, BytesPerLong);
2797 if( compact_fields && offset != next_nonstatic_double_offset ) {
2798 // Allocate available fields into the gap before double field.
2799 int length = next_nonstatic_double_offset - offset;
2800 assert(length == BytesPerInt, "");
2801 nonstatic_word_space_offset = offset;
2802 if( nonstatic_word_count > 0 ) {
2803 nonstatic_word_count -= 1;
2804 nonstatic_word_space_count = 1; // Only one will fit
2805 length -= BytesPerInt;
2806 offset += BytesPerInt;
2807 }
2808 nonstatic_short_space_offset = offset;
2809 while( length >= BytesPerShort && nonstatic_short_count > 0 ) {
2810 nonstatic_short_count -= 1;
2811 nonstatic_short_space_count += 1;
2812 length -= BytesPerShort;
2813 offset += BytesPerShort;
2814 }
2815 nonstatic_byte_space_offset = offset;
2816 while( length > 0 && nonstatic_byte_count > 0 ) {
2817 nonstatic_byte_count -= 1;
2818 nonstatic_byte_space_count += 1;
2819 length -= 1;
2820 }
2821 // Allocate oop field in the gap if there are no other fields for that.
2822 nonstatic_oop_space_offset = offset;
2823 if( length >= heapOopSize && nonstatic_oop_count > 0 &&
2824 allocation_style != 0 ) { // when oop fields not first
2825 nonstatic_oop_count -= 1;
2826 nonstatic_oop_space_count = 1; // Only one will fit
2827 length -= heapOopSize;
2828 offset += heapOopSize;
2829 }
2830 }
2831 }
2832
2833 next_nonstatic_word_offset = next_nonstatic_double_offset +
2834 (nonstatic_double_count * BytesPerLong);
2835 next_nonstatic_short_offset = next_nonstatic_word_offset +
2836 (nonstatic_word_count * BytesPerInt);
2837 next_nonstatic_byte_offset = next_nonstatic_short_offset +
2838 (nonstatic_short_count * BytesPerShort);
2839
2840 int notaligned_offset;
2841 if( allocation_style == 0 ) {
2842 notaligned_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
2843 } else { // allocation_style == 1
2844 next_nonstatic_oop_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
2845 if( nonstatic_oop_count > 0 ) {
2846 next_nonstatic_oop_offset = align_size_up(next_nonstatic_oop_offset, heapOopSize);
2847 }
2848 notaligned_offset = next_nonstatic_oop_offset + (nonstatic_oop_count * heapOopSize);
2849 }
2850 next_nonstatic_type_offset = align_size_up(notaligned_offset, heapOopSize );
2851 nonstatic_field_size = nonstatic_field_size + ((next_nonstatic_type_offset
2852 - first_nonstatic_field_offset)/heapOopSize);
2853
2854 // Iterate over fields again and compute correct offsets.
2855 // The field allocation type was temporarily stored in the offset slot.
2856 // oop fields are located before non-oop fields (static and non-static).
2857 int len = fields->length();
2858 for (int i = 0; i < len; i += instanceKlass::next_offset) {
2859 int real_offset;
2860 FieldAllocationType atype = (FieldAllocationType) fields->ushort_at(i+4);
2861 switch (atype) {
2862 case STATIC_OOP:
2863 real_offset = next_static_oop_offset;
2864 next_static_oop_offset += heapOopSize;
2865 break;
2866 case STATIC_BYTE:
2867 real_offset = next_static_byte_offset;
2868 next_static_byte_offset += 1;
2869 break;
2870 case STATIC_SHORT:
2871 real_offset = next_static_short_offset;
2872 next_static_short_offset += BytesPerShort;
2933 } else {
2934 real_offset = next_nonstatic_word_offset;
2935 next_nonstatic_word_offset += BytesPerInt;
2936 }
2937 break;
2938 case NONSTATIC_ALIGNED_DOUBLE:
2939 case NONSTATIC_DOUBLE:
2940 real_offset = next_nonstatic_double_offset;
2941 next_nonstatic_double_offset += BytesPerLong;
2942 break;
2943 default:
2944 ShouldNotReachHere();
2945 }
2946 fields->short_at_put(i+4, extract_low_short_from_int(real_offset) );
2947 fields->short_at_put(i+5, extract_high_short_from_int(real_offset) );
2948 }
2949
2950 // Size of instances
2951 int instance_size;
2952
2953 next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize );
2954 instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
2955
2956 assert(instance_size == align_object_size(align_size_up((instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize), wordSize) / wordSize), "consistent layout helper value");
2957
2958 // Size of non-static oop map blocks (in words) allocated at end of klass
2959 int nonstatic_oop_map_size = compute_oop_map_size(super_klass, nonstatic_oop_map_count, first_nonstatic_oop_offset);
2960
2961 // Compute reference type
2962 ReferenceType rt;
2963 if (super_klass() == NULL) {
2964 rt = REF_NONE;
2965 } else {
2966 rt = super_klass->reference_type();
2967 }
2968
2969 // We can now create the basic klassOop for this klass
2970 klassOop ik = oopFactory::new_instanceKlass(
2971 vtable_size, itable_size,
2972 static_field_size, nonstatic_oop_map_size,
2973 rt, CHECK_(nullHandle));
2974 instanceKlassHandle this_klass (THREAD, ik);
2975
2976 assert(this_klass->static_field_size() == static_field_size &&
3094 const char * from = Klass::cast(this_klass())->external_name();
3095 if (this_klass->java_super() != NULL) {
3096 tty->print("RESOLVE %s %s\n", from, instanceKlass::cast(this_klass->java_super())->external_name());
3097 }
3098 // print out each of the interface classes referred to by this class.
3099 objArrayHandle local_interfaces(THREAD, this_klass->local_interfaces());
3100 if (!local_interfaces.is_null()) {
3101 int length = local_interfaces->length();
3102 for (int i = 0; i < length; i++) {
3103 klassOop k = klassOop(local_interfaces->obj_at(i));
3104 instanceKlass* to_class = instanceKlass::cast(k);
3105 const char * to = to_class->external_name();
3106 tty->print("RESOLVE %s %s\n", from, to);
3107 }
3108 }
3109 }
3110
3111 #ifndef PRODUCT
3112 if( PrintCompactFieldsSavings ) {
3113 if( nonstatic_field_size < orig_nonstatic_field_size ) {
3114 tty->print("[Saved %d of %d bytes in %s]\n",
3115 (orig_nonstatic_field_size - nonstatic_field_size)*heapOopSize,
3116 orig_nonstatic_field_size*heapOopSize,
3117 this_klass->external_name());
3118 } else if( nonstatic_field_size > orig_nonstatic_field_size ) {
3119 tty->print("[Wasted %d over %d bytes in %s]\n",
3120 (nonstatic_field_size - orig_nonstatic_field_size)*heapOopSize,
3121 orig_nonstatic_field_size*heapOopSize,
3122 this_klass->external_name());
3123 }
3124 }
3125 #endif
3126
3127 // preserve result across HandleMark
3128 preserve_this_klass = this_klass();
3129 }
3130
3131 // Create new handle outside HandleMark
3132 instanceKlassHandle this_klass (THREAD, preserve_this_klass);
3133 debug_only(this_klass->as_klassOop()->verify();)
3134
3135 return this_klass;
3136 }
3137
3138
3139 int ClassFileParser::compute_oop_map_size(instanceKlassHandle super, int nonstatic_oop_map_count, int first_nonstatic_oop_offset) {
3140 int map_size = super.is_null() ? 0 : super->nonstatic_oop_map_size();
3141 if (nonstatic_oop_map_count > 0) {
3142 // We have oops to add to map
|