Print this page
rev 1022 : 6829192: JSR 292 needs to support 64-bit x86
Summary: changes for method handles and invokedynamic
Reviewed-by: ?, ?

Split Close
Expand all
Collapse all
          --- old/src/share/vm/classfile/classFileParser.cpp
          +++ new/src/share/vm/classfile/classFileParser.cpp
↓ open down ↓ 2503 lines elided ↑ open up ↑
2504 2504      symbolOop f_name = cp->symbol_at(name_index);
2505 2505      symbolOop f_sig  = cp->symbol_at(sig_index);
2506 2506      if (f_sig == vmSymbols::byte_signature() &&
2507 2507          f_name == vmSymbols::vmentry_name() &&
2508 2508          (acc_flags & JVM_ACC_STATIC) == 0) {
2509 2509        // Adjust the field type from byte to an unmanaged pointer.
2510 2510        assert(fac_ptr->nonstatic_byte_count > 0, "");
2511 2511        fac_ptr->nonstatic_byte_count -= 1;
2512 2512        (*fields_ptr)->ushort_at_put(i + instanceKlass::signature_index_offset,
2513 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      -      }
     2514 +      fac_ptr->nonstatic_word_count += 1;
2519 2515  
2520      -      FieldAllocationType atype = (FieldAllocationType) (*fields_ptr)->ushort_at(i+4);
     2516 +      FieldAllocationType atype = (FieldAllocationType) (*fields_ptr)->ushort_at(i + instanceKlass::low_offset);
2521 2517        assert(atype == NONSTATIC_BYTE, "");
2522 2518        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);
     2519 +      (*fields_ptr)->ushort_at_put(i + instanceKlass::low_offset, new_atype);
2531 2520  
2532 2521        found_vmentry = true;
2533 2522        break;
2534 2523      }
2535 2524    }
2536 2525  
2537 2526    if (!found_vmentry)
2538 2527      THROW_MSG(vmSymbols::java_lang_VirtualMachineError(),
2539 2528                "missing vmentry byte field in java.dyn.MethodHandle");
2540 2529  
↓ open down ↓ 537 lines elided ↑ open up ↑
3078 3067      next_nonstatic_type_offset = align_size_up(notaligned_offset, heapOopSize );
3079 3068      nonstatic_field_size = nonstatic_field_size + ((next_nonstatic_type_offset
3080 3069                                     - first_nonstatic_field_offset)/heapOopSize);
3081 3070  
3082 3071      // Iterate over fields again and compute correct offsets.
3083 3072      // The field allocation type was temporarily stored in the offset slot.
3084 3073      // oop fields are located before non-oop fields (static and non-static).
3085 3074      int len = fields->length();
3086 3075      for (int i = 0; i < len; i += instanceKlass::next_offset) {
3087 3076        int real_offset;
3088      -      FieldAllocationType atype = (FieldAllocationType) fields->ushort_at(i+4);
     3077 +      FieldAllocationType atype = (FieldAllocationType) fields->ushort_at(i + instanceKlass::low_offset);
3089 3078        switch (atype) {
3090 3079          case STATIC_OOP:
3091 3080            real_offset = next_static_oop_offset;
3092 3081            next_static_oop_offset += heapOopSize;
3093 3082            break;
3094 3083          case STATIC_BYTE:
3095 3084            real_offset = next_static_byte_offset;
3096 3085            next_static_byte_offset += 1;
3097 3086            break;
3098 3087          case STATIC_SHORT:
↓ open down ↓ 67 lines elided ↑ open up ↑
3166 3155            }
3167 3156            break;
3168 3157          case NONSTATIC_ALIGNED_DOUBLE:
3169 3158          case NONSTATIC_DOUBLE:
3170 3159            real_offset = next_nonstatic_double_offset;
3171 3160            next_nonstatic_double_offset += BytesPerLong;
3172 3161            break;
3173 3162          default:
3174 3163            ShouldNotReachHere();
3175 3164        }
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) );
     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));
3178 3167      }
3179 3168  
3180 3169      // Size of instances
3181 3170      int instance_size;
3182 3171  
3183 3172      next_nonstatic_type_offset = align_size_up(notaligned_offset, wordSize );
3184 3173      instance_size = align_object_size(next_nonstatic_type_offset / wordSize);
3185 3174  
3186 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");
3187 3176  
↓ open down ↓ 1116 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX