comparison src/share/vm/classfile/classFileParser.cpp @ 1366:b9d85fcdf743

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
author kvn
date Wed, 07 Apr 2010 10:35:56 -0700
parents 9b9c1ee9b3f6
children f03d0a26bf83 cd5dbf694d45
comparison
equal deleted inserted replaced
1365:6476042f815c 1366:b9d85fcdf743
2954 ((next_nonstatic_type_offset - first_nonstatic_field_offset)/heapOopSize); 2954 ((next_nonstatic_type_offset - first_nonstatic_field_offset)/heapOopSize);
2955 } 2955 }
2956 #endif 2956 #endif
2957 bool compact_fields = CompactFields; 2957 bool compact_fields = CompactFields;
2958 int allocation_style = FieldsAllocationStyle; 2958 int allocation_style = FieldsAllocationStyle;
2959 if( allocation_style < 0 || allocation_style > 1 ) { // Out of range? 2959 if( allocation_style < 0 || allocation_style > 2 ) { // Out of range?
2960 assert(false, "0 <= FieldsAllocationStyle <= 1"); 2960 assert(false, "0 <= FieldsAllocationStyle <= 2");
2961 allocation_style = 1; // Optimistic 2961 allocation_style = 1; // Optimistic
2962 } 2962 }
2963 2963
2964 // The next classes have predefined hard-coded fields offsets 2964 // The next classes have predefined hard-coded fields offsets
2965 // (see in JavaClasses::compute_hard_coded_offsets()). 2965 // (see in JavaClasses::compute_hard_coded_offsets()).
2991 next_nonstatic_double_offset = next_nonstatic_oop_offset + 2991 next_nonstatic_double_offset = next_nonstatic_oop_offset +
2992 (nonstatic_oop_count * heapOopSize); 2992 (nonstatic_oop_count * heapOopSize);
2993 } else if( allocation_style == 1 ) { 2993 } else if( allocation_style == 1 ) {
2994 // Fields order: longs/doubles, ints, shorts/chars, bytes, oops 2994 // Fields order: longs/doubles, ints, shorts/chars, bytes, oops
2995 next_nonstatic_double_offset = next_nonstatic_field_offset; 2995 next_nonstatic_double_offset = next_nonstatic_field_offset;
2996 } else if( allocation_style == 2 ) {
2997 // Fields allocation: oops fields in super and sub classes are together.
2998 if( nonstatic_field_size > 0 && super_klass() != NULL &&
2999 super_klass->nonstatic_oop_map_size() > 0 ) {
3000 int map_size = super_klass->nonstatic_oop_map_size();
3001 OopMapBlock* first_map = super_klass->start_of_nonstatic_oop_maps();
3002 OopMapBlock* last_map = first_map + map_size - 1;
3003 int next_offset = last_map->offset() + (last_map->count() * heapOopSize);
3004 if (next_offset == next_nonstatic_field_offset) {
3005 allocation_style = 0; // allocate oops first
3006 next_nonstatic_oop_offset = next_nonstatic_field_offset;
3007 next_nonstatic_double_offset = next_nonstatic_oop_offset +
3008 (nonstatic_oop_count * heapOopSize);
3009 }
3010 }
3011 if( allocation_style == 2 ) {
3012 allocation_style = 1; // allocate oops last
3013 next_nonstatic_double_offset = next_nonstatic_field_offset;
3014 }
2996 } else { 3015 } else {
2997 ShouldNotReachHere(); 3016 ShouldNotReachHere();
2998 } 3017 }
2999 3018
3000 int nonstatic_oop_space_count = 0; 3019 int nonstatic_oop_space_count = 0;