6940733: allocate non static oop fields in super and sub classes together

Wed, 07 Apr 2010 10:35:56 -0700

author
kvn
date
Wed, 07 Apr 2010 10:35:56 -0700
changeset 1801
b9d85fcdf743
parent 1800
6476042f815c
child 1802
9e321dcfa5b7

6940733: allocate non static oop fields in super and sub classes together
Summary: Use FieldsAllocationStyle=2 to allocate non static oop fields in super and sub classes together
Reviewed-by: twisti

src/share/vm/classfile/classFileParser.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/globals.hpp file | annotate | diff | comparison | revisions
     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      }
     2.1 --- a/src/share/vm/runtime/globals.hpp	Wed Apr 07 09:37:47 2010 -0700
     2.2 +++ b/src/share/vm/runtime/globals.hpp	Wed Apr 07 10:35:56 2010 -0700
     2.3 @@ -1052,7 +1052,8 @@
     2.4            "Use SSE2 MOVDQU instruction for Arraycopy")                      \
     2.5                                                                              \
     2.6    product(intx, FieldsAllocationStyle, 1,                                   \
     2.7 -          "0 - type based with oops first, 1 - with oops last")             \
     2.8 +          "0 - type based with oops first, 1 - with oops last, "            \
     2.9 +          "2 - oops in super and sub classes are together")                 \
    2.10                                                                              \
    2.11    product(bool, CompactFields, true,                                        \
    2.12            "Allocate nonstatic fields in gaps between previous fields")      \

mercurial