2494 THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
2495 "missing I or J signature (for vmentry) in java.dyn.MethodHandle");
2496
2497 bool found_vmentry = false;
2498
2499 const int n = (*fields_ptr)()->length();
2500 for (int i = 0; i < n; i += instanceKlass::next_offset) {
2501 int name_index = (*fields_ptr)->ushort_at(i + instanceKlass::name_index_offset);
2502 int sig_index = (*fields_ptr)->ushort_at(i + instanceKlass::signature_index_offset);
2503 int acc_flags = (*fields_ptr)->ushort_at(i + instanceKlass::access_flags_offset);
2504 symbolOop f_name = cp->symbol_at(name_index);
2505 symbolOop f_sig = cp->symbol_at(sig_index);
2506 if (f_sig == vmSymbols::byte_signature() &&
2507 f_name == vmSymbols::vmentry_name() &&
2508 (acc_flags & JVM_ACC_STATIC) == 0) {
2509 // Adjust the field type from byte to an unmanaged pointer.
2510 assert(fac_ptr->nonstatic_byte_count > 0, "");
2511 fac_ptr->nonstatic_byte_count -= 1;
2512 (*fields_ptr)->ushort_at_put(i + instanceKlass::signature_index_offset,
2513 word_sig_index);
2514 if (wordSize == jintSize) {
2515 fac_ptr->nonstatic_word_count += 1;
2516 } else {
2517 fac_ptr->nonstatic_double_count += 1;
2518 }
2519
2520 FieldAllocationType atype = (FieldAllocationType) (*fields_ptr)->ushort_at(i+4);
2521 assert(atype == NONSTATIC_BYTE, "");
2522 FieldAllocationType new_atype = NONSTATIC_WORD;
2523 if (wordSize > jintSize) {
2524 if (Universe::field_type_should_be_aligned(T_LONG)) {
2525 atype = NONSTATIC_ALIGNED_DOUBLE;
2526 } else {
2527 atype = NONSTATIC_DOUBLE;
2528 }
2529 }
2530 (*fields_ptr)->ushort_at_put(i+4, new_atype);
2531
2532 found_vmentry = true;
2533 break;
2534 }
2535 }
2536
2537 if (!found_vmentry)
2538 THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
2539 "missing vmentry byte field in java.dyn.MethodHandle");
2540
2541 }
2542
2543
2544 instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
2545 Handle class_loader,
2546 Handle protection_domain,
2547 KlassHandle host_klass,
2548 GrowableArray<Handle>* cp_patches,
2549 symbolHandle& parsed_name,
2550 bool verify,
3068 int notaligned_offset;
3069 if( allocation_style == 0 ) {
3070 notaligned_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
3071 } else { // allocation_style == 1
3072 next_nonstatic_oop_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
3073 if( nonstatic_oop_count > 0 ) {
3074 next_nonstatic_oop_offset = align_size_up(next_nonstatic_oop_offset, heapOopSize);
3075 }
3076 notaligned_offset = next_nonstatic_oop_offset + (nonstatic_oop_count * heapOopSize);
3077 }
3078 next_nonstatic_type_offset = align_size_up(notaligned_offset, heapOopSize );
3079 nonstatic_field_size = nonstatic_field_size + ((next_nonstatic_type_offset
3080 - first_nonstatic_field_offset)/heapOopSize);
3081
3082 // Iterate over fields again and compute correct offsets.
3083 // The field allocation type was temporarily stored in the offset slot.
3084 // oop fields are located before non-oop fields (static and non-static).
3085 int len = fields->length();
3086 for (int i = 0; i < len; i += instanceKlass::next_offset) {
3087 int real_offset;
3088 FieldAllocationType atype = (FieldAllocationType) fields->ushort_at(i+4);
3089 switch (atype) {
3090 case STATIC_OOP:
3091 real_offset = next_static_oop_offset;
3092 next_static_oop_offset += heapOopSize;
3093 break;
3094 case STATIC_BYTE:
3095 real_offset = next_static_byte_offset;
3096 next_static_byte_offset += 1;
3097 break;
3098 case STATIC_SHORT:
3099 real_offset = next_static_short_offset;
3100 next_static_short_offset += BytesPerShort;
3101 break;
3102 case STATIC_WORD:
3103 real_offset = next_static_word_offset;
3104 next_static_word_offset += BytesPerInt;
3105 break;
3106 case STATIC_ALIGNED_DOUBLE:
3107 case STATIC_DOUBLE:
3108 real_offset = next_static_double_offset;
3156 }
3157 break;
3158 case NONSTATIC_WORD:
3159 if( nonstatic_word_space_count > 0 ) {
3160 real_offset = nonstatic_word_space_offset;
3161 nonstatic_word_space_offset += BytesPerInt;
3162 nonstatic_word_space_count -= 1;
3163 } else {
3164 real_offset = next_nonstatic_word_offset;
3165 next_nonstatic_word_offset += BytesPerInt;
3166 }
3167 break;
3168 case NONSTATIC_ALIGNED_DOUBLE:
3169 case NONSTATIC_DOUBLE:
3170 real_offset = next_nonstatic_double_offset;
3171 next_nonstatic_double_offset += BytesPerLong;
3172 break;
3173 default:
3174 ShouldNotReachHere();
3175 }
3176 fields->short_at_put(i+4, extract_low_short_from_int(real_offset) );
3177 fields->short_at_put(i+5, extract_high_short_from_int(real_offset) );
3178 }
3179
3180 // Size of instances
3181 int instance_size;
3182
3183 next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize );
3184 instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
3185
3186 assert(instance_size == align_object_size(align_size_up((instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize), wordSize) / wordSize), "consistent layout helper value");
3187
3188 // Number of non-static oop map blocks allocated at end of klass.
3189 const unsigned int total_oop_map_count =
3190 compute_oop_map_count(super_klass, nonstatic_oop_map_count,
3191 first_nonstatic_oop_offset);
3192
3193 // Compute reference type
3194 ReferenceType rt;
3195 if (super_klass() == NULL) {
3196 rt = REF_NONE;
3197 } else {
|
2494 THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
2495 "missing I or J signature (for vmentry) in java.dyn.MethodHandle");
2496
2497 bool found_vmentry = false;
2498
2499 const int n = (*fields_ptr)()->length();
2500 for (int i = 0; i < n; i += instanceKlass::next_offset) {
2501 int name_index = (*fields_ptr)->ushort_at(i + instanceKlass::name_index_offset);
2502 int sig_index = (*fields_ptr)->ushort_at(i + instanceKlass::signature_index_offset);
2503 int acc_flags = (*fields_ptr)->ushort_at(i + instanceKlass::access_flags_offset);
2504 symbolOop f_name = cp->symbol_at(name_index);
2505 symbolOop f_sig = cp->symbol_at(sig_index);
2506 if (f_sig == vmSymbols::byte_signature() &&
2507 f_name == vmSymbols::vmentry_name() &&
2508 (acc_flags & JVM_ACC_STATIC) == 0) {
2509 // Adjust the field type from byte to an unmanaged pointer.
2510 assert(fac_ptr->nonstatic_byte_count > 0, "");
2511 fac_ptr->nonstatic_byte_count -= 1;
2512 (*fields_ptr)->ushort_at_put(i + instanceKlass::signature_index_offset,
2513 word_sig_index);
2514 fac_ptr->nonstatic_word_count += 1;
2515
2516 FieldAllocationType atype = (FieldAllocationType) (*fields_ptr)->ushort_at(i + instanceKlass::low_offset);
2517 assert(atype == NONSTATIC_BYTE, "");
2518 FieldAllocationType new_atype = NONSTATIC_WORD;
2519 (*fields_ptr)->ushort_at_put(i + instanceKlass::low_offset, new_atype);
2520
2521 found_vmentry = true;
2522 break;
2523 }
2524 }
2525
2526 if (!found_vmentry)
2527 THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
2528 "missing vmentry byte field in java.dyn.MethodHandle");
2529
2530 }
2531
2532
2533 instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
2534 Handle class_loader,
2535 Handle protection_domain,
2536 KlassHandle host_klass,
2537 GrowableArray<Handle>* cp_patches,
2538 symbolHandle& parsed_name,
2539 bool verify,
3057 int notaligned_offset;
3058 if( allocation_style == 0 ) {
3059 notaligned_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
3060 } else { // allocation_style == 1
3061 next_nonstatic_oop_offset = next_nonstatic_byte_offset + nonstatic_byte_count;
3062 if( nonstatic_oop_count > 0 ) {
3063 next_nonstatic_oop_offset = align_size_up(next_nonstatic_oop_offset, heapOopSize);
3064 }
3065 notaligned_offset = next_nonstatic_oop_offset + (nonstatic_oop_count * heapOopSize);
3066 }
3067 next_nonstatic_type_offset = align_size_up(notaligned_offset, heapOopSize );
3068 nonstatic_field_size = nonstatic_field_size + ((next_nonstatic_type_offset
3069 - first_nonstatic_field_offset)/heapOopSize);
3070
3071 // Iterate over fields again and compute correct offsets.
3072 // The field allocation type was temporarily stored in the offset slot.
3073 // oop fields are located before non-oop fields (static and non-static).
3074 int len = fields->length();
3075 for (int i = 0; i < len; i += instanceKlass::next_offset) {
3076 int real_offset;
3077 FieldAllocationType atype = (FieldAllocationType) fields->ushort_at(i + instanceKlass::low_offset);
3078 switch (atype) {
3079 case STATIC_OOP:
3080 real_offset = next_static_oop_offset;
3081 next_static_oop_offset += heapOopSize;
3082 break;
3083 case STATIC_BYTE:
3084 real_offset = next_static_byte_offset;
3085 next_static_byte_offset += 1;
3086 break;
3087 case STATIC_SHORT:
3088 real_offset = next_static_short_offset;
3089 next_static_short_offset += BytesPerShort;
3090 break;
3091 case STATIC_WORD:
3092 real_offset = next_static_word_offset;
3093 next_static_word_offset += BytesPerInt;
3094 break;
3095 case STATIC_ALIGNED_DOUBLE:
3096 case STATIC_DOUBLE:
3097 real_offset = next_static_double_offset;
3145 }
3146 break;
3147 case NONSTATIC_WORD:
3148 if( nonstatic_word_space_count > 0 ) {
3149 real_offset = nonstatic_word_space_offset;
3150 nonstatic_word_space_offset += BytesPerInt;
3151 nonstatic_word_space_count -= 1;
3152 } else {
3153 real_offset = next_nonstatic_word_offset;
3154 next_nonstatic_word_offset += BytesPerInt;
3155 }
3156 break;
3157 case NONSTATIC_ALIGNED_DOUBLE:
3158 case NONSTATIC_DOUBLE:
3159 real_offset = next_nonstatic_double_offset;
3160 next_nonstatic_double_offset += BytesPerLong;
3161 break;
3162 default:
3163 ShouldNotReachHere();
3164 }
3165 fields->short_at_put(i + instanceKlass::low_offset, extract_low_short_from_int(real_offset));
3166 fields->short_at_put(i + instanceKlass::high_offset, extract_high_short_from_int(real_offset));
3167 }
3168
3169 // Size of instances
3170 int instance_size;
3171
3172 next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize );
3173 instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
3174
3175 assert(instance_size == align_object_size(align_size_up((instanceOopDesc::base_offset_in_bytes() + nonstatic_field_size*heapOopSize), wordSize) / wordSize), "consistent layout helper value");
3176
3177 // Number of non-static oop map blocks allocated at end of klass.
3178 const unsigned int total_oop_map_count =
3179 compute_oop_map_count(super_klass, nonstatic_oop_map_count,
3180 first_nonstatic_oop_offset);
3181
3182 // Compute reference type
3183 ReferenceType rt;
3184 if (super_klass() == NULL) {
3185 rt = REF_NONE;
3186 } else {
|