src/share/vm/classfile/classFileParser.cpp

changeset 1801
b9d85fcdf743
parent 1579
9b9c1ee9b3f6
child 1845
f03d0a26bf83
child 1862
cd5dbf694d45
     1.1 --- a/src/share/vm/classfile/classFileParser.cpp	Wed Apr 07 09:37:47 2010 -0700
     1.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Wed Apr 07 10:35:56 2010 -0700
     1.3 @@ -2956,8 +2956,8 @@
     1.4  #endif
     1.5      bool compact_fields   = CompactFields;
     1.6      int  allocation_style = FieldsAllocationStyle;
     1.7 -    if( allocation_style < 0 || allocation_style > 1 ) { // Out of range?
     1.8 -      assert(false, "0 <= FieldsAllocationStyle <= 1");
     1.9 +    if( allocation_style < 0 || allocation_style > 2 ) { // Out of range?
    1.10 +      assert(false, "0 <= FieldsAllocationStyle <= 2");
    1.11        allocation_style = 1; // Optimistic
    1.12      }
    1.13  
    1.14 @@ -2993,6 +2993,25 @@
    1.15      } else if( allocation_style == 1 ) {
    1.16        // Fields order: longs/doubles, ints, shorts/chars, bytes, oops
    1.17        next_nonstatic_double_offset = next_nonstatic_field_offset;
    1.18 +    } else if( allocation_style == 2 ) {
    1.19 +      // Fields allocation: oops fields in super and sub classes are together.
    1.20 +      if( nonstatic_field_size > 0 && super_klass() != NULL &&
    1.21 +          super_klass->nonstatic_oop_map_size() > 0 ) {
    1.22 +        int map_size = super_klass->nonstatic_oop_map_size();
    1.23 +        OopMapBlock* first_map = super_klass->start_of_nonstatic_oop_maps();
    1.24 +        OopMapBlock* last_map = first_map + map_size - 1;
    1.25 +        int next_offset = last_map->offset() + (last_map->count() * heapOopSize);
    1.26 +        if (next_offset == next_nonstatic_field_offset) {
    1.27 +          allocation_style = 0;   // allocate oops first
    1.28 +          next_nonstatic_oop_offset    = next_nonstatic_field_offset;
    1.29 +          next_nonstatic_double_offset = next_nonstatic_oop_offset +
    1.30 +                                         (nonstatic_oop_count * heapOopSize);
    1.31 +        }
    1.32 +      }
    1.33 +      if( allocation_style == 2 ) {
    1.34 +        allocation_style = 1;     // allocate oops last
    1.35 +        next_nonstatic_double_offset = next_nonstatic_field_offset;
    1.36 +      }
    1.37      } else {
    1.38        ShouldNotReachHere();
    1.39      }

mercurial